Skip to content

Instantly share code, notes, and snippets.

@aarmora
Created May 12, 2016 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarmora/6a10d959a9b76c49ea7f5e3917218ded to your computer and use it in GitHub Desktop.
Save aarmora/6a10d959a9b76c49ea7f5e3917218ded to your computer and use it in GitHub Desktop.
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