Skip to main content

Data Models

Auto-generated from Mongoose schemas. Every @Schema() class is a collection in the pond database.

Role

Role document model. A named permission bundle that User documents reference by id. Does not enforce referential integrity — deleting a Role leaves orphaned references in User.roleIds.

Source: api/src/roles/schemas/role.schema.ts

FieldTypeRequiredDescription
namestringyesUnique, trimmed role name. Required.
descriptionstringnoHuman-readable description. Defaults to the empty string.
permissionsstring[]noPermission tokens granted by this role. Free-form strings; not validated against any canonical list.

User

User document model. Represents an authenticated principal in the Pond sandbox. References Role via roleIds but does not enforce referential integrity at the database layer — see docs/ARCHITECTURE.md §4.5.

Source: api/src/users/schemas/user.schema.ts

FieldTypeRequiredDescription
emailstringyesUnique, lowercased, trimmed email address. Required.
usernamestringyesUnique, trimmed username. Required. Min 3 chars enforced at DTO level.
passwordHashstringyesPlaceholder for a future password hash. Stored verbatim for now because auth is deliberately out of scope in this pass. Never returned to clients once auth lands.
roleIdsTypes.ObjectId[]noReferences to Role documents. Not cascaded on role deletion — stale ids are possible and must be handled at the application layer if referential integrity becomes important.
isActivebooleannoSoft-delete / disable flag. Defaults to true on create.