mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-27 03:07:26 +01:00
database, server: Simpler and more efficient API
This commit is contained in:
parent
d2a8363f6f
commit
ad022a6640
11 changed files with 271 additions and 68 deletions
|
|
@ -8,7 +8,7 @@ class WorksController extends ResourceController {
|
|||
|
||||
@Operation.get('id')
|
||||
Future<Response> getWork(@Bind.path('id') int id) async {
|
||||
final work = await db.workById(id).getSingle();
|
||||
final work = await db.getWork(id);
|
||||
if (work != null) {
|
||||
return Response.ok(work);
|
||||
} else {
|
||||
|
|
@ -21,6 +21,7 @@ class WorksController extends ResourceController {
|
|||
@Bind.path('id') int id, @Bind.body() Map<String, dynamic> json) async {
|
||||
final data = WorkData.fromJson(json);
|
||||
await db.updateWork(data);
|
||||
return Response.ok(null);
|
||||
|
||||
return Response.ok(await db.getWork(id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue