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>
This commit is contained in:
2026-10-14 19:16:43 +02:00
parent 10c8f21ff4
commit 2c501a50d0
30 changed files with 292 additions and 207 deletions

View File

@@ -16,20 +16,20 @@ export class MongoUserRegistry extends UserRegistry {
async upsert(user: User): Promise<void> {
await this.users.updateOne(
{ _id: user.id },
{ id: user.id },
{ $set: { name: user.name, email: user.email, isActive: user.isActive } },
{ upsert: true },
);
}
async findById(id: string): Promise<User | null> {
const doc = await this.users.findById(id).lean();
const doc = await this.users.findOne({ id }).lean();
return doc ? this.toUser(doc) : null;
}
async findByIds(ids: string[]): Promise<User[]> {
if (ids.length === 0) return [];
const docs = await this.users.find({ _id: { $in: ids } }).lean();
const docs = await this.users.find({ id: { $in: ids } }).lean();
return docs.map((d) => this.toUser(d));
}
@@ -48,7 +48,7 @@ export class MongoUserRegistry extends UserRegistry {
private toUser(doc: UserDocument): User {
return this.factory.restore({
id: doc._id,
id: doc.id,
name: doc.name,
email: doc.email,
isActive: doc.isActive,