fase(1): shared domain building blocks
This commit is contained in:
18
dist/shared/domain/UniqueId.js
vendored
Normal file
18
dist/shared/domain/UniqueId.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UniqueId = void 0;
|
||||
const uuid_1 = require("uuid");
|
||||
class UniqueId {
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
static create() { return new UniqueId((0, uuid_1.v4)()); }
|
||||
static from(value) { return new UniqueId(value); }
|
||||
toString() { return this.value; }
|
||||
equals(other) {
|
||||
if (!other)
|
||||
return false;
|
||||
return this.value === other.value;
|
||||
}
|
||||
}
|
||||
exports.UniqueId = UniqueId;
|
||||
Reference in New Issue
Block a user