This commit is contained in:
2025-12-11 13:50:38 +01:00
parent e4c1be628d
commit c7e5de40d6
212 changed files with 2965 additions and 763 deletions

View File

@@ -1,22 +1,32 @@
export class UserId {
private readonly value: string;
import type { IValueObject } from '@gridpilot/shared/domain';
export interface UserIdProps {
value: string;
}
export class UserId implements IValueObject<UserIdProps> {
public readonly props: UserIdProps;
private constructor(value: string) {
if (!value || !value.trim()) {
throw new Error('UserId cannot be empty');
}
this.value = value;
this.props = { value };
}
public static fromString(value: string): UserId {
return new UserId(value);
}
public toString(): string {
return this.value;
get value(): string {
return this.props.value;
}
public equals(other: UserId): boolean {
return this.value === other.value;
public toString(): string {
return this.props.value;
}
public equals(other: IValueObject<UserIdProps>): boolean {
return this.props.value === other.props.value;
}
}