mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
server: Add pagination and search
This commit is contained in:
parent
f81c3ed940
commit
a39195d2c4
5 changed files with 15 additions and 10 deletions
|
|
@ -7,8 +7,9 @@ class CompositionsController extends ResourceController {
|
||||||
CompositionsController(this.db);
|
CompositionsController(this.db);
|
||||||
|
|
||||||
@Operation.get('id')
|
@Operation.get('id')
|
||||||
Future<Response> getWorks(@Bind.path('id') int id) async {
|
Future<Response> getWorks(@Bind.path('id') int id,
|
||||||
final works = await db.getWorks(id);
|
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||||
|
final works = await db.getWorks(id, page, search);
|
||||||
return Response.ok(works);
|
return Response.ok(works);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ class EnsemblesController extends ResourceController {
|
||||||
EnsemblesController(this.db);
|
EnsemblesController(this.db);
|
||||||
|
|
||||||
@Operation.get()
|
@Operation.get()
|
||||||
Future<Response> getEnsembles() async {
|
Future<Response> getEnsembles(
|
||||||
final ensembles = await db.allEnsembles().get();
|
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||||
|
final ensembles = await db.getEnsembles(page, search);
|
||||||
return Response.ok(ensembles);
|
return Response.ok(ensembles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ class InstrumentsController extends ResourceController {
|
||||||
InstrumentsController(this.db);
|
InstrumentsController(this.db);
|
||||||
|
|
||||||
@Operation.get()
|
@Operation.get()
|
||||||
Future<Response> getInstruments() async {
|
Future<Response> getInstruments(
|
||||||
final instruments = await db.allInstruments().get();
|
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||||
|
final instruments = await db.getInstruments(page, search);
|
||||||
return Response.ok(instruments);
|
return Response.ok(instruments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ class PersonsController extends ResourceController {
|
||||||
PersonsController(this.db);
|
PersonsController(this.db);
|
||||||
|
|
||||||
@Operation.get()
|
@Operation.get()
|
||||||
Future<Response> getPersons() async {
|
Future<Response> getPersons(
|
||||||
final persons = await db.allPersons().get();
|
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||||
|
final persons = await db.getPersons(page, search);
|
||||||
return Response.ok(persons);
|
return Response.ok(persons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ class WorkRecordingsController extends ResourceController {
|
||||||
WorkRecordingsController(this.db);
|
WorkRecordingsController(this.db);
|
||||||
|
|
||||||
@Operation.get('id')
|
@Operation.get('id')
|
||||||
Future<Response> getRecordings(@Bind.path('id') int id) async {
|
Future<Response> getRecordings(@Bind.path('id') int id,
|
||||||
final recordings = await db.getRecordings(id);
|
[@Bind.query('p') int page]) async {
|
||||||
|
final recordings = await db.getRecordings(id, page);
|
||||||
return Response.ok(recordings);
|
return Response.ok(recordings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue