@wearesage/schema
Version:
A flexible schema definition and validation system for TypeScript with multi-database support
33 lines (28 loc) • 755 B
text/typescript
import "reflect-metadata";
import { Entity, Id, Property, ManyToMany } from "../..";
import { Role } from "./Role";
/**
* A Permission might be something like "READ", "WRITE", "DELETE".
* You can also define "scope" or "resource-level" restrictions here,
* or handle them in a linking entity.
* For simplicity, we keep it straightforward:
*/
export class Permission {
id: string;
name: string; // e.g. "READ", "WRITE", "DELETE"
description: string;
/**
* Many-to-many with Roles:
* A permission can belong to many roles.
*/
roles: Role[] = [];
}