33 lines
839 B
TypeScript
33 lines
839 B
TypeScript
import * as plugins from '../../plugins.js';
|
|
import { DcRouterDb } from '../classes.dcrouter-db.js';
|
|
|
|
const getDb = () => DcRouterDb.getInstance().getDb();
|
|
|
|
export interface IMacVlanMapping {
|
|
mac: string;
|
|
vlan: number;
|
|
description?: string;
|
|
enabled: boolean;
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
@plugins.smartdata.Collection(() => getDb())
|
|
export class VlanMappingsDoc extends plugins.smartdata.SmartDataDbDoc<VlanMappingsDoc, VlanMappingsDoc> {
|
|
@plugins.smartdata.unI()
|
|
@plugins.smartdata.svDb()
|
|
public configId: string = 'vlan-mappings';
|
|
|
|
@plugins.smartdata.svDb()
|
|
public mappings!: IMacVlanMapping[];
|
|
|
|
constructor() {
|
|
super();
|
|
this.mappings = [];
|
|
}
|
|
|
|
public static async load(): Promise<VlanMappingsDoc | null> {
|
|
return await VlanMappingsDoc.getInstance({ configId: 'vlan-mappings' });
|
|
}
|
|
}
|