Restructuring the Project
Updating dependencies
This commit is contained in:
37
Backend/src/models/permissions.ts
Normal file
37
Backend/src/models/permissions.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import DB from "../database";
|
||||
import { ModelDataBase } from "@hibas123/safe_mongo/lib/model";
|
||||
import { ObjectID } from "mongodb";
|
||||
|
||||
export interface IPermission extends ModelDataBase {
|
||||
name: string;
|
||||
description: string;
|
||||
client: ObjectID;
|
||||
grant_type: "user" | "client";
|
||||
}
|
||||
|
||||
const Permission = DB.addModel<IPermission>({
|
||||
name: "permission",
|
||||
versions: [
|
||||
{
|
||||
migration: () => {},
|
||||
schema: {
|
||||
name: { type: String },
|
||||
description: { type: String },
|
||||
client: { type: ObjectID },
|
||||
},
|
||||
},
|
||||
{
|
||||
migration: (old) => {
|
||||
old.grant_type = "user";
|
||||
},
|
||||
schema: {
|
||||
name: { type: String },
|
||||
description: { type: String },
|
||||
client: { type: ObjectID },
|
||||
grant_type: { type: String, default: "user" },
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export default Permission;
|
Reference in New Issue
Block a user