Files
task-stream/libs/api/identity/infrastructure/src/lib/mongo/user.schema.ts
Josep Piguillem 2c501a50d0 feat: uuid ids everywhere, pickers for linked tickets, @pi/ui checkboxes
- Postgres: every table has a uuid `id` (gen_random_uuid()); the event
  store keeps its relay order in `seq`, and the lookup tables their
  uniqueness in constraints of their own.
- MongoDB: `_id` is Mongo's ObjectId; `id` is the domain id (the same
  uuid as the aggregate's stream in Postgres), unique, and every query
  goes by it. Production starts from empty databases.
- Web: linking tickets and hanging one from a parent are picked from a
  searchable select (links across projects, parents within the project)
  instead of typing a key; every checkbox is @pi/ui's pi-checkbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 19:16:43 +02:00

21 lines
579 B
TypeScript

import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
@Schema({ collection: 'users', timestamps: true, versionKey: false })
export class UserDocument {
/** The user's id at Pireon; `_id` is Mongo's own ObjectId. */
@Prop({ type: String, required: true, unique: true })
id!: string;
@Prop({ required: true })
name!: string;
@Prop({ required: true, index: true })
email!: string;
@Prop({ default: true })
isActive!: boolean;
}
export const UserSchema = SchemaFactory.createForClass(UserDocument);
UserSchema.index({ name: 'text', email: 'text' });