refactor(configuration): Setup configuration and menu to be reuseable

This commit is contained in:
Michel Fedde 2025-06-23 00:57:02 +02:00
parent 863ae3fab2
commit d46bbd84c5
21 changed files with 551 additions and 452 deletions

View file

@ -0,0 +1,6 @@
import {Model} from "./Model";
export type ConfigurationModel = Model & {
key: string;
value: string;
}

View file

@ -1,8 +1,7 @@
import {Model} from "./Model";
import {GroupModel} from "./GroupModel";
import {ConfigurationModel} from "./ConfigurationModel";
export interface GroupConfigurationModel extends Model {
export type GroupConfigurationModel = ConfigurationModel & {
group: GroupModel;
key: string;
value: string;
}

View file

@ -1,7 +1,7 @@
import {Model} from "./Model";
import {GuildMember, Role} from "../../types/DiscordTypes";
export interface GroupModel extends Model {
export type GroupModel = Model & {
name: string;
leader: GuildMember;
role: Role;

View file

@ -1,3 +1,3 @@
export interface Model {
export type Model = {
id: number | bigint;
}

View file

@ -2,7 +2,7 @@ import {Model} from "./Model";
import {GroupModel} from "./GroupModel";
import {Nullable} from "../../types/Nullable";
export interface PlaydateModel extends Model {
export type PlaydateModel = Model & {
group: Nullable<GroupModel>
from_time: Date,
to_time: Date,

View file

@ -41,7 +41,7 @@ export class Repository<ModelType extends Model, IntermediateModelType = unknown
return id;
}
public update(instance: Partial<ModelType> & { id: number }): boolean {
public update(instance: Partial<ModelType> & Model): boolean {
const columnNames = this.schema.columns.filter((column) => {
return !column.primaryKey
}).map((column) => {