First version of OpenAuth remake
This commit is contained in:
27
src/models/client_code.ts
Normal file
27
src/models/client_code.ts
Normal file
@ -0,0 +1,27 @@
|
||||
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;
|
Reference in New Issue
Block a user