27 lines
669 B
TypeScript
27 lines
669 B
TypeScript
import DB from "../database";
|
|
import { ModelDataBase } from "@hibas123/safe_mongo/lib/model";
|
|
import { ObjectID } from "mongodb";
|
|
import { v4 } from "uuid";
|
|
|
|
export interface IClientCode extends ModelDataBase {
|
|
user: ObjectID
|
|
code: string;
|
|
client: ObjectID
|
|
permissions: ObjectID[]
|
|
validTill: Date;
|
|
}
|
|
|
|
const ClientCode = DB.addModel<IClientCode>({
|
|
name: "client_code",
|
|
versions: [{
|
|
migration: () => { },
|
|
schema: {
|
|
user: { type: ObjectID },
|
|
code: { type: String },
|
|
client: { type: ObjectID },
|
|
permissions: { type: Array },
|
|
validTill: { type: Date }
|
|
}
|
|
}]
|
|
});
|
|
export default ClientCode; |