From 198aa928ec51404f4fe4d9ed6e36de946c4e4746 Mon Sep 17 00:00:00 2001 From: Rafael de Jesus Guzman Torres Date: Sat, 6 Jun 2026 10:04:09 -0600 Subject: [PATCH 1/2] feat: limit size for checklist name --- .../modules/checklist/core/model/CheckList.ts | 17 +++++++------- .../checklist/core/objects/CheckListName.ts | 22 +++++++++++++++++++ .../checklist/core/model/CheckList.test.ts | 17 +++++++------- .../core/objects/CheckListName.test.ts | 20 +++++++++++++++++ 4 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 backend/src/modules/checklist/core/objects/CheckListName.ts create mode 100644 backend/tests/modules/checklist/core/objects/CheckListName.test.ts diff --git a/backend/src/modules/checklist/core/model/CheckList.ts b/backend/src/modules/checklist/core/model/CheckList.ts index f3dd92e3..4376efe1 100644 --- a/backend/src/modules/checklist/core/model/CheckList.ts +++ b/backend/src/modules/checklist/core/model/CheckList.ts @@ -17,13 +17,14 @@ import ChecklistItemMarkedAsPending from '../events/ChecklistItemMarkedAsPending import ChecklistItemTitleUpdated from '../events/ChecklistItemTitleUpdated'; import ResourceNotFound from '../../../shared/core/errors/ResourceNotFound'; import PercentageCompleted from '../objects/PercentageCompleted'; +import CheckListName from '../objects/CheckListName'; export default class CheckList extends Entity { - private name!: Text; + private name!: CheckListName; private items: ChecklistItem[] = []; private completedPercentage!: PercentageCompleted; - private constructor(id: IdCheckList, owner: IdEntity, name: Text, items: ChecklistItem[], completedPercentage: PercentageCompleted) { + private constructor(id: IdCheckList, owner: IdEntity, name: CheckListName, items: ChecklistItem[], completedPercentage: PercentageCompleted) { super(id, owner); this.name = name; this.items = items; @@ -33,7 +34,7 @@ export default class CheckList extends Entity { public static create( id: IdCheckList, owner: IdEntity, - name: Text, + name: CheckListName, actor: IdEntity, key: string, items: ChecklistItem[] = [], @@ -50,7 +51,7 @@ export default class CheckList extends Entity { const checklist = new CheckList( new IdCheckList(params.id), new IdEntity(params.idOwner), - new Text(params.name), + new CheckListName(params.name), items, new PercentageCompleted(params.completedPercentage), ); @@ -59,7 +60,7 @@ export default class CheckList extends Entity { return checklist; } - public getName(): Text { + public getName(): CheckListName { return this.name; } @@ -75,9 +76,9 @@ export default class CheckList extends Entity { return super.getOwner() as IdEntity; } - public updateName(name: Text, actor: IdEntity, key: string): void { + public updateName(name: CheckListName, actor: IdEntity, key: string): void { this.name = name; - this.addEvent(new CheckListTitleUpdated(key, DateTime.now(), actor, this.getOwnerId(), super.getID() as IdCheckList, { name: name.getText() })); + this.addEvent(new CheckListTitleUpdated(key, DateTime.now(), actor, this.getOwnerId(), super.getID() as IdCheckList, { name: name.getName() })); } public addChecklistItem(title: Text, actor: IdEntity, key: string): void { @@ -127,7 +128,7 @@ export default class CheckList extends Entity { return { id: (super.getID() as IdCheckList).getID(), idOwner: this.getOwnerId().getID(), - name: this.name.getText(), + name: this.name.getName(), items: this.items.map((item) => item.toPrimitives()), completedPercentage: this.completedPercentage.toPrimitive(), version: super.getVersion().valueOf(), diff --git a/backend/src/modules/checklist/core/objects/CheckListName.ts b/backend/src/modules/checklist/core/objects/CheckListName.ts new file mode 100644 index 00000000..2f68b9d2 --- /dev/null +++ b/backend/src/modules/checklist/core/objects/CheckListName.ts @@ -0,0 +1,22 @@ +import LimitExceeded from '../../../shared/core/errors/LimitExceeded'; +import Text from '../../../shared/core/objects/Text'; +import ValueObject from '../../../shared/core/objects/ValueObject'; + +const MAX_CHECKLIST_NAME_LENGTH = 1000; + +export default class CheckListName extends ValueObject { + private name!: Text; + + constructor(name: string) { + super(); + const text = new Text(name); + if (text.size() > MAX_CHECKLIST_NAME_LENGTH) { + throw new LimitExceeded(`Checklist name cannot be longer than ${MAX_CHECKLIST_NAME_LENGTH} characters`); + } + this.name = text; + } + + public getName(): string { + return this.name.getText(); + } +} diff --git a/backend/tests/modules/checklist/core/model/CheckList.test.ts b/backend/tests/modules/checklist/core/model/CheckList.test.ts index 1c4f7733..567a0691 100644 --- a/backend/tests/modules/checklist/core/model/CheckList.test.ts +++ b/backend/tests/modules/checklist/core/model/CheckList.test.ts @@ -1,5 +1,6 @@ import CheckList from '../../../../../src/modules/checklist/core/model/CheckList'; import IdCheckList from '../../../../../src/modules/checklist/core/objects/IdCheckList'; +import CheckListName from '../../../../../src/modules/checklist/core/objects/CheckListName'; import Text from '../../../../../src/modules/shared/core/objects/Text'; import IdEntity from '../../../../../src/modules/shared/core/objects/IdEntity'; import ID from '../../../../../src/modules/shared/core/objects/ID'; @@ -12,10 +13,10 @@ describe('CheckList', () => { const key = 'event-key'; it('creates a checklist and emits a CheckListCreated event', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('My checklist'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('My checklist'), actor, key); const events = checklist.pullEvents(); - expect(checklist.getName().getText()).toBe('My checklist'); + expect(checklist.getName().getName()).toBe('My checklist'); expect(checklist.getCompletedPercentage().getValue()).toBe(0); expect(checklist.toPrimitives().idOwner).toBe(owner.getID()); expect(events).toHaveLength(1); @@ -23,7 +24,7 @@ describe('CheckList', () => { }); it('adds an item and updates completed percentage', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Tasks'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Tasks'), actor, key); checklist.pullEvents(); checklist.addChecklistItem(new Text('Wash dishes'), actor, key); @@ -36,7 +37,7 @@ describe('CheckList', () => { }); it('completes an item and emits ChecklistItemCompleted', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Tasks'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Tasks'), actor, key); checklist.addChecklistItem(new Text('Write tests'), actor, key); const itemId = checklist.getItems()[0]!.getId().getID(); checklist.pullEvents(); @@ -50,7 +51,7 @@ describe('CheckList', () => { }); it('marks an item as pending and recalculates percentage', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Tasks'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Tasks'), actor, key); checklist.addChecklistItem(new Text('Build feature'), actor, key); const itemId = checklist.getItems()[0]!.getId().getID(); checklist.completeChecklistItem(itemId, actor, key); @@ -63,11 +64,11 @@ describe('CheckList', () => { }); it('updates the checklist title and emits CheckListTitleUpdated', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Initial'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Initial'), actor, key); checklist.pullEvents(); - checklist.updateName(new Text('Updated name'), actor, key); - expect(checklist.getName().getText()).toBe('Updated name'); + checklist.updateName(new CheckListName('Updated name'), actor, key); + expect(checklist.getName().getName()).toBe('Updated name'); const events = checklist.pullEvents(); expect((events[0] as DomainEvent).getEvent()).toBe('CHECKLIST_TITLE_UPDATED'); }); diff --git a/backend/tests/modules/checklist/core/objects/CheckListName.test.ts b/backend/tests/modules/checklist/core/objects/CheckListName.test.ts new file mode 100644 index 00000000..a0b61db3 --- /dev/null +++ b/backend/tests/modules/checklist/core/objects/CheckListName.test.ts @@ -0,0 +1,20 @@ +import CheckListName from '../../../../../src/modules/checklist/core/objects/CheckListName'; +import InvalidParameters from '../../../../../src/modules/shared/core/errors/InvalidParameters'; +import LimitExceeded from '../../../../../src/modules/shared/core/errors/LimitExceeded'; +import { describe, it, expect } from 'vitest'; + +describe('CheckListName', () => { + it('creates a valid checklist name', () => { + const name = new CheckListName('My checklist'); + expect(name.getName()).toBe('My checklist'); + }); + + it('throws when the checklist name is empty', () => { + expect(() => new CheckListName('')).toThrow(InvalidParameters); + }); + + it('throws when the checklist name exceeds 1000 characters', () => { + const longName = 'a'.repeat(1001); + expect(() => new CheckListName(longName)).toThrow(LimitExceeded); + }); +}); From 1e5061343d749b30325b054f7838003a63a5c7cc Mon Sep 17 00:00:00 2001 From: Rafael de Jesus Guzman Torres Date: Sat, 6 Jun 2026 11:24:33 -0600 Subject: [PATCH 2/2] feat: adding notifications domain module with tests --- .../checklist/core/model/CheckList.d.ts | 11 +- .../checklist/core/model/CheckList.d.ts.map | 2 +- .../modules/checklist/core/model/CheckList.js | 15 +- .../checklist/core/model/CheckList.js.map | 2 +- .../checklist/core/objects/CheckListName.d.ts | 7 + .../core/objects/CheckListName.d.ts.map | 1 + .../checklist/core/objects/CheckListName.js | 18 ++ .../core/objects/CheckListName.js.map | 1 + .../core/objects/PercentageCompleted.d.ts | 8 + .../core/objects/PercentageCompleted.d.ts.map | 1 + .../core/objects/PercentageCompleted.js | 19 +++ .../core/objects/PercentageCompleted.js.map | 1 + .../src/modules/list/core/model/List.d.ts | 1 - .../src/modules/list/core/model/List.d.ts.map | 2 +- .../dist/src/modules/list/core/model/List.js | 26 ++- .../src/modules/list/core/model/List.js.map | 2 +- .../core/error/NotificationAlreadyRead.d.ts | 5 + .../error/NotificationAlreadyRead.d.ts.map | 1 + .../core/error/NotificationAlreadyRead.js | 8 + .../core/error/NotificationAlreadyRead.js.map | 1 + .../error/NotificationStatusNotSupported.d.ts | 5 + .../NotificationStatusNotSupported.d.ts.map | 1 + .../error/NotificationStatusNotSupported.js | 8 + .../NotificationStatusNotSupported.js.map | 1 + .../core/events/NotificationCreated.d.ts | 7 + .../core/events/NotificationCreated.d.ts.map | 1 + .../core/events/NotificationCreated.js | 7 + .../core/events/NotificationCreated.js.map | 1 + .../core/events/NotificationRead.d.ts | 8 + .../core/events/NotificationRead.d.ts.map | 1 + .../core/events/NotificationRead.js | 7 + .../core/events/NotificationRead.js.map | 1 + .../core/interfaces/NotificationParams.d.ts | 10 ++ .../interfaces/NotificationParams.d.ts.map | 1 + .../core/interfaces/NotificationParams.js | 2 + .../core/interfaces/NotificationParams.js.map | 1 + .../notification/core/model/Notification.d.ts | 19 +++ .../core/model/Notification.d.ts.map | 1 + .../notification/core/model/Notification.js | 58 +++++++ .../core/model/Notification.js.map | 1 + .../core/objects/IdNotification.d.ts | 5 + .../core/objects/IdNotification.d.ts.map | 1 + .../core/objects/IdNotification.js | 7 + .../core/objects/IdNotification.js.map | 1 + .../core/objects/NotificationStatus.d.ts | 13 ++ .../core/objects/NotificationStatus.d.ts.map | 1 + .../core/objects/NotificationStatus.js | 30 ++++ .../core/objects/NotificationStatus.js.map | 1 + .../repository/NotificationRepository.d.ts | 9 + .../NotificationRepository.d.ts.map | 1 + .../core/repository/NotificationRepository.js | 2 + .../repository/NotificationRepository.js.map | 1 + .../core/types/AllowedNotificationStatus.d.ts | 6 + .../types/AllowedNotificationStatus.d.ts.map | 1 + .../core/types/AllowedNotificationStatus.js | 7 + .../types/AllowedNotificationStatus.js.map | 1 + .../shared/core/objects/PositiveInteger.js | 2 +- .../core/objects/PositiveInteger.js.map | 2 +- .../checklist/core/model/CheckList.test.js | 17 +- .../core/model/CheckList.test.js.map | 2 +- .../core/objects/CheckListName.test.d.ts | 2 + .../core/objects/CheckListName.test.d.ts.map | 1 + .../core/objects/CheckListName.test.js | 18 ++ .../core/objects/CheckListName.test.js.map | 1 + .../modules/list/core/model/List.test.js | 42 +++++ .../modules/list/core/model/List.test.js.map | 2 +- .../list/core/model/ListWithTasks.test.d.ts | 2 + .../core/model/ListWithTasks.test.d.ts.map | 1 + .../list/core/model/ListWithTasks.test.js | 108 ++++++++++++ .../list/core/model/ListWithTasks.test.js.map | 1 + .../core/error/NotificationAlreadyRead.ts | 8 + .../error/NotificationStatusNotSupported.ts | 8 + .../core/events/NotificationCreated.ts | 16 ++ .../core/events/NotificationRead.ts | 17 ++ .../core/interfaces/NotificationParams.ts | 10 ++ .../notification/core/model/Notification.ts | 96 +++++++++++ .../core/objects/IdNotification.ts | 7 + .../core/objects/NotificationStatus.ts | 37 +++++ .../core/repository/NotificationRepository.ts | 9 + .../core/types/AllowedNotificationStatus.ts | 6 + .../core/model/Notification.test.ts | 157 ++++++++++++++++++ .../core/objects/NotificationStatus.test.ts | 34 ++++ 82 files changed, 921 insertions(+), 45 deletions(-) create mode 100644 backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts create mode 100644 backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts.map create mode 100644 backend/dist/src/modules/checklist/core/objects/CheckListName.js create mode 100644 backend/dist/src/modules/checklist/core/objects/CheckListName.js.map create mode 100644 backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts create mode 100644 backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts.map create mode 100644 backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js create mode 100644 backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js.map create mode 100644 backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts create mode 100644 backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js create mode 100644 backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js.map create mode 100644 backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts create mode 100644 backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js create mode 100644 backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js.map create mode 100644 backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts create mode 100644 backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/events/NotificationCreated.js create mode 100644 backend/dist/src/modules/notification/core/events/NotificationCreated.js.map create mode 100644 backend/dist/src/modules/notification/core/events/NotificationRead.d.ts create mode 100644 backend/dist/src/modules/notification/core/events/NotificationRead.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/events/NotificationRead.js create mode 100644 backend/dist/src/modules/notification/core/events/NotificationRead.js.map create mode 100644 backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts create mode 100644 backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/interfaces/NotificationParams.js create mode 100644 backend/dist/src/modules/notification/core/interfaces/NotificationParams.js.map create mode 100644 backend/dist/src/modules/notification/core/model/Notification.d.ts create mode 100644 backend/dist/src/modules/notification/core/model/Notification.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/model/Notification.js create mode 100644 backend/dist/src/modules/notification/core/model/Notification.js.map create mode 100644 backend/dist/src/modules/notification/core/objects/IdNotification.d.ts create mode 100644 backend/dist/src/modules/notification/core/objects/IdNotification.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/objects/IdNotification.js create mode 100644 backend/dist/src/modules/notification/core/objects/IdNotification.js.map create mode 100644 backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts create mode 100644 backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/objects/NotificationStatus.js create mode 100644 backend/dist/src/modules/notification/core/objects/NotificationStatus.js.map create mode 100644 backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts create mode 100644 backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/repository/NotificationRepository.js create mode 100644 backend/dist/src/modules/notification/core/repository/NotificationRepository.js.map create mode 100644 backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts create mode 100644 backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts.map create mode 100644 backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js create mode 100644 backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js.map create mode 100644 backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts create mode 100644 backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts.map create mode 100644 backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js create mode 100644 backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js.map create mode 100644 backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts create mode 100644 backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts.map create mode 100644 backend/dist/tests/modules/list/core/model/ListWithTasks.test.js create mode 100644 backend/dist/tests/modules/list/core/model/ListWithTasks.test.js.map create mode 100644 backend/src/modules/notification/core/error/NotificationAlreadyRead.ts create mode 100644 backend/src/modules/notification/core/error/NotificationStatusNotSupported.ts create mode 100644 backend/src/modules/notification/core/events/NotificationCreated.ts create mode 100644 backend/src/modules/notification/core/events/NotificationRead.ts create mode 100644 backend/src/modules/notification/core/interfaces/NotificationParams.ts create mode 100644 backend/src/modules/notification/core/model/Notification.ts create mode 100644 backend/src/modules/notification/core/objects/IdNotification.ts create mode 100644 backend/src/modules/notification/core/objects/NotificationStatus.ts create mode 100644 backend/src/modules/notification/core/repository/NotificationRepository.ts create mode 100644 backend/src/modules/notification/core/types/AllowedNotificationStatus.ts create mode 100644 backend/tests/modules/notification/core/model/Notification.test.ts create mode 100644 backend/tests/modules/notification/core/objects/NotificationStatus.test.ts diff --git a/backend/dist/src/modules/checklist/core/model/CheckList.d.ts b/backend/dist/src/modules/checklist/core/model/CheckList.d.ts index dffff372..1a6309e5 100644 --- a/backend/dist/src/modules/checklist/core/model/CheckList.d.ts +++ b/backend/dist/src/modules/checklist/core/model/CheckList.d.ts @@ -1,22 +1,23 @@ import Entity from '../../../shared/core/model/Entity'; import IdEntity from '../../../shared/core/objects/IdEntity'; import Text from '../../../shared/core/objects/Text'; -import Decimal from '../../../shared/core/objects/Decimal'; import type CheckListParams from '../interfaces/CheckListParams'; import ChecklistItem from '../objects/ChecklistItem'; import IdCheckList from '../objects/IdCheckList'; +import PercentageCompleted from '../objects/PercentageCompleted'; +import CheckListName from '../objects/CheckListName'; export default class CheckList extends Entity { private name; private items; private completedPercentage; private constructor(); - static create(id: IdCheckList, owner: IdEntity, name: Text, actor: IdEntity, key: string, items?: ChecklistItem[]): CheckList; + static create(id: IdCheckList, owner: IdEntity, name: CheckListName, actor: IdEntity, key: string, items?: ChecklistItem[]): CheckList; static fromPrimitives(params: CheckListParams): CheckList; - getName(): Text; + getName(): CheckListName; getItems(): ChecklistItem[]; - getCompletedPercentage(): Decimal; + getCompletedPercentage(): PercentageCompleted; private getOwnerId; - updateName(name: Text, actor: IdEntity, key: string): void; + updateName(name: CheckListName, actor: IdEntity, key: string): void; addChecklistItem(title: Text, actor: IdEntity, key: string): void; deleteChecklistItem(itemId: string, actor: IdEntity, key: string): void; completeChecklistItem(itemId: string, actor: IdEntity, key: string): void; diff --git a/backend/dist/src/modules/checklist/core/model/CheckList.d.ts.map b/backend/dist/src/modules/checklist/core/model/CheckList.d.ts.map index ae2d42b5..32682e9d 100644 --- a/backend/dist/src/modules/checklist/core/model/CheckList.d.ts.map +++ b/backend/dist/src/modules/checklist/core/model/CheckList.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"CheckList.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/model/CheckList.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mCAAmC,CAAC;AAEvD,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAC7D,OAAO,IAAI,MAAM,mCAAmC,CAAC;AAGrD,OAAO,OAAO,MAAM,sCAAsC,CAAC;AAC3D,OAAO,KAAK,eAAe,MAAM,+BAA+B,CAAC;AACjE,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,WAAW,MAAM,wBAAwB,CAAC;AAWjD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAAM;IAC3C,OAAO,CAAC,IAAI,CAAQ;IACpB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,mBAAmB,CAAW;IAEtC,OAAO;WAOO,MAAM,CAClB,EAAE,EAAE,WAAW,EACf,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,aAAa,EAAO,GAC1B,SAAS;WAQE,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS;IAczD,OAAO,IAAI,IAAI;IAIf,QAAQ,IAAI,aAAa,EAAE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C,YAAY,IAAI,eAAe;IAYtC,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,8BAA8B;CAUvC"} \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/model/CheckList.js b/backend/dist/src/modules/checklist/core/model/CheckList.js index 7986bc2b..1d404cf0 100644 --- a/backend/dist/src/modules/checklist/core/model/CheckList.js +++ b/backend/dist/src/modules/checklist/core/model/CheckList.js @@ -4,7 +4,6 @@ import IdEntity from '../../../shared/core/objects/IdEntity'; import Text from '../../../shared/core/objects/Text'; import Version from '../../../shared/core/objects/Version'; import DeletedAt from '../../../shared/core/objects/DeletedAt'; -import Decimal from '../../../shared/core/objects/Decimal'; import ChecklistItem from '../objects/ChecklistItem'; import IdCheckList from '../objects/IdCheckList'; import CheckListCreated from '../events/CheckListCreated'; @@ -16,6 +15,8 @@ import ChecklistItemCompleted from '../events/ChecklistItemCompleted'; import ChecklistItemMarkedAsPending from '../events/ChecklistItemMarkedAsPending'; import ChecklistItemTitleUpdated from '../events/ChecklistItemTitleUpdated'; import ResourceNotFound from '../../../shared/core/errors/ResourceNotFound'; +import PercentageCompleted from '../objects/PercentageCompleted'; +import CheckListName from '../objects/CheckListName'; export default class CheckList extends Entity { constructor(id, owner, name, items, completedPercentage) { super(id, owner); @@ -25,7 +26,7 @@ export default class CheckList extends Entity { this.completedPercentage = completedPercentage; } static create(id, owner, name, actor, key, items = []) { - const checklist = new CheckList(id, owner, name, items, new Decimal(0)); + const checklist = new CheckList(id, owner, name, items, new PercentageCompleted(0)); checklist.create(); checklist.recalculateCompletedPercentage(); checklist.addEvent(new CheckListCreated(key, DateTime.now(), actor, checklist.getOwnerId(), id, checklist.toPrimitives())); @@ -33,7 +34,7 @@ export default class CheckList extends Entity { } static fromPrimitives(params) { const items = params.items.map((item) => ChecklistItem.fromPrimitives(item)); - const checklist = new CheckList(new IdCheckList(params.id), new IdEntity(params.idOwner), new Text(params.name), items, new Decimal(params.completedPercentage)); + const checklist = new CheckList(new IdCheckList(params.id), new IdEntity(params.idOwner), new CheckListName(params.name), items, new PercentageCompleted(params.completedPercentage)); checklist.build(new Version(params.version), DeletedAt.createFromPrimitive(params.deletedAt)); return checklist; } @@ -51,7 +52,7 @@ export default class CheckList extends Entity { } updateName(name, actor, key) { this.name = name; - this.addEvent(new CheckListTitleUpdated(key, DateTime.now(), actor, this.getOwnerId(), super.getID(), { name: name.getText() })); + this.addEvent(new CheckListTitleUpdated(key, DateTime.now(), actor, this.getOwnerId(), super.getID(), { name: name.getName() })); } addChecklistItem(title, actor, key) { const item = ChecklistItem.create(title); @@ -92,7 +93,7 @@ export default class CheckList extends Entity { return { id: super.getID().getID(), idOwner: this.getOwnerId().getID(), - name: this.name.getText(), + name: this.name.getName(), items: this.items.map((item) => item.toPrimitives()), completedPercentage: this.completedPercentage.toPrimitive(), version: super.getVersion().valueOf(), @@ -110,12 +111,12 @@ export default class CheckList extends Entity { } recalculateCompletedPercentage() { if (this.items.length === 0) { - this.completedPercentage = new Decimal(0); + this.completedPercentage = new PercentageCompleted(0); return; } const completedCount = this.items.filter((item) => item.isCompleted()).length; const percent = (completedCount / this.items.length) * 100; - this.completedPercentage = new Decimal(percent); + this.completedPercentage = new PercentageCompleted(percent); } } //# sourceMappingURL=CheckList.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/model/CheckList.js.map b/backend/dist/src/modules/checklist/core/model/CheckList.js.map index 830e5b20..4c76712d 100644 --- a/backend/dist/src/modules/checklist/core/model/CheckList.js.map +++ b/backend/dist/src/modules/checklist/core/model/CheckList.js.map @@ -1 +1 @@ -{"version":3,"file":"CheckList.js","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/model/CheckList.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAC7D,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAC7D,OAAO,IAAI,MAAM,mCAAmC,CAAC;AACrD,OAAO,O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GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACzE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAC5C,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CACvE,CAAC;QACF,IAAI,CAAC,8BAA8B,EAAE,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,KAAK,EAAiB,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACzI,CAAC;IAEO,8BAA8B;QACpC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,mBAAmB,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QAC9E,MAAM,OAAO,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;QAC3D,IAAI,CAAC,mBAAmB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"CheckList.js","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/model/CheckList.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,QAAQ,MAAM,uCA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No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts b/backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts new file mode 100644 index 00000000..6c567e2a --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts @@ -0,0 +1,7 @@ +import ValueObject from '../../../shared/core/objects/ValueObject'; +export default class CheckListName extends ValueObject { + private name; + constructor(name: string); + getName(): string; +} +//# sourceMappingURL=CheckListName.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts.map b/backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts.map new file mode 100644 index 00000000..89fd6936 --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/CheckListName.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CheckListName.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/objects/CheckListName.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,0CAA0C,CAAC;AAInE,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,OAAO,CAAC,IAAI,CAAQ;gBAER,IAAI,EAAE,MAAM;IASjB,OAAO,IAAI,MAAM;CAGzB"} \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/CheckListName.js b/backend/dist/src/modules/checklist/core/objects/CheckListName.js new file mode 100644 index 00000000..eab83788 --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/CheckListName.js @@ -0,0 +1,18 @@ +import LimitExceeded from '../../../shared/core/errors/LimitExceeded'; +import Text from '../../../shared/core/objects/Text'; +import ValueObject from '../../../shared/core/objects/ValueObject'; +const MAX_CHECKLIST_NAME_LENGTH = 1000; +export default class CheckListName extends ValueObject { + constructor(name) { + super(); + const text = new Text(name); + if (text.size() > MAX_CHECKLIST_NAME_LENGTH) { + throw new LimitExceeded(`Checklist name cannot be longer than ${MAX_CHECKLIST_NAME_LENGTH} characters`); + } + this.name = text; + } + getName() { + return this.name.getText(); + } +} +//# sourceMappingURL=CheckListName.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/CheckListName.js.map b/backend/dist/src/modules/checklist/core/objects/CheckListName.js.map new file mode 100644 index 00000000..8d54a95d --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/CheckListName.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CheckListName.js","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/objects/CheckListName.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,IAAI,MAAM,mCAAmC,CAAC;AACrD,OAAO,WAAW,MAAM,0CAA0C,CAAC;AAEnE,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IAGpD,YAAY,IAAY;QACtB,KAAK,EAAE,CAAC;QACR,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,yBAAyB,EAAE,CAAC;YAC5C,MAAM,IAAI,aAAa,CAAC,wCAAwC,yBAAyB,aAAa,CAAC,CAAC;QAC1G,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts new file mode 100644 index 00000000..3bfeb363 --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts @@ -0,0 +1,8 @@ +import ValueObject from '../../../shared/core/objects/ValueObject'; +export default class PercentageCompleted extends ValueObject { + private value; + constructor(value: number); + getValue(): number; + toPrimitive(): number; +} +//# sourceMappingURL=PercentageCompleted.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts.map b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts.map new file mode 100644 index 00000000..325b5a23 --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PercentageCompleted.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/objects/PercentageCompleted.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,0CAA0C,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IAC1D,OAAO,CAAC,KAAK,CAAW;gBAEZ,KAAK,EAAE,MAAM;IAQlB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;CAG7B"} \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js new file mode 100644 index 00000000..509a2a57 --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js @@ -0,0 +1,19 @@ +import InvalidParameters from '../../../shared/core/errors/InvalidParameters'; +import Decimal from '../../../shared/core/objects/Decimal'; +import ValueObject from '../../../shared/core/objects/ValueObject'; +export default class PercentageCompleted extends ValueObject { + constructor(value) { + super(); + this.value = new Decimal(value); + if (this.value.getValue() < 0 || this.value.getValue() > 100) { + throw new InvalidParameters('Value must be in 0 to 100 range', { value }); + } + } + getValue() { + return this.value.getValue(); + } + toPrimitive() { + return this.value.toPrimitive(); + } +} +//# sourceMappingURL=PercentageCompleted.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js.map b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js.map new file mode 100644 index 00000000..9802bc7a --- /dev/null +++ b/backend/dist/src/modules/checklist/core/objects/PercentageCompleted.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PercentageCompleted.js","sourceRoot":"","sources":["../../../../../../src/modules/checklist/core/objects/PercentageCompleted.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,+CAA+C,CAAC;AAC9E,OAAO,OAAO,MAAM,sCAAsC,CAAC;AAC3D,OAAO,WAAW,MAAM,0CAA0C,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IAG1D,YAAY,KAAa;QACvB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,EAAE,CAAC;YAC7D,MAAM,IAAI,iBAAiB,CAAC,iCAAiC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/list/core/model/List.d.ts b/backend/dist/src/modules/list/core/model/List.d.ts index 92c0ac8a..ff9d4964 100644 --- a/backend/dist/src/modules/list/core/model/List.d.ts +++ b/backend/dist/src/modules/list/core/model/List.d.ts @@ -20,7 +20,6 @@ export default class List extends Entity { export(newProject: IdEntity, newPosition: PositiveInteger, key: string, actor: IdEntity): void; archive(key: string, actor: IdEntity): void; unarchive(key: string, actor: IdEntity): void; - unarvhive(key: string, actor: IdEntity): void; delete(key: string, actor: IdEntity): void; addTask(task: Task): void; removeTask(task: Task): void; diff --git a/backend/dist/src/modules/list/core/model/List.d.ts.map b/backend/dist/src/modules/list/core/model/List.d.ts.map index 608da813..eedb3c36 100644 --- a/backend/dist/src/modules/list/core/model/List.d.ts.map +++ b/backend/dist/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,EACzB,KAAK,EAAE,IAAI,EAAE,EACb,SAAS,EAAE,QAAQ;WAOT,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;WAaxC,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAM1D,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAMpE,IAAI,CAAC,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAMtE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAS9F,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAQ3C,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAQ7C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAU1C,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAezB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAiB5B,QAAQ,IAAI,SAAS;IAIrB,WAAW,IAAI,eAAe;IAI9B,QAAQ,IAAI,IAAI,EAAE;IAIlB,UAAU,IAAI,OAAO;IAIrB,YAAY,IAAI,UAAU;CAYpC"} \ No newline at end of file diff --git a/backend/dist/src/modules/list/core/model/List.js b/backend/dist/src/modules/list/core/model/List.js index 2fe4d1be..47fa5f4f 100644 --- a/backend/dist/src/modules/list/core/model/List.js +++ b/backend/dist/src/modules/list/core/model/List.js @@ -77,9 +77,6 @@ export default class List extends Entity { }); this.addEvent(new ListUnarchived(key, DateTime.now(), actor, super.getOwner(), this.id)); } - unarvhive(key, actor) { - this.unarchive(key, actor); - } delete(key, actor) { if (!this.archived) throw new InvalidOperation(`List must be archived before being delete`, { listID: this.getID().getID() }); @@ -93,15 +90,15 @@ export default class List extends Entity { addTask(task) { if (this.archived) throw new CannotModifyArchivedList({ listId: this.getID().getID() }); - if (task.getPositionInList().getValue() > this.tasks.length || - task.getPositionInList().getValue() < 0) + if (task.getPositionInList().getValue() > this.tasks.length + 1 || + task.getPositionInList().getValue() <= 0) throw new InvalidPositionInList({ positionToInsert: task.getPositionInList().getValue(), listId: this.getID().getID() }); if (this.tasks instanceof None) { this.tasks = [task]; } else { - const part1 = this.tasks.slice(0, task.getPositionInList().getValue()); - const part2 = this.tasks.slice(task.getPositionInList().getValue()); + const part1 = this.tasks.slice(0, task.getPositionInList().getValue() - 1); + const part2 = this.tasks.slice(task.getPositionInList().getValue() - 1); part2.forEach(t => t.updatePosition(new PositiveInteger(t.getPositionInList().getValue() + 1))); this.tasks = [...part1, task, ...part2]; } @@ -109,21 +106,18 @@ export default class List extends Entity { removeTask(task) { if (this.archived) throw new CannotModifyArchivedList({ listId: this.getID().getID() }); - if (this.tasks instanceof None) { + if (!this.tasks.find(t => t.getID().getID() === task.getID().getID())) throw new ResourceNotFound(`The task with id: ${task.getID().getID()} does not exists in list with id: ${this.getID()}`, { taskId: task.getID().getID(), listId: this.getID().getID() }); - } - else { - if (!this.tasks.find(t => t.getID().getID() === task.getID().getID())) - throw new ResourceNotFound(`The task with id: ${task.getID().getID()} does not exists in list with id: ${this.getID()}`, { - taskId: task.getID().getID(), - listId: this.getID().getID() - }); - this.tasks = this.tasks.filter(t => t.getID().getID() === task.getID().getID()); + this.tasks = this.tasks.filter(t => t.getID().getID() !== task.getID().getID()); + for (let i = task.getPositionInList().getValue() - 1; i < this.tasks.length; i++) { + const nextTask = this.tasks[i]; + nextTask.updatePosition(new PositiveInteger(nextTask.getPositionInList().getValue() - 1)); } } + //getters getTitle() { return this.title; } diff --git a/backend/dist/src/modules/list/core/model/List.js.map b/backend/dist/src/modules/list/core/model/List.js.map index dba33c81..bc9785f3 100644 --- a/backend/dist/src/modules/list/core/model/List.js.map +++ b/backend/dist/src/modules/list/core/model/List.js.map @@ -1 +1 @@ -{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../../../../src/modules/list/core/model/List.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,mCAAmC,CAAC;AACrD,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,SAAS,MAAM,wCAAwC,CAAC;AAC/D,OAAO,OAAO,MAAM,sCAAsC,CAAC;AAC3D,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAC7D,OAAO,IAAI,MAAM,+BAA+B,CAAC;AACjD,OAAO,IAAI,MAAM,mCAAmC,CAAC;AAErD,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAC7D,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAC5E,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAC5E,OAAO,wBAAwB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AACpE,OAAO,eAAe,MAAM,8CAA8C,CAAA;AAE1E,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,MAAM;IAOpC,YACI,EAAU,EACV,KAAgB,EAChB,QAAyB,EACzB,KAAa,EACb,SAAmB;QAEnB,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QAVjB,aAAQ,GAAY,KAAK,CAAC;Q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,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QACpF,CAAC;IACL,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEM,QAAQ;QACX,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEM,YAAY;QACf,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACrC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE;SAC/C,CAAA;IACL,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../../../../src/modules/list/core/model/List.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,mCAAmC,CAAC;AACrD,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,SAAS,MAAM,wCAAwC,CAAC;AAC/D,OAAO,OAAO,MAAM,sCAAsC,CAAC;AAC3D,OAAO,Q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;QACf,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAClC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACrC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE;SAC/C,CAAA;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts new file mode 100644 index 00000000..04a5044d --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts @@ -0,0 +1,5 @@ +import CoreError from '../../../shared/core/errors/CoreError'; +export default class NotificationAlreadyRead extends CoreError { + constructor(info?: unknown); +} +//# sourceMappingURL=NotificationAlreadyRead.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts.map b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts.map new file mode 100644 index 00000000..180bc205 --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationAlreadyRead.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/error/NotificationAlreadyRead.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,SAAS;gBAChD,IAAI,CAAC,EAAE,OAAO;CAI3B"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js new file mode 100644 index 00000000..695bf49a --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js @@ -0,0 +1,8 @@ +import CoreError from '../../../shared/core/errors/CoreError'; +export default class NotificationAlreadyRead extends CoreError { + constructor(info) { + super('Notification has already been read', info); + Object.setPrototypeOf(this, NotificationAlreadyRead.prototype); + } +} +//# sourceMappingURL=NotificationAlreadyRead.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js.map b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js.map new file mode 100644 index 00000000..36c98559 --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationAlreadyRead.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationAlreadyRead.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/error/NotificationAlreadyRead.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,SAAS;IAC5D,YAAY,IAAc;QACxB,KAAK,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;QAClD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts new file mode 100644 index 00000000..3495f978 --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts @@ -0,0 +1,5 @@ +import CoreError from '../../../shared/core/errors/CoreError'; +export default class NotificationStatusNotSupported extends CoreError { + constructor(info?: unknown); +} +//# sourceMappingURL=NotificationStatusNotSupported.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts.map b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts.map new file mode 100644 index 00000000..661197f8 --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationStatusNotSupported.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/error/NotificationStatusNotSupported.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,8BAA+B,SAAQ,SAAS;gBACvD,IAAI,CAAC,EAAE,OAAO;CAI3B"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js new file mode 100644 index 00000000..67911226 --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js @@ -0,0 +1,8 @@ +import CoreError from '../../../shared/core/errors/CoreError'; +export default class NotificationStatusNotSupported extends CoreError { + constructor(info) { + super('Notification status not supported', info); + Object.setPrototypeOf(this, NotificationStatusNotSupported.prototype); + } +} +//# sourceMappingURL=NotificationStatusNotSupported.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js.map b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js.map new file mode 100644 index 00000000..847aae5e --- /dev/null +++ b/backend/dist/src/modules/notification/core/error/NotificationStatusNotSupported.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationStatusNotSupported.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/error/NotificationStatusNotSupported.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,8BAA+B,SAAQ,SAAS;IACnE,YAAY,IAAc;QACxB,KAAK,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts b/backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts new file mode 100644 index 00000000..db75e67f --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts @@ -0,0 +1,7 @@ +import DomainEvent from '../../../shared/core/events/DomainEvent'; +import type DateTime from '../../../shared/core/objects/DateTime'; +import type IdEntity from '../../../shared/core/objects/IdEntity'; +export default class NotificationCreated extends DomainEvent { + constructor(key: string, date: DateTime, actor: IdEntity, idUser: IdEntity, idNotification: IdEntity, info?: unknown); +} +//# sourceMappingURL=NotificationCreated.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts.map b/backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts.map new file mode 100644 index 00000000..4616862f --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationCreated.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationCreated.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/events/NotificationCreated.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAClE,OAAO,KAAK,QAAQ,MAAM,uCAAuC,CAAC;AAClE,OAAO,KAAK,QAAQ,MAAM,uCAAuC,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;gBAExD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,QAAQ,EAChB,cAAc,EAAE,QAAQ,EACxB,IAAI,CAAC,EAAE,OAAO;CAIjB"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationCreated.js b/backend/dist/src/modules/notification/core/events/NotificationCreated.js new file mode 100644 index 00000000..e1e9ee22 --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationCreated.js @@ -0,0 +1,7 @@ +import DomainEvent from '../../../shared/core/events/DomainEvent'; +export default class NotificationCreated extends DomainEvent { + constructor(key, date, actor, idUser, idNotification, info) { + super(key, date, actor, idUser, idNotification, 'NOTIFICATION_CREATED', info); + } +} +//# sourceMappingURL=NotificationCreated.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationCreated.js.map b/backend/dist/src/modules/notification/core/events/NotificationCreated.js.map new file mode 100644 index 00000000..280ec632 --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationCreated.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationCreated.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/events/NotificationCreated.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAIlE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IAC1D,YACE,GAAW,EACX,IAAc,EACd,KAAe,EACf,MAAgB,EAChB,cAAwB,EACxB,IAAc;QAEd,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationRead.d.ts b/backend/dist/src/modules/notification/core/events/NotificationRead.d.ts new file mode 100644 index 00000000..20592476 --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationRead.d.ts @@ -0,0 +1,8 @@ +import DomainEvent from '../../../shared/core/events/DomainEvent'; +import type DateTime from '../../../shared/core/objects/DateTime'; +import type IdEntity from '../../../shared/core/objects/IdEntity'; +import type NotificationStatus from '../objects/NotificationStatus'; +export default class NotificationRead extends DomainEvent { + constructor(key: string, date: DateTime, actor: IdEntity, idUser: IdEntity, idNotification: IdEntity, status: NotificationStatus); +} +//# sourceMappingURL=NotificationRead.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationRead.d.ts.map b/backend/dist/src/modules/notification/core/events/NotificationRead.d.ts.map new file mode 100644 index 00000000..6815ab75 --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationRead.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationRead.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/events/NotificationRead.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAClE,OAAO,KAAK,QAAQ,MAAM,uCAAuC,CAAC;AAClE,OAAO,KAAK,QAAQ,MAAM,uCAAuC,CAAC;AAClE,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;gBAErD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,QAAQ,EAChB,cAAc,EAAE,QAAQ,EACxB,MAAM,EAAE,kBAAkB;CAI7B"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationRead.js b/backend/dist/src/modules/notification/core/events/NotificationRead.js new file mode 100644 index 00000000..826ac538 --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationRead.js @@ -0,0 +1,7 @@ +import DomainEvent from '../../../shared/core/events/DomainEvent'; +export default class NotificationRead extends DomainEvent { + constructor(key, date, actor, idUser, idNotification, status) { + super(key, date, actor, idUser, idNotification, 'NOTIFICATION_READ', status); + } +} +//# sourceMappingURL=NotificationRead.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/events/NotificationRead.js.map b/backend/dist/src/modules/notification/core/events/NotificationRead.js.map new file mode 100644 index 00000000..9b935dc7 --- /dev/null +++ b/backend/dist/src/modules/notification/core/events/NotificationRead.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationRead.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/events/NotificationRead.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAKlE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,YACE,GAAW,EACX,IAAc,EACd,KAAe,EACf,MAAgB,EAChB,cAAwB,EACxB,MAA0B;QAE1B,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts new file mode 100644 index 00000000..2400605f --- /dev/null +++ b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts @@ -0,0 +1,10 @@ +import type { AllowedNotificationStatus } from '../types/AllowedNotificationStatus'; +export default interface NotificationParams { + id: string; + event: string; + status: AllowedNotificationStatus; + idUser: string; + version: number; + deletedAt: Date | null; +} +//# sourceMappingURL=NotificationParams.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts.map b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts.map new file mode 100644 index 00000000..309977d6 --- /dev/null +++ b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationParams.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/interfaces/NotificationParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAEpF,MAAM,CAAC,OAAO,WAAW,kBAAkB;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,yBAAyB,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/interfaces/NotificationParams.js b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.js new file mode 100644 index 00000000..7a0ad5cd --- /dev/null +++ b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=NotificationParams.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/interfaces/NotificationParams.js.map b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.js.map new file mode 100644 index 00000000..7c190757 --- /dev/null +++ b/backend/dist/src/modules/notification/core/interfaces/NotificationParams.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationParams.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/interfaces/NotificationParams.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/model/Notification.d.ts b/backend/dist/src/modules/notification/core/model/Notification.d.ts new file mode 100644 index 00000000..80f81be1 --- /dev/null +++ b/backend/dist/src/modules/notification/core/model/Notification.d.ts @@ -0,0 +1,19 @@ +import Entity from '../../../shared/core/model/Entity'; +import IdEntity from '../../../shared/core/objects/IdEntity'; +import type NotificationParams from '../interfaces/NotificationParams'; +import IdNotification from '../objects/IdNotification'; +import NotificationStatus from '../objects/NotificationStatus'; +export default class Notification extends Entity { + private event; + private status; + private constructor(); + static create(key: string, idNotification: IdNotification, event: IdEntity, idUser: IdEntity, actor: IdEntity): Notification; + static fromPrimitives(params: NotificationParams): Notification; + markAsRead(key: string, actor: IdEntity): void; + getId(): IdNotification; + getEvent(): IdEntity; + getStatus(): NotificationStatus; + getIdUser(): IdEntity; + toPrimitives(): NotificationParams; +} +//# sourceMappingURL=Notification.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/model/Notification.d.ts.map b/backend/dist/src/modules/notification/core/model/Notification.d.ts.map new file mode 100644 index 00000000..ba68886a --- /dev/null +++ b/backend/dist/src/modules/notification/core/model/Notification.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/model/Notification.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mCAAmC,CAAC;AAGvD,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAK7D,OAAO,KAAK,kBAAkB,MAAM,kCAAkC,CAAC;AACvE,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,MAAM,CAAsB;IAEpC,OAAO;WAWO,MAAM,CAClB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,QAAQ,GACd,YAAY;WASD,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY;IAgB/D,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAW9C,KAAK,IAAI,cAAc;IAIvB,QAAQ,IAAI,QAAQ;IAIpB,SAAS,IAAI,kBAAkB;IAI/B,SAAS,IAAI,QAAQ;IAIrB,YAAY,IAAI,kBAAkB;CAU1C"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/model/Notification.js b/backend/dist/src/modules/notification/core/model/Notification.js new file mode 100644 index 00000000..d14a8b52 --- /dev/null +++ b/backend/dist/src/modules/notification/core/model/Notification.js @@ -0,0 +1,58 @@ +import Entity from '../../../shared/core/model/Entity'; +import DateTime from '../../../shared/core/objects/DateTime'; +import DeletedAt from '../../../shared/core/objects/DeletedAt'; +import IdEntity from '../../../shared/core/objects/IdEntity'; +import Version from '../../../shared/core/objects/Version'; +import NotificationCreated from '../events/NotificationCreated'; +import NotificationRead from '../events/NotificationRead'; +import NotificationAlreadyRead from '../error/NotificationAlreadyRead'; +import IdNotification from '../objects/IdNotification'; +import NotificationStatus from '../objects/NotificationStatus'; +export default class Notification extends Entity { + constructor(idNotification, event, status, idUser) { + super(idNotification, idUser); + this.event = event; + this.status = status; + } + static create(key, idNotification, event, idUser, actor) { + const notification = new Notification(idNotification, event, NotificationStatus.unread(), idUser); + notification.create(); + notification.addEvent(new NotificationCreated(key, DateTime.now(), actor, idUser, idNotification, notification.toPrimitives())); + return notification; + } + static fromPrimitives(params) { + const notification = new Notification(new IdNotification(params.id), new IdEntity(params.event), NotificationStatus.create(params.status), new IdEntity(params.idUser)); + notification.build(new Version(params.version), DeletedAt.createFromPrimitive(params.deletedAt)); + return notification; + } + markAsRead(key, actor) { + if (this.status.isRead()) { + throw new NotificationAlreadyRead({ idNotification: this.getId().getID() }); + } + this.status = NotificationStatus.read(); + this.addEvent(new NotificationRead(key, DateTime.now(), actor, this.getIdUser(), this.getId(), this.status)); + } + getId() { + return super.getID(); + } + getEvent() { + return this.event; + } + getStatus() { + return this.status; + } + getIdUser() { + return super.getOwner(); + } + toPrimitives() { + return { + id: this.getId().getID(), + event: this.event.getID(), + status: this.status.getStatus(), + idUser: this.getIdUser().getID(), + version: super.getVersion().valueOf(), + deletedAt: super.getDeletedAt().toPrimitive(), + }; + } +} +//# sourceMappingURL=Notification.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/model/Notification.js.map b/backend/dist/src/modules/notification/core/model/Notification.js.map new file mode 100644 index 00000000..ce0421f6 --- /dev/null +++ b/backend/dist/src/modules/notification/core/model/Notification.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/model/Notification.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAC7D,OAAO,SAAS,MAAM,wCAAwC,CAAC;AAC/D,OAAO,QAAQ,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,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE;YACrC,SAAS,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE;SAC9C,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/IdNotification.d.ts b/backend/dist/src/modules/notification/core/objects/IdNotification.d.ts new file mode 100644 index 00000000..34477a58 --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/IdNotification.d.ts @@ -0,0 +1,5 @@ +import IdEntity from '../../../shared/core/objects/IdEntity'; +export default class IdNotification extends IdEntity { + constructor(id: string); +} +//# sourceMappingURL=IdNotification.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/IdNotification.d.ts.map b/backend/dist/src/modules/notification/core/objects/IdNotification.d.ts.map new file mode 100644 index 00000000..552abb17 --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/IdNotification.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"IdNotification.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/objects/IdNotification.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,QAAQ;gBACtC,EAAE,EAAE,MAAM;CAGvB"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/IdNotification.js b/backend/dist/src/modules/notification/core/objects/IdNotification.js new file mode 100644 index 00000000..665c750f --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/IdNotification.js @@ -0,0 +1,7 @@ +import IdEntity from '../../../shared/core/objects/IdEntity'; +export default class IdNotification extends IdEntity { + constructor(id) { + super(id); + } +} +//# sourceMappingURL=IdNotification.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/IdNotification.js.map b/backend/dist/src/modules/notification/core/objects/IdNotification.js.map new file mode 100644 index 00000000..fd313079 --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/IdNotification.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IdNotification.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/objects/IdNotification.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,uCAAuC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,QAAQ;IAClD,YAAY,EAAU;QACpB,KAAK,CAAC,EAAE,CAAC,CAAC;IACZ,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts b/backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts new file mode 100644 index 00000000..cdc5fc0a --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts @@ -0,0 +1,13 @@ +import ValueObject from '../../../shared/core/objects/ValueObject'; +import { AllowedNotificationStatus } from '../types/AllowedNotificationStatus'; +export default class NotificationStatus extends ValueObject { + private status; + private constructor(); + static create(status: AllowedNotificationStatus): NotificationStatus; + static read(): NotificationStatus; + static unread(): NotificationStatus; + getStatus(): AllowedNotificationStatus; + isRead(): boolean; + isUnread(): boolean; +} +//# sourceMappingURL=NotificationStatus.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts.map b/backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts.map new file mode 100644 index 00000000..91abcf44 --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/NotificationStatus.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/objects/NotificationStatus.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,0CAA0C,CAAC;AAEnE,OAAO,EAA+B,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE5G,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,OAAO,CAAC,MAAM,CAA6B;IAE3C,OAAO;WAMO,MAAM,CAAC,MAAM,EAAE,yBAAyB,GAAG,kBAAkB;WAI7D,IAAI,IAAI,kBAAkB;WAI1B,MAAM,IAAI,kBAAkB;IAInC,SAAS,IAAI,yBAAyB;IAItC,MAAM,IAAI,OAAO;IAIjB,QAAQ,IAAI,OAAO;CAG3B"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/NotificationStatus.js b/backend/dist/src/modules/notification/core/objects/NotificationStatus.js new file mode 100644 index 00000000..b22f164c --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/NotificationStatus.js @@ -0,0 +1,30 @@ +import ValueObject from '../../../shared/core/objects/ValueObject'; +import NotificationStatusNotSupported from '../error/NotificationStatusNotSupported'; +import { ALLOWED_NOTIFICATION_STATUS, AllowedNotificationStatus } from '../types/AllowedNotificationStatus'; +export default class NotificationStatus extends ValueObject { + constructor(status) { + super(); + if (!ALLOWED_NOTIFICATION_STATUS.includes(status)) + throw new NotificationStatusNotSupported(status); + this.status = status; + } + static create(status) { + return new NotificationStatus(status); + } + static read() { + return new NotificationStatus(AllowedNotificationStatus.read); + } + static unread() { + return new NotificationStatus(AllowedNotificationStatus.unread); + } + getStatus() { + return this.status; + } + isRead() { + return this.status === AllowedNotificationStatus.read; + } + isUnread() { + return this.status === AllowedNotificationStatus.unread; + } +} +//# sourceMappingURL=NotificationStatus.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/objects/NotificationStatus.js.map b/backend/dist/src/modules/notification/core/objects/NotificationStatus.js.map new file mode 100644 index 00000000..b6437a64 --- /dev/null +++ b/backend/dist/src/modules/notification/core/objects/NotificationStatus.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationStatus.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/objects/NotificationStatus.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,0CAA0C,CAAC;AACnE,OAAO,8BAA8B,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE5G,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IAGzD,YAAoB,MAAiC;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,2BAA2B,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,8BAA8B,CAAC,MAAM,CAAC,CAAC;QACpG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,MAAM,CAAC,MAAiC;QACpD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAEM,MAAM,CAAC,IAAI;QAChB,OAAO,IAAI,kBAAkB,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAEM,MAAM,CAAC,MAAM;QAClB,OAAO,IAAI,kBAAkB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,MAAM,KAAK,yBAAyB,CAAC,IAAI,CAAC;IACxD,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,KAAK,yBAAyB,CAAC,MAAM,CAAC;IAC1D,CAAC;CACF"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts b/backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts new file mode 100644 index 00000000..b5684a95 --- /dev/null +++ b/backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts @@ -0,0 +1,9 @@ +import type Notification from '../model/Notification'; +import type IdNotification from '../objects/IdNotification'; +export default interface NotificationRepository { + create(notification: Notification): Promise; + update(notification: Notification): Promise; + getById(idNotification: IdNotification): Promise; + getManyByIds(notifications: IdNotification[], limit: number, page: number): Promise; +} +//# sourceMappingURL=NotificationRepository.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts.map b/backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts.map new file mode 100644 index 00000000..f2696617 --- /dev/null +++ b/backend/dist/src/modules/notification/core/repository/NotificationRepository.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationRepository.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/repository/NotificationRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAE5D,MAAM,CAAC,OAAO,WAAW,sBAAsB;IAC7C,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/D,YAAY,CAAC,aAAa,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACrG"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/repository/NotificationRepository.js b/backend/dist/src/modules/notification/core/repository/NotificationRepository.js new file mode 100644 index 00000000..929dd9dc --- /dev/null +++ b/backend/dist/src/modules/notification/core/repository/NotificationRepository.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=NotificationRepository.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/repository/NotificationRepository.js.map b/backend/dist/src/modules/notification/core/repository/NotificationRepository.js.map new file mode 100644 index 00000000..d2652df6 --- /dev/null +++ b/backend/dist/src/modules/notification/core/repository/NotificationRepository.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NotificationRepository.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/repository/NotificationRepository.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts new file mode 100644 index 00000000..5e0c85f7 --- /dev/null +++ b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts @@ -0,0 +1,6 @@ +export declare const ALLOWED_NOTIFICATION_STATUS: readonly ["READ", "UNREAD"]; +export declare enum AllowedNotificationStatus { + read = "READ", + unread = "UNREAD" +} +//# sourceMappingURL=AllowedNotificationStatus.d.ts.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts.map b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts.map new file mode 100644 index 00000000..17e6d9aa --- /dev/null +++ b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AllowedNotificationStatus.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/types/AllowedNotificationStatus.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,6BAA8B,CAAC;AAEvE,oBAAY,yBAAyB;IACnC,IAAI,SAAS;IACb,MAAM,WAAW;CAClB"} \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js new file mode 100644 index 00000000..986f53d8 --- /dev/null +++ b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js @@ -0,0 +1,7 @@ +export const ALLOWED_NOTIFICATION_STATUS = ['READ', 'UNREAD']; +export var AllowedNotificationStatus; +(function (AllowedNotificationStatus) { + AllowedNotificationStatus["read"] = "READ"; + AllowedNotificationStatus["unread"] = "UNREAD"; +})(AllowedNotificationStatus || (AllowedNotificationStatus = {})); +//# sourceMappingURL=AllowedNotificationStatus.js.map \ No newline at end of file diff --git a/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js.map b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js.map new file mode 100644 index 00000000..3337d6b4 --- /dev/null +++ b/backend/dist/src/modules/notification/core/types/AllowedNotificationStatus.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AllowedNotificationStatus.js","sourceRoot":"","sources":["../../../../../../src/modules/notification/core/types/AllowedNotificationStatus.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AAEvE,MAAM,CAAN,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACnC,0CAAa,CAAA;IACb,8CAAiB,CAAA;AACnB,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,QAGpC"} \ No newline at end of file diff --git a/backend/dist/src/modules/shared/core/objects/PositiveInteger.js b/backend/dist/src/modules/shared/core/objects/PositiveInteger.js index 9a6b21bf..61a9c833 100644 --- a/backend/dist/src/modules/shared/core/objects/PositiveInteger.js +++ b/backend/dist/src/modules/shared/core/objects/PositiveInteger.js @@ -5,7 +5,7 @@ export default class PositiveInteger extends ValueObject { constructor(value) { super(); this.value = new IntNumber(value); - if (this.value.getValue() < 0) + if (this.value.getValue() <= 0) throw new InvalidParameters('Value must be a valid positive integer', { value: value }); } getValue() { diff --git a/backend/dist/src/modules/shared/core/objects/PositiveInteger.js.map b/backend/dist/src/modules/shared/core/objects/PositiveInteger.js.map index 0d3fe193..3990720c 100644 --- a/backend/dist/src/modules/shared/core/objects/PositiveInteger.js.map +++ b/backend/dist/src/modules/shared/core/objects/PositiveInteger.js.map @@ -1 +1 @@ -{"version":3,"file":"PositiveInteger.js","sourceRoot":"","sources":["../../../../../../src/modules/shared/core/objects/PositiveInteger.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,WAAW;IAGpD,YAAY,KAAa;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,IAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,IAAI,iBAAiB,CAAC,wCAAwC,EAAE,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;IACvH,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"PositiveInteger.js","sourceRoot":"","sources":["../../../../../../src/modules/shared/core/objects/PositiveInteger.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,WAAW;IAGpD,YAAY,KAAa;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,IAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;YAAC,MAAM,IAAI,iBAAiB,CAAC,wCAAwC,EAAE,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;IACxH,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACJ"} \ No newline at end of file diff --git a/backend/dist/tests/modules/checklist/core/model/CheckList.test.js b/backend/dist/tests/modules/checklist/core/model/CheckList.test.js index b91b3f6a..f506593d 100644 --- a/backend/dist/tests/modules/checklist/core/model/CheckList.test.js +++ b/backend/dist/tests/modules/checklist/core/model/CheckList.test.js @@ -1,5 +1,6 @@ import CheckList from '../../../../../src/modules/checklist/core/model/CheckList'; import IdCheckList from '../../../../../src/modules/checklist/core/objects/IdCheckList'; +import CheckListName from '../../../../../src/modules/checklist/core/objects/CheckListName'; import Text from '../../../../../src/modules/shared/core/objects/Text'; import IdEntity from '../../../../../src/modules/shared/core/objects/IdEntity'; import ID from '../../../../../src/modules/shared/core/objects/ID'; @@ -9,16 +10,16 @@ describe('CheckList', () => { const actor = new IdEntity(ID.generateId().getId()); const key = 'event-key'; it('creates a checklist and emits a CheckListCreated event', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('My checklist'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('My checklist'), actor, key); const events = checklist.pullEvents(); - expect(checklist.getName().getText()).toBe('My checklist'); + expect(checklist.getName().getName()).toBe('My checklist'); expect(checklist.getCompletedPercentage().getValue()).toBe(0); expect(checklist.toPrimitives().idOwner).toBe(owner.getID()); expect(events).toHaveLength(1); expect(events[0].getEvent()).toBe('CHECKLIST_CREATED'); }); it('adds an item and updates completed percentage', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Tasks'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Tasks'), actor, key); checklist.pullEvents(); checklist.addChecklistItem(new Text('Wash dishes'), actor, key); expect(checklist.getItems()).toHaveLength(1); @@ -28,7 +29,7 @@ describe('CheckList', () => { expect(events[0].getEvent()).toBe('CHECKLIST_ITEM_CREATED'); }); it('completes an item and emits ChecklistItemCompleted', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Tasks'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Tasks'), actor, key); checklist.addChecklistItem(new Text('Write tests'), actor, key); const itemId = checklist.getItems()[0].getId().getID(); checklist.pullEvents(); @@ -39,7 +40,7 @@ describe('CheckList', () => { expect(events[0].getEvent()).toBe('CHECKLIST_ITEM_COMPLETED'); }); it('marks an item as pending and recalculates percentage', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Tasks'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Tasks'), actor, key); checklist.addChecklistItem(new Text('Build feature'), actor, key); const itemId = checklist.getItems()[0].getId().getID(); checklist.completeChecklistItem(itemId, actor, key); @@ -50,10 +51,10 @@ describe('CheckList', () => { expect(events[0].getEvent()).toBe('CHECKLIST_ITEM_MARKED_AS_PENDING'); }); it('updates the checklist title and emits CheckListTitleUpdated', () => { - const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new Text('Initial'), actor, key); + const checklist = CheckList.create(new IdCheckList(ID.generateId().getId()), owner, new CheckListName('Initial'), actor, key); checklist.pullEvents(); - checklist.updateName(new Text('Updated name'), actor, key); - expect(checklist.getName().getText()).toBe('Updated name'); + checklist.updateName(new CheckListName('Updated name'), actor, key); + expect(checklist.getName().getName()).toBe('Updated name'); const events = checklist.pullEvents(); expect(events[0].getEvent()).toBe('CHECKLIST_TITLE_UPDATED'); }); diff --git a/backend/dist/tests/modules/checklist/core/model/CheckList.test.js.map b/backend/dist/tests/modules/checklist/core/model/CheckList.test.js.map index 6f439dfe..9b438a9e 100644 --- a/backend/dist/tests/modules/checklist/core/model/CheckList.test.js.map +++ b/backend/dist/tests/modules/checklist/core/model/CheckList.test.js.map @@ -1 +1 @@ -{"version":3,"file":"CheckList.test.js","sourceRoot":"","sources":["../../../../../../tests/modules/checklist/core/model/CheckList.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,2DAA2D,CAAC;AAClF,OAAO,WAAW,MAAM,+DAA+D,CAAC;AACxF,OAAO,IAAI,MAAM,qDAAqD,CAAC;AACvE,OAAO,QAAQ,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAE,MAAM,mDAAmD,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG9C,QAAQ,CAAC,WAAW,EAAE,GAAG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AAC,kCAAkC,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACrH,SAAS,CAAC,UAAU,EAAE,CAAC;QAEvB,SAAS,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,CAAE,MAAM,CAAC,CAAC,CAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"CheckList.test.js","sourceRoot":"","sources":["../../../../../../tests/modules/checklist/core/model/CheckList.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,2DAA2D,CAAC;AAClF,OAAO,WAAW,MAAM,+DAA+D,CAAC;AACxF,OAAO,aAAa,MAAM,iEAAiE,CAAC;AAC5F,OAAO,IAAI,MAAM,qDAAqD,CAAC;AACvE,OAAO,QAAQ,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAE,MAAM,mDAAmD,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG9C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,KAAK,GAAG,IAAI,QAAQ,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,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9H,SAAS,CAAC,UAAU,EAAE,CAAC;QAEvB,SAAS,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,CAAE,MAAM,CAAC,CAAC,CAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts new file mode 100644 index 00000000..1aeba3af --- /dev/null +++ b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=CheckListName.test.d.ts.map \ No newline at end of file diff --git a/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts.map b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts.map new file mode 100644 index 00000000..01de1da2 --- /dev/null +++ b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CheckListName.test.d.ts","sourceRoot":"","sources":["../../../../../../tests/modules/checklist/core/objects/CheckListName.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js new file mode 100644 index 00000000..6176029c --- /dev/null +++ b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js @@ -0,0 +1,18 @@ +import CheckListName from '../../../../../src/modules/checklist/core/objects/CheckListName'; +import InvalidParameters from '../../../../../src/modules/shared/core/errors/InvalidParameters'; +import LimitExceeded from '../../../../../src/modules/shared/core/errors/LimitExceeded'; +import { describe, it, expect } from 'vitest'; +describe('CheckListName', () => { + it('creates a valid checklist name', () => { + const name = new CheckListName('My checklist'); + expect(name.getName()).toBe('My checklist'); + }); + it('throws when the checklist name is empty', () => { + expect(() => new CheckListName('')).toThrow(InvalidParameters); + }); + it('throws when the checklist name exceeds 1000 characters', () => { + const longName = 'a'.repeat(1001); + expect(() => new CheckListName(longName)).toThrow(LimitExceeded); + }); +}); +//# sourceMappingURL=CheckListName.test.js.map \ No newline at end of file diff --git a/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js.map b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js.map new file mode 100644 index 00000000..10b9b9e2 --- /dev/null +++ b/backend/dist/tests/modules/checklist/core/objects/CheckListName.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CheckListName.test.js","sourceRoot":"","sources":["../../../../../../tests/modules/checklist/core/objects/CheckListName.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iEAAiE,CAAC;AAC5F,OAAO,iBAAiB,MAAM,iEAAiE,CAAC;AAChG,OAAO,aAAa,MAAM,6DAA6D,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,IAAI,GAAG,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/backend/dist/tests/modules/list/core/model/List.test.js b/backend/dist/tests/modules/list/core/model/List.test.js index 799e7db7..3262694a 100644 --- a/backend/dist/tests/modules/list/core/model/List.test.js +++ b/backend/dist/tests/modules/list/core/model/List.test.js @@ -2,11 +2,18 @@ import { describe, expect, it } from 'vitest'; import List from '../../../../../src/modules/list/core/model/List'; import ListId from '../../../../../src/modules/list/core/object/ListId'; import ListTitle from '../../../../../src/modules/list/core/object/ListTitle'; +import Task from '../../../../../src/modules/task/core/model/Task'; +import TaskTitle from '../../../../../src/modules/task/core/objects/TaskTitle'; +import TaskState from '../../../../../src/modules/task/core/objects/TaskState'; +import TaskId from '../../../../../src/modules/task/core/objects/TaskId'; import IdEntity from '../../../../../src/modules/shared/core/objects/IdEntity'; import InvalidParameters from '../../../../../src/modules/shared/core/errors/InvalidParameters'; +import None from '../../../../../src/modules/shared/core/objects/None'; +import Collection from '../../../../../src/modules/shared/core/objects/Collection'; import PositiveInteger from '../../../../../src/modules/shared/core/objects/PositiveInteger'; import Text from '../../../../../src/modules/shared/core/objects/Text'; const buildList = () => List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(1), [], new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37')); +const buildTask = (position, id) => Task.create(new TaskTitle('Task title'), new IdEntity('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new PositiveInteger(position), TaskState.pending(), false, new TaskId(id), new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37'), new None(), new None(), new None(), new Collection([], [], []), new Collection([], [], []), new IdEntity('0443c815-7220-7d64-8c42-6f2af4f9fd37'), `task-created-${id}`); describe('List', () => { it('creates a list with a positive integer position', () => { const list = buildList(); @@ -56,6 +63,41 @@ describe('List', () => { it('does not allow negative list positions', () => { expect(() => List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(-1), [], new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37'))).toThrow(InvalidParameters); }); + it('does not allow zero list positions', () => { + expect(() => List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(0), [], new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37'))).toThrow(InvalidParameters); + }); + it('inserts tasks at correct 1-based positions and shifts later tasks', () => { + const list = buildList(); + const firstTask = buildTask(1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'); + const secondTask = buildTask(2, '0343c815-7220-7d64-8c42-6f2af4f9fd37'); + const insertedTask = buildTask(1, '0443c815-7220-7d64-8c42-6f2af4f9fd37'); + list.addTask(firstTask); + list.addTask(secondTask); + list.addTask(insertedTask); + const tasks = list.getTasks(); + expect(tasks.map((task) => task.getID().getID())).toEqual([ + insertedTask.getID().getID(), + firstTask.getID().getID(), + secondTask.getID().getID(), + ]); + expect(tasks.map((task) => task.getPositionInList().getValue())).toEqual([1, 2, 3]); + }); + it('removes a task and reorders subsequent tasks', () => { + const list = buildList(); + const firstTask = buildTask(1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'); + const secondTask = buildTask(2, '0343c815-7220-7d64-8c42-6f2af4f9fd37'); + const thirdTask = buildTask(3, '0443c815-7220-7d64-8c42-6f2af4f9fd37'); + list.addTask(firstTask); + list.addTask(secondTask); + list.addTask(thirdTask); + list.removeTask(secondTask); + const tasks = list.getTasks(); + expect(tasks.map((task) => task.getID().getID())).toEqual([ + firstTask.getID().getID(), + thirdTask.getID().getID(), + ]); + expect(tasks.map((task) => task.getPositionInList().getValue())).toEqual([1, 2]); + }); it('archives and unarchives a list with events', () => { const list = buildList(); const actor = new IdEntity('0443c815-7220-7d64-8c42-6f2af4f9fd37'); diff --git a/backend/dist/tests/modules/list/core/model/List.test.js.map b/backend/dist/tests/modules/list/core/model/List.test.js.map index b94caabf..d34d0cd7 100644 --- a/backend/dist/tests/modules/list/core/model/List.test.js.map +++ b/backend/dist/tests/modules/list/core/model/List.test.js.map @@ -1 +1 @@ -{"version":3,"file":"List.test.js","sourceRoot":"","sources":["../../../../../../tests/modules/list/core/model/List.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,MAAM,MAAM,oDAAoD,CAAC;AACxE,OAAO,SAAS,MAAM,uDAAuD,CAAC;AAC9E,OAAO,QAAQ,MAAM,yDAAyD,CAAC;AAC/E,OAAO,iBAAiB,MAAM,iEAAiE,CAAC;AAChG,OAAO,eAAe,MAAM,gEAAgE,CAAC;AAC7F,OAAO,IAAI,MAAM,qDAAqD,CAAC;AAGvE,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CACjC,IAAI,MAAM,CAAC,sCAAsC,CAAC,EAClD,IAAI,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,EAClC,IAAI,eAAe,CAAC,CA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M,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,IAAI,GAAG,SAAS,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,sCAAsC,CAAC,CAAC;QAEnE,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAEvC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"List.test.js","sourceRoot":"","sources":["../../../../../../tests/modules/list/core/model/List.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,MAAM,MAAM,oDAAoD,CAAC;AACxE,OAAO,SAAS,MAAM,uDAAuD,CAAC;AAC9E,OAAO,IAAI,MAAM,iDAAiD,CAAC;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,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,IAAI,GAAG,SAAS,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,sCAAsC,CAAC,CAAC;QAEnE,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAEvC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts new file mode 100644 index 00000000..0b91d0ba --- /dev/null +++ b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=ListWithTasks.test.d.ts.map \ No newline at end of file diff --git a/backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts.map b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts.map new file mode 100644 index 00000000..222f0e71 --- /dev/null +++ b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ListWithTasks.test.d.ts","sourceRoot":"","sources":["../../../../../../tests/modules/list/core/model/ListWithTasks.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/backend/dist/tests/modules/list/core/model/ListWithTasks.test.js b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.js new file mode 100644 index 00000000..4465e9ec --- /dev/null +++ b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.js @@ -0,0 +1,108 @@ +import { describe, expect, it } from 'vitest'; +import List from '../../../../../src/modules/list/core/model/List'; +import ListId from '../../../../../src/modules/list/core/object/ListId'; +import ListTitle from '../../../../../src/modules/list/core/object/ListTitle'; +import Task from '../../../../../src/modules/task/core/model/Task'; +import TaskTitle from '../../../../../src/modules/task/core/objects/TaskTitle'; +import TaskState from '../../../../../src/modules/task/core/objects/TaskState'; +import TaskId from '../../../../../src/modules/task/core/objects/TaskId'; +import IdEntity from '../../../../../src/modules/shared/core/objects/IdEntity'; +import InvalidPositionInList from '../../../../../src/modules/list/core/errors/InvalidPositionInList'; +import PositiveInteger from '../../../../../src/modules/shared/core/objects/PositiveInteger'; +import Text from '../../../../../src/modules/shared/core/objects/Text'; +import None from '../../../../../src/modules/shared/core/objects/None'; +import Collection from '../../../../../src/modules/shared/core/objects/Collection'; +const buildTask = (listId, projectId, positionInList, taskId) => { + const title = new TaskTitle('Task title'); + const listContainer = new IdEntity(listId); + const state = TaskState.pending(); + const projectOwner = new IdEntity(projectId); + const actor = new IdEntity('0443c815-7220-7d64-8c42-6f2af4f9fd37'); + const categories = new Collection([], [], []); + const assigned = new Collection([], [], []); + return Task.create(title, listContainer, new PositiveInteger(positionInList), state, false, new TaskId(taskId), projectOwner, new None(), new None(), new None(), categories, assigned, actor, `task-created-${taskId}`); +}; +const buildList = () => List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(1), [], new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37')); +describe('List with tasks', () => { + it('does not allow adding a task with an invalid position', () => { + const list = buildList(); + const task = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 2, '0243c815-7220-7d64-8c42-6f2af4f9fd37'); + expect(() => list.addTask(task)).toThrow(InvalidPositionInList); + }); + it('inserts and shifts tasks in a 1-based position list', () => { + const list = buildList(); + const firstTask = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'); + const secondTask = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 2, '0343c815-7220-7d64-8c42-6f2af4f9fd37'); + const insertedTask = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 1, '0443c815-7220-7d64-8c42-6f2af4f9fd37'); + list.addTask(firstTask); + list.addTask(secondTask); + list.addTask(insertedTask); + const tasks = list.getTasks(); + expect(tasks.map((task) => task.getID().getID())).toEqual([ + insertedTask.getID().getID(), + firstTask.getID().getID(), + secondTask.getID().getID(), + ]); + expect(tasks.map((task) => task.getPositionInList().getValue())).toEqual([1, 2, 3]); + }); + it('removes a task and updates later task positions', () => { + const list = buildList(); + const firstTask = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'); + const secondTask = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 2, '0343c815-7220-7d64-8c42-6f2af4f9fd37'); + const thirdTask = buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 3, '0443c815-7220-7d64-8c42-6f2af4f9fd37'); + list.addTask(firstTask); + list.addTask(secondTask); + list.addTask(thirdTask); + list.removeTask(secondTask); + const tasks = list.getTasks(); + expect(tasks.map((task) => task.getID().getID())).toEqual([ + firstTask.getID().getID(), + thirdTask.getID().getID(), + ]); + expect(tasks.map((task) => task.getPositionInList().getValue())).toEqual([1, 2]); + }); + it('exports a list and cascades project ownership to child tasks without emitting task events', () => { + const originalProject = '0343c815-7220-7d64-8c42-6f2af4f9fd37'; + const newProject = new IdEntity('0543c815-7220-7d64-8c42-6f2af4f9fd37'); + const list = List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(1), [ + buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', originalProject, 1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'), + ], new IdEntity(originalProject)); + const task = list.getTasks()[0]; + task.pullEvents(); + list.export(newProject, new PositiveInteger(2), 'list-exported-key', new IdEntity('0643c815-7220-7d64-8c42-6f2af4f9fd37')); + expect(list.getOwner().getID()).toBe(newProject.getID()); + expect(task.getIdProject().getID()).toBe(newProject.getID()); + expect(task.pullEvents()).toHaveLength(0); + }); + it('archives and unarchives a list, cascading listArchived state to each task without emitting task events', () => { + const list = List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(1), [ + buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'), + ], new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37')); + const task = list.getTasks()[0]; + task.pullEvents(); + const actor = new IdEntity('0643c815-7220-7d64-8c42-6f2af4f9fd37'); + list.archive('list-archived-key', actor); + expect(list.isArchived()).toBe(true); + expect(task.isArchivedByList()).toBe(true); + expect(task.pullEvents()).toHaveLength(0); + list.unarchive('list-unarchived-key', actor); + expect(list.isArchived()).toBe(false); + expect(task.isArchivedByList()).toBe(false); + expect(task.pullEvents()).toHaveLength(0); + }); + it('deletes an archived list and soft deletes child tasks by cascade', () => { + const list = List.create(new ListId('0143c815-7220-7d64-8c42-6f2af4f9fd37'), new ListTitle(new Text('Backlog')), new PositiveInteger(1), [ + buildTask('0143c815-7220-7d64-8c42-6f2af4f9fd37', '0343c815-7220-7d64-8c42-6f2af4f9fd37', 1, '0243c815-7220-7d64-8c42-6f2af4f9fd37'), + ], new IdEntity('0343c815-7220-7d64-8c42-6f2af4f9fd37')); + const task = list.getTasks()[0]; + task.pullEvents(); + const actor = new IdEntity('0643c815-7220-7d64-8c42-6f2af4f9fd37'); + list.archive('list-archived-key', actor); + list.pullEvents(); + list.delete('list-deleted-key', actor); + expect(list.exists()).toBe(false); + expect(task.exists()).toBe(false); + expect(task.pullEvents()).toHaveLength(0); + }); +}); +//# sourceMappingURL=ListWithTasks.test.js.map \ No newline at end of file diff --git a/backend/dist/tests/modules/list/core/model/ListWithTasks.test.js.map b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.js.map new file mode 100644 index 00000000..33ca2ea4 --- /dev/null +++ b/backend/dist/tests/modules/list/core/model/ListWithTasks.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ListWithTasks.test.js","sourceRoot":"","sources":["../../../../../../tests/modules/list/core/model/ListWithTasks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,MAAM,MAAM,oDAAoD,CAAC;AACxE,OAAO,SAAS,MAAM,uDAAuD,CAAC;AAC9E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,SAAS,MAAM,wDAAwD,CAAC;AAC/E,OAAO,SAAS,MAAM,wDAAwD,CAAC;AAC/E,OAAO,MAAM,MAAM,qDAAqD,CAAC;AACzE,OAAO,QAAQ,MAAM,yDAAyD,CAAC;AAC/E,OAAO,qBAAqB,MAAM,mEAAmE,CAAC;AACtG,OAAO,eAAe,MAAM,gEAAgE,CAAC;AAC7F,OAAO,IAAI,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MAAM,CAAC,sCAAsC,CAAC,EAClD,IAAI,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,EAClC,IAAI,eAAe,CAAC,CAAC,CAAC,EACtB;YACE,SAAS,CACP,sCAAsC,EACtC,sCAAsC,EACtC,CAAC,EACD,sCAAsC,CACvC;SACF,EACD,IAAI,QAAQ,CAAC,sCAAsC,CAAC,CACrD,CAAC;QAEF,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAS,CAAC;QACxC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,sCAAsC,CAAC,CAAC;QAEnE,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAEvC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/backend/src/modules/notification/core/error/NotificationAlreadyRead.ts b/backend/src/modules/notification/core/error/NotificationAlreadyRead.ts new file mode 100644 index 00000000..18d24962 --- /dev/null +++ b/backend/src/modules/notification/core/error/NotificationAlreadyRead.ts @@ -0,0 +1,8 @@ +import CoreError from '../../../shared/core/errors/CoreError'; + +export default class NotificationAlreadyRead extends CoreError { + constructor(info?: unknown) { + super('Notification has already been read', info); + Object.setPrototypeOf(this, NotificationAlreadyRead.prototype); + } +} diff --git a/backend/src/modules/notification/core/error/NotificationStatusNotSupported.ts b/backend/src/modules/notification/core/error/NotificationStatusNotSupported.ts new file mode 100644 index 00000000..c0eeca64 --- /dev/null +++ b/backend/src/modules/notification/core/error/NotificationStatusNotSupported.ts @@ -0,0 +1,8 @@ +import CoreError from '../../../shared/core/errors/CoreError'; + +export default class NotificationStatusNotSupported extends CoreError { + constructor(info?: unknown) { + super('Notification status not supported', info); + Object.setPrototypeOf(this, NotificationStatusNotSupported.prototype); + } +} diff --git a/backend/src/modules/notification/core/events/NotificationCreated.ts b/backend/src/modules/notification/core/events/NotificationCreated.ts new file mode 100644 index 00000000..aacf7a0e --- /dev/null +++ b/backend/src/modules/notification/core/events/NotificationCreated.ts @@ -0,0 +1,16 @@ +import DomainEvent from '../../../shared/core/events/DomainEvent'; +import type DateTime from '../../../shared/core/objects/DateTime'; +import type IdEntity from '../../../shared/core/objects/IdEntity'; + +export default class NotificationCreated extends DomainEvent { + constructor( + key: string, + date: DateTime, + actor: IdEntity, + idUser: IdEntity, + idNotification: IdEntity, + info?: unknown, + ) { + super(key, date, actor, idUser, idNotification, 'NOTIFICATION_CREATED', info); + } +} diff --git a/backend/src/modules/notification/core/events/NotificationRead.ts b/backend/src/modules/notification/core/events/NotificationRead.ts new file mode 100644 index 00000000..00da3f62 --- /dev/null +++ b/backend/src/modules/notification/core/events/NotificationRead.ts @@ -0,0 +1,17 @@ +import DomainEvent from '../../../shared/core/events/DomainEvent'; +import type DateTime from '../../../shared/core/objects/DateTime'; +import type IdEntity from '../../../shared/core/objects/IdEntity'; +import type NotificationStatus from '../objects/NotificationStatus'; + +export default class NotificationRead extends DomainEvent { + constructor( + key: string, + date: DateTime, + actor: IdEntity, + idUser: IdEntity, + idNotification: IdEntity, + status: NotificationStatus, + ) { + super(key, date, actor, idUser, idNotification, 'NOTIFICATION_READ', status); + } +} diff --git a/backend/src/modules/notification/core/interfaces/NotificationParams.ts b/backend/src/modules/notification/core/interfaces/NotificationParams.ts new file mode 100644 index 00000000..2ce1ba50 --- /dev/null +++ b/backend/src/modules/notification/core/interfaces/NotificationParams.ts @@ -0,0 +1,10 @@ +import type { AllowedNotificationStatus } from '../types/AllowedNotificationStatus'; + +export default interface NotificationParams { + id: string; + event: string; + status: AllowedNotificationStatus; + idUser: string; + version: number; + deletedAt: Date | null; +} diff --git a/backend/src/modules/notification/core/model/Notification.ts b/backend/src/modules/notification/core/model/Notification.ts new file mode 100644 index 00000000..65f92abc --- /dev/null +++ b/backend/src/modules/notification/core/model/Notification.ts @@ -0,0 +1,96 @@ +import Entity from '../../../shared/core/model/Entity'; +import DateTime from '../../../shared/core/objects/DateTime'; +import DeletedAt from '../../../shared/core/objects/DeletedAt'; +import IdEntity from '../../../shared/core/objects/IdEntity'; +import Version from '../../../shared/core/objects/Version'; +import NotificationCreated from '../events/NotificationCreated'; +import NotificationRead from '../events/NotificationRead'; +import NotificationAlreadyRead from '../error/NotificationAlreadyRead'; +import type NotificationParams from '../interfaces/NotificationParams'; +import IdNotification from '../objects/IdNotification'; +import NotificationStatus from '../objects/NotificationStatus'; + +export default class Notification extends Entity { + private event!: IdEntity; + private status!: NotificationStatus; + + private constructor( + idNotification: IdNotification, + event: IdEntity, + status: NotificationStatus, + idUser: IdEntity, + ) { + super(idNotification, idUser); + this.event = event; + this.status = status; + } + + public static create( + key: string, + idNotification: IdNotification, + event: IdEntity, + idUser: IdEntity, + actor: IdEntity, + ): Notification { + const notification = new Notification(idNotification, event, NotificationStatus.unread(), idUser); + notification.create(); + notification.addEvent( + new NotificationCreated(key, DateTime.now(), actor, idUser, idNotification, notification.toPrimitives()), + ); + return notification; + } + + public static fromPrimitives(params: NotificationParams): Notification { + const notification = new Notification( + new IdNotification(params.id), + new IdEntity(params.event), + NotificationStatus.create(params.status), + new IdEntity(params.idUser), + ); + + notification.build( + new Version(params.version), + DeletedAt.createFromPrimitive(params.deletedAt), + ); + + return notification; + } + + public markAsRead(key: string, actor: IdEntity): void { + if (this.status.isRead()) { + throw new NotificationAlreadyRead({ idNotification: this.getId().getID() }); + } + + this.status = NotificationStatus.read(); + this.addEvent( + new NotificationRead(key, DateTime.now(), actor, this.getIdUser(), this.getId(), this.status), + ); + } + + public getId(): IdNotification { + return super.getID() as IdNotification; + } + + public getEvent(): IdEntity { + return this.event; + } + + public getStatus(): NotificationStatus { + return this.status; + } + + public getIdUser(): IdEntity { + return super.getOwner() as IdEntity; + } + + public toPrimitives(): NotificationParams { + return { + id: this.getId().getID(), + event: this.event.getID(), + status: this.status.getStatus(), + idUser: this.getIdUser().getID(), + version: super.getVersion().valueOf(), + deletedAt: super.getDeletedAt().toPrimitive(), + }; + } +} diff --git a/backend/src/modules/notification/core/objects/IdNotification.ts b/backend/src/modules/notification/core/objects/IdNotification.ts new file mode 100644 index 00000000..d12ce8b9 --- /dev/null +++ b/backend/src/modules/notification/core/objects/IdNotification.ts @@ -0,0 +1,7 @@ +import IdEntity from '../../../shared/core/objects/IdEntity'; + +export default class IdNotification extends IdEntity { + constructor(id: string) { + super(id); + } +} diff --git a/backend/src/modules/notification/core/objects/NotificationStatus.ts b/backend/src/modules/notification/core/objects/NotificationStatus.ts new file mode 100644 index 00000000..989ef749 --- /dev/null +++ b/backend/src/modules/notification/core/objects/NotificationStatus.ts @@ -0,0 +1,37 @@ +import ValueObject from '../../../shared/core/objects/ValueObject'; +import NotificationStatusNotSupported from '../error/NotificationStatusNotSupported'; +import { ALLOWED_NOTIFICATION_STATUS, AllowedNotificationStatus } from '../types/AllowedNotificationStatus'; + +export default class NotificationStatus extends ValueObject { + private status!: AllowedNotificationStatus; + + private constructor(status: AllowedNotificationStatus) { + super(); + if (!ALLOWED_NOTIFICATION_STATUS.includes(status)) throw new NotificationStatusNotSupported(status); + this.status = status; + } + + public static create(status: AllowedNotificationStatus): NotificationStatus { + return new NotificationStatus(status); + } + + public static read(): NotificationStatus { + return new NotificationStatus(AllowedNotificationStatus.read); + } + + public static unread(): NotificationStatus { + return new NotificationStatus(AllowedNotificationStatus.unread); + } + + public getStatus(): AllowedNotificationStatus { + return this.status; + } + + public isRead(): boolean { + return this.status === AllowedNotificationStatus.read; + } + + public isUnread(): boolean { + return this.status === AllowedNotificationStatus.unread; + } +} diff --git a/backend/src/modules/notification/core/repository/NotificationRepository.ts b/backend/src/modules/notification/core/repository/NotificationRepository.ts new file mode 100644 index 00000000..ae355b14 --- /dev/null +++ b/backend/src/modules/notification/core/repository/NotificationRepository.ts @@ -0,0 +1,9 @@ +import type Notification from '../model/Notification'; +import type IdNotification from '../objects/IdNotification'; + +export default interface NotificationRepository { + create(notification: Notification): Promise; + update(notification: Notification): Promise; + getById(idNotification: IdNotification): Promise; + getManyByIds(notifications: IdNotification[], limit: number, page: number): Promise; +} diff --git a/backend/src/modules/notification/core/types/AllowedNotificationStatus.ts b/backend/src/modules/notification/core/types/AllowedNotificationStatus.ts new file mode 100644 index 00000000..ae48307c --- /dev/null +++ b/backend/src/modules/notification/core/types/AllowedNotificationStatus.ts @@ -0,0 +1,6 @@ +export const ALLOWED_NOTIFICATION_STATUS = ['READ', 'UNREAD'] as const; + +export enum AllowedNotificationStatus { + read = 'READ', + unread = 'UNREAD', +} diff --git a/backend/tests/modules/notification/core/model/Notification.test.ts b/backend/tests/modules/notification/core/model/Notification.test.ts new file mode 100644 index 00000000..9ed7dd70 --- /dev/null +++ b/backend/tests/modules/notification/core/model/Notification.test.ts @@ -0,0 +1,157 @@ +import { describe, expect, it } from 'vitest'; +import NotificationAlreadyRead from '../../../../../src/modules/notification/core/error/NotificationAlreadyRead'; +import Notification from '../../../../../src/modules/notification/core/model/Notification'; +import IdNotification from '../../../../../src/modules/notification/core/objects/IdNotification'; +import { AllowedNotificationStatus } from '../../../../../src/modules/notification/core/types/AllowedNotificationStatus'; +import type DomainEvent from '../../../../../src/modules/shared/core/events/DomainEvent'; +import IdEntity from '../../../../../src/modules/shared/core/objects/IdEntity'; + +const DEFAULT_ID = '019df05a-8588-758c-b5e7-92af14bf85cf'; +const EVENT_ID = '019df05a-8588-758c-b5e7-92af14bf85c0'; +const USER_ID = '019df05a-8588-758c-b5e7-92af14bf85c1'; +const ACTOR_ID = '019df05a-8588-758c-b5e7-92af14bf85c2'; + +const createNotificationParams = ( + overrides?: Partial<{ + id: string; + event: string; + status: AllowedNotificationStatus; + idUser: string; + version: number; + deletedAt: Date | null; + key: string; + }>, +) => ({ + id: DEFAULT_ID, + event: EVENT_ID, + status: AllowedNotificationStatus.unread, + idUser: USER_ID, + version: 1, + deletedAt: null, + key: 'test-key', + ...overrides, +}); + +const buildNotification = (overrides?: Parameters[0]) => { + const params = createNotificationParams(overrides); + + return Notification.create( + params.key, + new IdNotification(params.id), + new IdEntity(params.event), + new IdEntity(params.idUser), + new IdEntity(ACTOR_ID), + ); +}; + +describe('Notification Entity', () => { + describe('Creation', () => { + it('should create a valid unread notification', () => { + const notification = buildNotification(); + + expect(notification.getId().getID()).toBe(DEFAULT_ID); + expect(notification.getEvent().getID()).toBe(EVENT_ID); + expect(notification.getIdUser().getID()).toBe(USER_ID); + expect(notification.getStatus().getStatus()).toBe(AllowedNotificationStatus.unread); + expect(notification.exists()).toBe(true); + }); + + it('should emit NotificationCreated event on creation', () => { + const notification = buildNotification(); + + const events = notification.pullEvents(); + + expect(events).toHaveLength(1); + expect((events[0] as DomainEvent).getEvent()).toBe('NOTIFICATION_CREATED'); + }); + }); + + describe('Read Status', () => { + it('should mark an unread notification as read', () => { + const notification = buildNotification(); + notification.pullEvents(); + + notification.markAsRead('read-key', new IdEntity(ACTOR_ID)); + + expect(notification.getStatus().getStatus()).toBe(AllowedNotificationStatus.read); + }); + + it('should emit NotificationRead event when marked as read', () => { + const notification = buildNotification(); + notification.pullEvents(); + + notification.markAsRead('read-key', new IdEntity(ACTOR_ID)); + + const events = notification.pullEvents(); + expect(events).toHaveLength(1); + expect((events[0] as DomainEvent).getEvent()).toBe('NOTIFICATION_READ'); + }); + + it('should not allow marking a notification as read twice', () => { + const notification = buildNotification(); + + notification.markAsRead('read-key', new IdEntity(ACTOR_ID)); + + expect(() => { + notification.markAsRead('read-key-2', new IdEntity(ACTOR_ID)); + }).toThrow(NotificationAlreadyRead); + }); + + it('should not emit a second event when marking as read twice fails', () => { + const notification = buildNotification(); + notification.pullEvents(); + + notification.markAsRead('read-key', new IdEntity(ACTOR_ID)); + notification.pullEvents(); + + try { + notification.markAsRead('read-key-2', new IdEntity(ACTOR_ID)); + } catch (e) { + expect(e).toBeInstanceOf(NotificationAlreadyRead); + } + + expect(notification.pullEvents()).toHaveLength(0); + }); + }); + + describe('Serialization', () => { + it('should serialize notification to primitives correctly', () => { + const params = createNotificationParams(); + const notification = buildNotification(); + + const primitives = notification.toPrimitives(); + + expect(primitives).toEqual({ + id: params.id, + event: params.event, + status: params.status, + idUser: params.idUser, + version: params.version, + deletedAt: params.deletedAt, + }); + }); + + it('should deserialize from primitives correctly', () => { + const params = createNotificationParams({ status: AllowedNotificationStatus.read }); + + const notification = Notification.fromPrimitives(params); + + expect(notification.getId().getID()).toBe(params.id); + expect(notification.getEvent().getID()).toBe(params.event); + expect(notification.getIdUser().getID()).toBe(params.idUser); + expect(notification.getStatus().getStatus()).toBe(AllowedNotificationStatus.read); + }); + + it('should preserve immutable details after marking as read', () => { + const notification = buildNotification(); + + notification.markAsRead('read-key', new IdEntity(ACTOR_ID)); + + const primitives = notification.toPrimitives(); + expect(primitives.id).toBe(DEFAULT_ID); + expect(primitives.event).toBe(EVENT_ID); + expect(primitives.idUser).toBe(USER_ID); + expect(primitives.status).toBe(AllowedNotificationStatus.read); + }); + }); +}); diff --git a/backend/tests/modules/notification/core/objects/NotificationStatus.test.ts b/backend/tests/modules/notification/core/objects/NotificationStatus.test.ts new file mode 100644 index 00000000..66126094 --- /dev/null +++ b/backend/tests/modules/notification/core/objects/NotificationStatus.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, it } from 'vitest'; +import NotificationStatusNotSupported from '../../../../../src/modules/notification/core/error/NotificationStatusNotSupported'; +import NotificationStatus from '../../../../../src/modules/notification/core/objects/NotificationStatus'; +import { AllowedNotificationStatus } from '../../../../../src/modules/notification/core/types/AllowedNotificationStatus'; + +describe('NotificationStatus Value Object', () => { + it('should create an unread status correctly', () => { + const status = NotificationStatus.unread(); + + expect(status.getStatus()).toBe(AllowedNotificationStatus.unread); + expect(status.isUnread()).toBe(true); + expect(status.isRead()).toBe(false); + }); + + it('should create a read status correctly', () => { + const status = NotificationStatus.read(); + + expect(status.getStatus()).toBe(AllowedNotificationStatus.read); + expect(status.isRead()).toBe(true); + expect(status.isUnread()).toBe(false); + }); + + it('should create status using factory method', () => { + const status = NotificationStatus.create(AllowedNotificationStatus.read); + + expect(status.getStatus()).toBe(AllowedNotificationStatus.read); + }); + + it('should throw error for unsupported status', () => { + expect(() => { + NotificationStatus.create('INVALID' as AllowedNotificationStatus); + }).toThrow(NotificationStatusNotSupported); + }); +});