rwadurian/backend/services/authorization-service/src/domain/value-objects/region-code.vo.ts

22 lines
446 B
TypeScript

import { DomainError } from '@/shared/exceptions'
export class RegionCode {
constructor(public readonly value: string) {
if (!value) {
throw new DomainError('区域代码不能为空')
}
}
static create(value: string): RegionCode {
return new RegionCode(value)
}
equals(other: RegionCode): boolean {
return this.value === other.value
}
toString(): string {
return this.value
}
}