OpenAuth_server/src/models/client_code.ts

27 lines
669 B
TypeScript
Raw Normal View History

2018-11-06 19:48:50 +00:00
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;