Adds icons to group list and adds new playdate
This commit is contained in:
parent
2f826fbf36
commit
8ac59567b9
4 changed files with 55 additions and 6 deletions
|
|
@ -58,6 +58,22 @@ export class PlaydateRepository extends Repository<PlaydateModel, DBPlaydate> {
|
|||
return finds.map((playdate) => this.convertToModelType(playdate, group));
|
||||
}
|
||||
|
||||
getNextPlaydateForGroup(group: GroupModel): PlaydateModel | null {
|
||||
let sql = `SELECT * FROM ${this.schema.name} WHERE groupid = ? AND time_from > ? ORDER BY time_from ASC LIMIT 1`;
|
||||
|
||||
const find = this.database.fetch<number, DBPlaydate>(
|
||||
sql,
|
||||
group.id,
|
||||
Date.now()
|
||||
)
|
||||
|
||||
if (!find) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.convertToModelType(find, group)
|
||||
}
|
||||
|
||||
protected convertToModelType(intermediateModel: DBPlaydate | undefined, fixedGroup: Nullable<GroupModel> = null): PlaydateModel {
|
||||
if (!intermediateModel) {
|
||||
throw new Error("Unable to convert the playdate model");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue