Skip to content

Instantly share code, notes, and snippets.

@aarmora aarmora/models.ts
Created May 12, 2016

Embed
What would you like to do?
import * as mongoose from "mongoose";
export interface LSClass {
create: Boolean;
delete: Boolean;
}
export interface LS {
class: LSClass;
}
export interface ACClass {
create: Boolean;
delete: Boolean;
}
export interface AC {
class: ACClass;
}
export interface LUWTile {
create: Boolean;
delete: Boolean;
}
export interface LUW {
tile: LUWTile;
}
export interface Organization {
luw: LUW;
ac: AC;
ls: LS;
}
export interface Permission {
com: Organization;
}
export interface IUser extends mongoose.Document {
name: String;
permissions: Permission;
}
export const UserSchema = new mongoose.Schema({
name: { type: String, required: true },
permissions: Object // I want this to map to the above object(s)
});
export const User = mongoose.model<IUser>("User", UserSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.