Spaces:
Build error
Build error
David Li commited on
Commit ·
46951bb
1
Parent(s): 4254c1b
fix: update dart off server
Browse files- Dockerfile +1 -1
- lib/core.dart +2 -7
Dockerfile
CHANGED
|
@@ -3,7 +3,7 @@ WORKDIR /app
|
|
| 3 |
COPY pubspec.yaml pubspec.lock ./
|
| 4 |
RUN dart pub get
|
| 5 |
COPY . .
|
| 6 |
-
RUN dart compile exe bin/
|
| 7 |
|
| 8 |
# copy server file to basic image to run the app
|
| 9 |
FROM ubuntu:latest
|
|
|
|
| 3 |
COPY pubspec.yaml pubspec.lock ./
|
| 4 |
RUN dart pub get
|
| 5 |
COPY . .
|
| 6 |
+
RUN dart compile exe bin/dart_off_server.dart -o /app/dart_off_server
|
| 7 |
|
| 8 |
# copy server file to basic image to run the app
|
| 9 |
FROM ubuntu:latest
|
lib/core.dart
CHANGED
|
@@ -2,9 +2,9 @@ import 'package:openfoodfacts/openfoodfacts.dart';
|
|
| 2 |
|
| 3 |
Future<SearchResult> search(Map<String, String> query) {
|
| 4 |
var parametersList = <Parameter>[];
|
| 5 |
-
// check for terms in
|
|
|
|
| 6 |
if (query.containsKey('terms')) {
|
| 7 |
-
// print('terms: ${query['terms']}');
|
| 8 |
var terms = query['terms'];
|
| 9 |
if (terms != null && terms.isNotEmpty) {
|
| 10 |
parametersList.add(SearchTerms(terms: terms.split(',')));
|
|
@@ -12,7 +12,6 @@ Future<SearchResult> search(Map<String, String> query) {
|
|
| 12 |
}
|
| 13 |
// check for withoutAddictives
|
| 14 |
if (query.containsKey('withoutAdditives')) {
|
| 15 |
-
// print('withoutAdditives: ${query['withoutAdditives']}');
|
| 16 |
var withoutAdditives = query['withoutAdditives'];
|
| 17 |
if (withoutAdditives != null && withoutAdditives == "true") {
|
| 18 |
parametersList.add(WithoutAdditives());
|
|
@@ -20,7 +19,6 @@ Future<SearchResult> search(Map<String, String> query) {
|
|
| 20 |
}
|
| 21 |
|
| 22 |
if (query.containsKey('sort')) {
|
| 23 |
-
// print('sort: ${query['sort']}');
|
| 24 |
var sort = query['sort'];
|
| 25 |
if (sort != null && sort.isNotEmpty) {
|
| 26 |
var option = SortOption.values.firstWhere(
|
|
@@ -43,7 +41,6 @@ Future<SearchResult> search(Map<String, String> query) {
|
|
| 43 |
|
| 44 |
// page size
|
| 45 |
if (query.containsKey('size')) {
|
| 46 |
-
// print('size: ${query['size']}');
|
| 47 |
var size = query['size'];
|
| 48 |
if (size != null && size.isNotEmpty) {
|
| 49 |
parametersList.add(PageSize(size: int.parse(size)));
|
|
@@ -52,7 +49,6 @@ Future<SearchResult> search(Map<String, String> query) {
|
|
| 52 |
|
| 53 |
// page number
|
| 54 |
if (query.containsKey('page')) {
|
| 55 |
-
// print('page: ${query['page']}');
|
| 56 |
var page = query['page'];
|
| 57 |
if (page != null && page.isNotEmpty) {
|
| 58 |
parametersList.add(PageNumber(page: int.parse(page)));
|
|
@@ -61,7 +57,6 @@ Future<SearchResult> search(Map<String, String> query) {
|
|
| 61 |
|
| 62 |
// by tags
|
| 63 |
if (query.containsKey('tags')) {
|
| 64 |
-
// print('tags: ${query['tags']}');
|
| 65 |
var rawTags = query['tags'];
|
| 66 |
if (rawTags != null && rawTags.isNotEmpty) {
|
| 67 |
var tags = rawTags.split(',');
|
|
|
|
| 2 |
|
| 3 |
Future<SearchResult> search(Map<String, String> query) {
|
| 4 |
var parametersList = <Parameter>[];
|
| 5 |
+
// check for terms in query
|
| 6 |
+
|
| 7 |
if (query.containsKey('terms')) {
|
|
|
|
| 8 |
var terms = query['terms'];
|
| 9 |
if (terms != null && terms.isNotEmpty) {
|
| 10 |
parametersList.add(SearchTerms(terms: terms.split(',')));
|
|
|
|
| 12 |
}
|
| 13 |
// check for withoutAddictives
|
| 14 |
if (query.containsKey('withoutAdditives')) {
|
|
|
|
| 15 |
var withoutAdditives = query['withoutAdditives'];
|
| 16 |
if (withoutAdditives != null && withoutAdditives == "true") {
|
| 17 |
parametersList.add(WithoutAdditives());
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
if (query.containsKey('sort')) {
|
|
|
|
| 22 |
var sort = query['sort'];
|
| 23 |
if (sort != null && sort.isNotEmpty) {
|
| 24 |
var option = SortOption.values.firstWhere(
|
|
|
|
| 41 |
|
| 42 |
// page size
|
| 43 |
if (query.containsKey('size')) {
|
|
|
|
| 44 |
var size = query['size'];
|
| 45 |
if (size != null && size.isNotEmpty) {
|
| 46 |
parametersList.add(PageSize(size: int.parse(size)));
|
|
|
|
| 49 |
|
| 50 |
// page number
|
| 51 |
if (query.containsKey('page')) {
|
|
|
|
| 52 |
var page = query['page'];
|
| 53 |
if (page != null && page.isNotEmpty) {
|
| 54 |
parametersList.add(PageNumber(page: int.parse(page)));
|
|
|
|
| 57 |
|
| 58 |
// by tags
|
| 59 |
if (query.containsKey('tags')) {
|
|
|
|
| 60 |
var rawTags = query['tags'];
|
| 61 |
if (rawTags != null && rawTags.isNotEmpty) {
|
| 62 |
var tags = rawTags.split(',');
|