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);
|
||||
|
||||
@Operation.get('id')
|
||||
Future<Response> getWorks(@Bind.path('id') int id) async {
|
||||
final works = await db.getWorks(id);
|
||||
Future<Response> getWorks(@Bind.path('id') int id,
|
||||
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||
final works = await db.getWorks(id, page, search);
|
||||
return Response.ok(works);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ class EnsemblesController extends ResourceController {
|
|||
EnsemblesController(this.db);
|
||||
|
||||
@Operation.get()
|
||||
Future<Response> getEnsembles() async {
|
||||
final ensembles = await db.allEnsembles().get();
|
||||
Future<Response> getEnsembles(
|
||||
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||
final ensembles = await db.getEnsembles(page, search);
|
||||
return Response.ok(ensembles);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ class InstrumentsController extends ResourceController {
|
|||
InstrumentsController(this.db);
|
||||
|
||||
@Operation.get()
|
||||
Future<Response> getInstruments() async {
|
||||
final instruments = await db.allInstruments().get();
|
||||
Future<Response> getInstruments(
|
||||
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||
final instruments = await db.getInstruments(page, search);
|
||||
return Response.ok(instruments);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ class PersonsController extends ResourceController {
|
|||
PersonsController(this.db);
|
||||
|
||||
@Operation.get()
|
||||
Future<Response> getPersons() async {
|
||||
final persons = await db.allPersons().get();
|
||||
Future<Response> getPersons(
|
||||
[@Bind.query('p') int page, @Bind.query('s') String search]) async {
|
||||
final persons = await db.getPersons(page, search);
|
||||
return Response.ok(persons);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ class WorkRecordingsController extends ResourceController {
|
|||
WorkRecordingsController(this.db);
|
||||
|
||||
@Operation.get('id')
|
||||
Future<Response> getRecordings(@Bind.path('id') int id) async {
|
||||
final recordings = await db.getRecordings(id);
|
||||
Future<Response> getRecordings(@Bind.path('id') int id,
|
||||
[@Bind.query('p') int page]) async {
|
||||
final recordings = await db.getRecordings(id, page);
|
||||
return Response.ok(recordings);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue