add checkRequiredFields fn
continuous-integration/drone/push Build is passing Details

adminDb
remrem 3 years ago
parent b91a552995
commit 648e2bbd24

@ -8,16 +8,16 @@ import 'package:shelf_router/shelf_router.dart';
final _router = Router() final _router = Router()
// GET // GET
..get('/', API.rootHandler) ..get('/', API.rootHandler)
// POST (EN VRAI C'EST DES GET AVEC UN BODY)
..post('/user/password-file', API.downloadPasswordDb)
..post('/auth', API.authenticator) ..post('/auth', API.authenticator)
..get('/user/down-password-file', API.downloadPasswordDb) ..post('/user/account', API.createAccount) // vrai post
// POST
..post('/user/create-account', API.createAccount)
// PUT // PUT
..put('/user/change-master-password', API.changeMasterPassword) ..put('/user/master-password', API.changeMasterPassword)
..put('/user/up-password-file', API.uploadPasswordDb) ..put('/user/password-file', API.uploadPasswordDb)
..put('/user/change-mail', API.changeMail) ..put('/user/change-mail', API.changeMail)
// DELETE // DELETE
..delete('/user/delete-account', API.deleteAccount); ..delete('/user/account', API.deleteAccount);
/* /*
Response _fileHandler(Request req) { Response _fileHandler(Request req) {

@ -76,4 +76,22 @@ class API {
static Response deleteAccount(Request req) { static Response deleteAccount(Request req) {
return Response.ok(""); return Response.ok("");
} }
/*---------------|
|-------MISC-----|
|---------------*/
// Check if required fields are in req body
static Future<bool> checkRequiredFields(
List<String> fields, Request req) async {
// json object read -> check dic keys
final body = await req.readAsString();
bool check = false;
for (String s in fields) {
if (req.params['$s'] == "") {
return false;
}
}
return true;
}
} }

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "49.0.0" version: "50.0.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.1.0" version: "5.2.0"
args: args:
dependency: "direct main" dependency: "direct main"
description: description:
@ -28,21 +28,21 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.9.0" version: "2.10.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.0" version: "1.17.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@ -77,14 +77,14 @@ packages:
name: frontend_server_client name: frontend_server_client
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.2.0"
glob: glob:
dependency: transitive dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
http: http:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -112,7 +112,7 @@ packages:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.1" version: "4.0.2"
io: io:
dependency: transitive dependency: transitive
description: description:
@ -126,14 +126,14 @@ packages:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.4" version: "0.6.5"
lints: lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: lints name: lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.1"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -147,7 +147,7 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.12" version: "0.12.13"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -196,7 +196,7 @@ packages:
name: pub_semver name: pub_semver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.3"
shelf: shelf:
dependency: "direct main" dependency: "direct main"
description: description:
@ -231,21 +231,21 @@ packages:
name: shelf_web_socket name: shelf_web_socket
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.3"
source_map_stack_trace: source_map_stack_trace:
dependency: transitive dependency: transitive
description: description:
name: source_map_stack_trace name: source_map_stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
source_maps: source_maps:
dependency: transitive dependency: transitive
description: description:
name: source_maps name: source_maps
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.10.10" version: "0.10.11"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -259,7 +259,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0" version: "1.11.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
@ -273,7 +273,7 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.1" version: "1.2.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -287,21 +287,21 @@ packages:
name: test name: test
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.21.6" version: "1.22.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.14" version: "0.4.16"
test_core: test_core:
dependency: transitive dependency: transitive
description: description:
name: test_core name: test_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.18" version: "0.4.20"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -322,7 +322,7 @@ packages:
name: watcher name: watcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.2"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save