mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 15:51:00 +00:00
34 lines
879 B
TypeScript
34 lines
879 B
TypeScript
import { type Opt, defineEntity, p, EntityRepository } from '@mikro-orm/core';
|
|
|
|
export interface AddonConfig {
|
|
[key: string]: unknown;
|
|
}
|
|
|
|
export class Addons {
|
|
id?: string | null;
|
|
name!: string;
|
|
description?: string | null;
|
|
type: string & Opt = 'global';
|
|
icon: string & Opt = 'Puzzle';
|
|
enabled: boolean & Opt | null = false;
|
|
config: AddonConfig & Opt | null = {};
|
|
sortOrder?: number | null = 0;
|
|
}
|
|
|
|
export class AddonsRepository extends EntityRepository<Addons>{}
|
|
|
|
export const AddonsSchema = defineEntity({
|
|
class: Addons,
|
|
repository: () => AddonsRepository,
|
|
properties: {
|
|
id: p.text().primary(),
|
|
name: p.text(),
|
|
description: p.text().nullable(),
|
|
type: p.text(),
|
|
icon: p.text().nullable(),
|
|
enabled: p.boolean().nullable().default(false),
|
|
config: p.json<AddonConfig>().nullable(),
|
|
sortOrder: p.integer().nullable(),
|
|
},
|
|
});
|