mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
baa906fb6b
Five tables carry the mail import: forwarding addresses (token hash plus the encrypted token), a person's switches, the readers' cursor and lease, every mail as it arrived, and each booking read from it with its checks and fate. Repositories read the trips a booking may go to by column, so the import weighs a booking without reaching into five other domains.
28 lines
912 B
TypeScript
28 lines
912 B
TypeScript
import { EntityRepositoryType, type Opt, type Ref, defineEntity, p } from '@mikro-orm/core';
|
|
import { MailIngestPrefsRepository } from '../repositories/MailIngestPrefs.repository';
|
|
import { Users } from './Users.entity';
|
|
|
|
export class MailIngestPrefs {
|
|
[EntityRepositoryType]?: MailIngestPrefsRepository;
|
|
id!: number & Opt;
|
|
user!: Ref<Users>;
|
|
user_id!: number;
|
|
enabled: number & Opt = 1;
|
|
ai_enabled: number & Opt = 1;
|
|
auto_add: number & Opt = 1;
|
|
}
|
|
|
|
export const MailIngestPrefsSchema = defineEntity({
|
|
class: MailIngestPrefs,
|
|
repository: () => MailIngestPrefsRepository,
|
|
uniques: [{ properties: ['user'] }],
|
|
properties: {
|
|
id: p.integer().primary(),
|
|
user: () => p.manyToOne(Users).ref().deleteRule('cascade').hidden(),
|
|
user_id: p.integer().persist(false),
|
|
enabled: p.integer().default(1),
|
|
ai_enabled: p.integer().default(1),
|
|
auto_add: p.integer().default(1),
|
|
},
|
|
});
|