Files
gridpilot.gg/packages/identity/domain/value-objects/UserId.ts
2025-12-04 15:49:57 +01:00

22 lines
446 B
TypeScript

export class UserId {
private readonly value: string;
private constructor(value: string) {
if (!value || !value.trim()) {
throw new Error('UserId cannot be empty');
}
this.value = value;
}
public static fromString(value: string): UserId {
return new UserId(value);
}
public toString(): string {
return this.value;
}
public equals(other: UserId): boolean {
return this.value === other.value;
}
}