wip
This commit is contained in:
22
packages/identity/domain/value-objects/UserId.ts
Normal file
22
packages/identity/domain/value-objects/UserId.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user