Adds icons to group list and adds new playdate

This commit is contained in:
Michel Fedde 2025-05-27 19:20:10 +02:00
parent 2f826fbf36
commit 8ac59567b9
4 changed files with 55 additions and 6 deletions

View file

@ -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");