26 lines
592 B
TypeScript
26 lines
592 B
TypeScript
import DB from "../database";
|
|
import { ModelDataBase } from "@hibas123/safe_mongo/lib/model";
|
|
import { ObjectId } from "mongodb";
|
|
|
|
export interface IGrant extends ModelDataBase {
|
|
user: ObjectId;
|
|
client: ObjectId;
|
|
permissions: ObjectId[];
|
|
}
|
|
|
|
const Grant = DB.addModel<IGrant>({
|
|
name: "grant",
|
|
versions: [
|
|
{
|
|
migration: () => { },
|
|
schema: {
|
|
user: { type: ObjectId },
|
|
client: { type: ObjectId },
|
|
permissions: { type: ObjectId, array: true },
|
|
},
|
|
},
|
|
],
|
|
});
|
|
|
|
export default Grant;
|