Add some stub user stuff

This commit is contained in:
2026-01-03 17:06:54 -06:00
parent c926f15aab
commit e136c07928
3 changed files with 44 additions and 1 deletions

View File

@@ -181,8 +181,19 @@ export class User {
toJSON(): UserData {
return { ...this.data };
}
toString(): string {
return `User(id ${this.id})`;
}
}
// For representing "no user" in contexts where user is optional
export const AnonymousUser = Symbol("AnonymousUser");
export const anonymousUser = User.create("anonymous@example.com", {
id: "-1",
displayName: "Anonymous User",
// FIXME: set createdAt and updatedAt to start of epoch
});
export type MaybeUser = User | typeof AnonymousUser;