database: Unify work and recording API

This commit is contained in:
Elias Projahn 2020-04-26 16:48:05 +02:00
parent c93ebf17a0
commit 0fc0c933ac
7 changed files with 116 additions and 201 deletions

View file

@ -19,9 +19,9 @@ class RecordingsController extends ResourceController {
@Operation.put('id')
Future<Response> putRecording(
@Bind.path('id') int id, @Bind.body() Map<String, dynamic> json) async {
final data = RecordingData.fromJson(json);
await db.updateRecording(data);
final recordingInfo = RecordingInfo.fromJson(json);
await db.updateRecording(recordingInfo);
return Response.ok(await db.getRecording(id));
return Response.ok(null);
}
}

View file

@ -19,9 +19,9 @@ class WorksController extends ResourceController {
@Operation.put('id')
Future<Response> putWork(
@Bind.path('id') int id, @Bind.body() Map<String, dynamic> json) async {
final data = WorkData.fromJson(json);
await db.updateWork(data);
return Response.ok(await db.getWork(id));
final workInfo = WorkInfo.fromJson(json);
await db.updateWork(workInfo);
return Response.ok(null);
}
}