2026-04-02 15:44:36 +00:00
|
|
|
import * as plugins from '../../plugins.js';
|
|
|
|
|
import { DcRouterDb } from '../classes.dcrouter-db.js';
|
|
|
|
|
import type { IRouteSecurity } from '../../../ts_interfaces/data/route-management.js';
|
|
|
|
|
|
|
|
|
|
const getDb = () => DcRouterDb.getInstance().getDb();
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.Collection(() => getDb())
|
2026-04-05 00:37:37 +00:00
|
|
|
export class SourceProfileDoc extends plugins.smartdata.SmartDataDbDoc<SourceProfileDoc, SourceProfileDoc> {
|
2026-04-02 15:44:36 +00:00
|
|
|
@plugins.smartdata.unI()
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public id!: string;
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public name: string = '';
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public description?: string;
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public security!: IRouteSecurity;
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public extendsProfiles?: string[];
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public createdAt!: number;
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public updatedAt!: number;
|
|
|
|
|
|
|
|
|
|
@plugins.smartdata.svDb()
|
|
|
|
|
public createdBy!: string;
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-05 00:37:37 +00:00
|
|
|
public static async findById(id: string): Promise<SourceProfileDoc | null> {
|
|
|
|
|
return await SourceProfileDoc.getInstance({ id });
|
2026-04-02 15:44:36 +00:00
|
|
|
}
|
|
|
|
|
|
2026-04-05 00:37:37 +00:00
|
|
|
public static async findByName(name: string): Promise<SourceProfileDoc | null> {
|
|
|
|
|
return await SourceProfileDoc.getInstance({ name });
|
2026-04-02 15:44:36 +00:00
|
|
|
}
|
|
|
|
|
|
2026-04-05 00:37:37 +00:00
|
|
|
public static async findAll(): Promise<SourceProfileDoc[]> {
|
|
|
|
|
return await SourceProfileDoc.getInstances({});
|
2026-04-02 15:44:36 +00:00
|
|
|
}
|
|
|
|
|
}
|