44 lines
998 B
TypeScript
44 lines
998 B
TypeScript
|
|
import * as plugins from '../plugins.js';
|
||
|
|
|
||
|
|
export interface IJumpCodeData {
|
||
|
|
clusterId: string;
|
||
|
|
createdBy: string;
|
||
|
|
role: plugins.servezoneInterfaces.data.IClusterNode['data']['role'];
|
||
|
|
nodeType: plugins.servezoneInterfaces.data.IClusterNode['data']['nodeType'];
|
||
|
|
createdAt: number;
|
||
|
|
expiresAt: number;
|
||
|
|
consumedAt?: number;
|
||
|
|
consumedByNodeId?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IJumpCodePublic {
|
||
|
|
id: string;
|
||
|
|
data: IJumpCodeData;
|
||
|
|
}
|
||
|
|
|
||
|
|
@plugins.smartdata.Manager()
|
||
|
|
export class JumpCode extends plugins.smartdata.SmartDataDbDoc<JumpCode, IJumpCodePublic> {
|
||
|
|
constructor(optionsArg?: IJumpCodePublic & { tokenHash?: string }) {
|
||
|
|
super();
|
||
|
|
if (optionsArg) {
|
||
|
|
Object.assign(this, optionsArg);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@plugins.smartdata.unI()
|
||
|
|
public id!: string;
|
||
|
|
|
||
|
|
@plugins.smartdata.svDb()
|
||
|
|
public tokenHash!: string;
|
||
|
|
|
||
|
|
@plugins.smartdata.svDb()
|
||
|
|
public data!: IJumpCodeData;
|
||
|
|
|
||
|
|
public toPublicObject(): IJumpCodePublic {
|
||
|
|
return {
|
||
|
|
id: this.id,
|
||
|
|
data: this.data,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|