@yozu-libs/domain 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/availability/adapters/typeorm/availability.mapper.d.ts +7 -0
- package/dist/availability/adapters/typeorm/availability.mapper.js +22 -0
- package/dist/availability/adapters/typeorm/availability.mapper.js.map +1 -0
- package/dist/availability/adapters/typeorm/availability.orm-entity.d.ts +7 -0
- package/dist/availability/adapters/typeorm/availability.orm-entity.js +38 -0
- package/dist/availability/adapters/typeorm/availability.orm-entity.js.map +1 -0
- package/dist/availability/adapters/typeorm/availability.repository.d.ts +15 -0
- package/dist/availability/adapters/typeorm/availability.repository.js +34 -0
- package/dist/availability/adapters/typeorm/availability.repository.js.map +1 -0
- package/dist/availability/entities/availability.entity.d.ts +14 -0
- package/dist/availability/entities/availability.entity.js +23 -0
- package/dist/availability/entities/availability.entity.js.map +1 -0
- package/dist/availability/index.d.ts +5 -0
- package/dist/availability/index.js +6 -0
- package/dist/availability/index.js.map +1 -0
- package/dist/availability/ports/availability.repository.port.d.ts +5 -0
- package/dist/availability/ports/availability.repository.port.js +2 -0
- package/dist/availability/ports/availability.repository.port.js.map +1 -0
- package/dist/core/base.entity.d.ts +13 -0
- package/dist/core/base.entity.js +29 -0
- package/dist/core/base.entity.js.map +1 -0
- package/dist/core/base.mapper.d.ts +5 -0
- package/dist/core/base.mapper.js +2 -0
- package/dist/core/base.mapper.js.map +1 -0
- package/dist/core/base.repository.port.d.ts +6 -0
- package/dist/core/base.repository.port.js +2 -0
- package/dist/core/base.repository.port.js.map +1 -0
- package/dist/core/base.value-object.d.ts +11 -0
- package/dist/core/base.value-object.js +21 -0
- package/dist/core/base.value-object.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/identity/company/adapters/typeorm/company.mapper.d.ts +7 -0
- package/dist/identity/company/adapters/typeorm/company.mapper.js +37 -0
- package/dist/identity/company/adapters/typeorm/company.mapper.js.map +1 -0
- package/dist/identity/company/adapters/typeorm/company.orm-entity.d.ts +10 -0
- package/dist/identity/company/adapters/typeorm/company.orm-entity.js +54 -0
- package/dist/identity/company/adapters/typeorm/company.orm-entity.js.map +1 -0
- package/dist/identity/company/adapters/typeorm/company.repository.d.ts +16 -0
- package/dist/identity/company/adapters/typeorm/company.repository.js +49 -0
- package/dist/identity/company/adapters/typeorm/company.repository.js.map +1 -0
- package/dist/identity/company/entities/company.entity.d.ts +17 -0
- package/dist/identity/company/entities/company.entity.js +32 -0
- package/dist/identity/company/entities/company.entity.js.map +1 -0
- package/dist/identity/company/index.d.ts +5 -0
- package/dist/identity/company/index.js +6 -0
- package/dist/identity/company/index.js.map +1 -0
- package/dist/identity/company/ports/company.repository.port.d.ts +6 -0
- package/dist/identity/company/ports/company.repository.port.js +2 -0
- package/dist/identity/company/ports/company.repository.port.js.map +1 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +4 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/student/adapters/typeorm/student.mapper.d.ts +7 -0
- package/dist/identity/student/adapters/typeorm/student.mapper.js +37 -0
- package/dist/identity/student/adapters/typeorm/student.mapper.js.map +1 -0
- package/dist/identity/student/adapters/typeorm/student.orm-entity.d.ts +11 -0
- package/dist/identity/student/adapters/typeorm/student.orm-entity.js +55 -0
- package/dist/identity/student/adapters/typeorm/student.orm-entity.js.map +1 -0
- package/dist/identity/student/adapters/typeorm/student.repository.d.ts +16 -0
- package/dist/identity/student/adapters/typeorm/student.repository.js +38 -0
- package/dist/identity/student/adapters/typeorm/student.repository.js.map +1 -0
- package/dist/identity/student/entities/student.entity.d.ts +18 -0
- package/dist/identity/student/entities/student.entity.js +32 -0
- package/dist/identity/student/entities/student.entity.js.map +1 -0
- package/dist/identity/student/index.d.ts +5 -0
- package/dist/identity/student/index.js +6 -0
- package/dist/identity/student/index.js.map +1 -0
- package/dist/identity/student/ports/student.repository.port.d.ts +5 -0
- package/dist/identity/student/ports/student.repository.port.js +2 -0
- package/dist/identity/student/ports/student.repository.port.js.map +1 -0
- package/dist/identity/user/adapters/typeorm/user.mapper.d.ts +7 -0
- package/dist/identity/user/adapters/typeorm/user.mapper.js +22 -0
- package/dist/identity/user/adapters/typeorm/user.mapper.js.map +1 -0
- package/dist/identity/user/adapters/typeorm/user.orm-entity.d.ts +8 -0
- package/dist/identity/user/adapters/typeorm/user.orm-entity.js +43 -0
- package/dist/identity/user/adapters/typeorm/user.orm-entity.js.map +1 -0
- package/dist/identity/user/adapters/typeorm/user.repository.d.ts +15 -0
- package/dist/identity/user/adapters/typeorm/user.repository.js +35 -0
- package/dist/identity/user/adapters/typeorm/user.repository.js.map +1 -0
- package/dist/identity/user/entities/user.entity.d.ts +16 -0
- package/dist/identity/user/entities/user.entity.js +26 -0
- package/dist/identity/user/entities/user.entity.js.map +1 -0
- package/dist/identity/user/index.d.ts +5 -0
- package/dist/identity/user/index.js +6 -0
- package/dist/identity/user/index.js.map +1 -0
- package/dist/identity/user/ports/user.repository.port.d.ts +5 -0
- package/dist/identity/user/ports/user.repository.port.js +2 -0
- package/dist/identity/user/ports/user.repository.port.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/adapters/typeorm/interaction.mapper.d.ts +7 -0
- package/dist/interaction/adapters/typeorm/interaction.mapper.js +26 -0
- package/dist/interaction/adapters/typeorm/interaction.mapper.js.map +1 -0
- package/dist/interaction/adapters/typeorm/interaction.orm-entity.d.ts +9 -0
- package/dist/interaction/adapters/typeorm/interaction.orm-entity.js +48 -0
- package/dist/interaction/adapters/typeorm/interaction.orm-entity.js.map +1 -0
- package/dist/interaction/adapters/typeorm/interaction.repository.d.ts +17 -0
- package/dist/interaction/adapters/typeorm/interaction.repository.js +40 -0
- package/dist/interaction/adapters/typeorm/interaction.repository.js.map +1 -0
- package/dist/interaction/entities/interaction.entity.d.ts +17 -0
- package/dist/interaction/entities/interaction.entity.js +25 -0
- package/dist/interaction/entities/interaction.entity.js.map +1 -0
- package/dist/interaction/index.d.ts +5 -0
- package/dist/interaction/index.js +6 -0
- package/dist/interaction/index.js.map +1 -0
- package/dist/interaction/ports/interaction.repository.port.d.ts +7 -0
- package/dist/interaction/ports/interaction.repository.port.js +2 -0
- package/dist/interaction/ports/interaction.repository.port.js.map +1 -0
- package/dist/job-offer/adapters/typeorm/job-offer.mapper.d.ts +7 -0
- package/dist/job-offer/adapters/typeorm/job-offer.mapper.js +26 -0
- package/dist/job-offer/adapters/typeorm/job-offer.mapper.js.map +1 -0
- package/dist/job-offer/adapters/typeorm/job-offer.orm-entity.d.ts +10 -0
- package/dist/job-offer/adapters/typeorm/job-offer.orm-entity.js +53 -0
- package/dist/job-offer/adapters/typeorm/job-offer.orm-entity.js.map +1 -0
- package/dist/job-offer/adapters/typeorm/job-offer.repository.d.ts +16 -0
- package/dist/job-offer/adapters/typeorm/job-offer.repository.js +36 -0
- package/dist/job-offer/adapters/typeorm/job-offer.repository.js.map +1 -0
- package/dist/job-offer/entities/job-offer.entity.d.ts +20 -0
- package/dist/job-offer/entities/job-offer.entity.js +30 -0
- package/dist/job-offer/entities/job-offer.entity.js.map +1 -0
- package/dist/job-offer/index.d.ts +5 -0
- package/dist/job-offer/index.js +6 -0
- package/dist/job-offer/index.js.map +1 -0
- package/dist/job-offer/ports/job-offer.repository.port.d.ts +6 -0
- package/dist/job-offer/ports/job-offer.repository.port.js +2 -0
- package/dist/job-offer/ports/job-offer.repository.port.js.map +1 -0
- package/dist/match/adapters/typeorm/match.mapper.d.ts +7 -0
- package/dist/match/adapters/typeorm/match.mapper.js +20 -0
- package/dist/match/adapters/typeorm/match.mapper.js.map +1 -0
- package/dist/match/adapters/typeorm/match.orm-entity.d.ts +6 -0
- package/dist/match/adapters/typeorm/match.orm-entity.js +37 -0
- package/dist/match/adapters/typeorm/match.orm-entity.js.map +1 -0
- package/dist/match/adapters/typeorm/match.repository.d.ts +16 -0
- package/dist/match/adapters/typeorm/match.repository.js +40 -0
- package/dist/match/adapters/typeorm/match.repository.js.map +1 -0
- package/dist/match/entities/match.entity.d.ts +12 -0
- package/dist/match/entities/match.entity.js +19 -0
- package/dist/match/entities/match.entity.js.map +1 -0
- package/dist/match/index.d.ts +5 -0
- package/dist/match/index.js +6 -0
- package/dist/match/index.js.map +1 -0
- package/dist/match/ports/match.repository.port.d.ts +6 -0
- package/dist/match/ports/match.repository.port.js +2 -0
- package/dist/match/ports/match.repository.port.js.map +1 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.mapper.d.ts +7 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.mapper.js +18 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.mapper.js.map +1 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.orm-entity.d.ts +5 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.orm-entity.js +32 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.orm-entity.js.map +1 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.repository.d.ts +15 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.repository.js +37 -0
- package/dist/messaging/chat-room/adapters/typeorm/chat-room.repository.js.map +1 -0
- package/dist/messaging/chat-room/entities/chat-room.entity.d.ts +10 -0
- package/dist/messaging/chat-room/entities/chat-room.entity.js +16 -0
- package/dist/messaging/chat-room/entities/chat-room.entity.js.map +1 -0
- package/dist/messaging/chat-room/index.d.ts +5 -0
- package/dist/messaging/chat-room/index.js +6 -0
- package/dist/messaging/chat-room/index.js.map +1 -0
- package/dist/messaging/chat-room/ports/chat-room.repository.port.d.ts +5 -0
- package/dist/messaging/chat-room/ports/chat-room.repository.port.js +2 -0
- package/dist/messaging/chat-room/ports/chat-room.repository.port.js.map +1 -0
- package/dist/messaging/index.d.ts +2 -0
- package/dist/messaging/index.js +3 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/messaging/message/adapters/typeorm/message.mapper.d.ts +7 -0
- package/dist/messaging/message/adapters/typeorm/message.mapper.js +26 -0
- package/dist/messaging/message/adapters/typeorm/message.mapper.js.map +1 -0
- package/dist/messaging/message/adapters/typeorm/message.orm-entity.d.ts +8 -0
- package/dist/messaging/message/adapters/typeorm/message.orm-entity.js +47 -0
- package/dist/messaging/message/adapters/typeorm/message.orm-entity.js.map +1 -0
- package/dist/messaging/message/adapters/typeorm/message.repository.d.ts +16 -0
- package/dist/messaging/message/adapters/typeorm/message.repository.js +42 -0
- package/dist/messaging/message/adapters/typeorm/message.repository.js.map +1 -0
- package/dist/messaging/message/entities/message.entity.d.ts +17 -0
- package/dist/messaging/message/entities/message.entity.js +31 -0
- package/dist/messaging/message/entities/message.entity.js.map +1 -0
- package/dist/messaging/message/index.d.ts +5 -0
- package/dist/messaging/message/index.js +6 -0
- package/dist/messaging/message/index.js.map +1 -0
- package/dist/messaging/message/ports/message.repository.port.d.ts +6 -0
- package/dist/messaging/message/ports/message.repository.port.js +2 -0
- package/dist/messaging/message/ports/message.repository.port.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseEntity } from '../../core';
|
|
2
|
+
export class MatchEntity extends BaseEntity {
|
|
3
|
+
constructor(id, props) {
|
|
4
|
+
if (!props.matchedAt) {
|
|
5
|
+
props.matchedAt = new Date();
|
|
6
|
+
}
|
|
7
|
+
super(id, props);
|
|
8
|
+
}
|
|
9
|
+
get studentId() {
|
|
10
|
+
return this.props.studentId;
|
|
11
|
+
}
|
|
12
|
+
get jobOfferId() {
|
|
13
|
+
return this.props.jobOfferId;
|
|
14
|
+
}
|
|
15
|
+
get matchedAt() {
|
|
16
|
+
return this.props.matchedAt;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=match.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.entity.js","sourceRoot":"","sources":["../../../src/match/entities/match.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQxC,MAAM,OAAO,WAAY,SAAQ,UAAsB;IACrD,YAAY,EAAU,EAAE,KAAiB;QACvC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACrB,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IACD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAiB,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './entities/match.entity';
|
|
2
|
+
export * from './ports/match.repository.port';
|
|
3
|
+
export * from './adapters/typeorm/match.orm-entity';
|
|
4
|
+
export * from './adapters/typeorm/match.mapper';
|
|
5
|
+
export * from './adapters/typeorm/match.repository';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/match/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RepositoryPort } from '../../core';
|
|
2
|
+
import { MatchEntity } from '../entities/match.entity';
|
|
3
|
+
export interface MatchRepositoryPort extends RepositoryPort<MatchEntity> {
|
|
4
|
+
findByStudent(studentId: string): Promise<MatchEntity[]>;
|
|
5
|
+
findByJobOffer(jobOfferId: string): Promise<MatchEntity[]>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.repository.port.js","sourceRoot":"","sources":["../../../src/match/ports/match.repository.port.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Mapper } from '../../../../core';
|
|
2
|
+
import { ChatRoomEntity } from '../../entities/chat-room.entity';
|
|
3
|
+
import { ChatRoomOrmEntity } from './chat-room.orm-entity';
|
|
4
|
+
export declare class ChatRoomMapper implements Mapper<ChatRoomEntity, ChatRoomOrmEntity> {
|
|
5
|
+
toDomain(raw: ChatRoomOrmEntity): ChatRoomEntity;
|
|
6
|
+
toPersistence(entity: ChatRoomEntity): ChatRoomOrmEntity;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChatRoomEntity } from '../../entities/chat-room.entity';
|
|
2
|
+
import { ChatRoomOrmEntity } from './chat-room.orm-entity';
|
|
3
|
+
export class ChatRoomMapper {
|
|
4
|
+
toDomain(raw) {
|
|
5
|
+
return new ChatRoomEntity(raw.id, {
|
|
6
|
+
matchId: raw.matchId,
|
|
7
|
+
createdAt: raw.createdAt,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
toPersistence(entity) {
|
|
11
|
+
const ormEntity = new ChatRoomOrmEntity();
|
|
12
|
+
ormEntity.id = entity.id;
|
|
13
|
+
ormEntity.matchId = entity.matchId;
|
|
14
|
+
ormEntity.createdAt = entity.createdAt;
|
|
15
|
+
return ormEntity;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=chat-room.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-room.mapper.js","sourceRoot":"","sources":["../../../../../src/messaging/chat-room/adapters/typeorm/chat-room.mapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,OAAO,cAAc;IACzB,QAAQ,CAAC,GAAsB;QAC7B,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE;YAChC,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,MAAsB;QAClC,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC1C,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QACnC,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACvC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
|
|
11
|
+
let ChatRoomOrmEntity = class ChatRoomOrmEntity {
|
|
12
|
+
id;
|
|
13
|
+
matchId;
|
|
14
|
+
createdAt;
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
PrimaryGeneratedColumn('uuid'),
|
|
18
|
+
__metadata("design:type", String)
|
|
19
|
+
], ChatRoomOrmEntity.prototype, "id", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
Column({ name: 'match_id', type: 'uuid' }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], ChatRoomOrmEntity.prototype, "matchId", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
CreateDateColumn({ name: 'created_at' }),
|
|
26
|
+
__metadata("design:type", Date)
|
|
27
|
+
], ChatRoomOrmEntity.prototype, "createdAt", void 0);
|
|
28
|
+
ChatRoomOrmEntity = __decorate([
|
|
29
|
+
Entity('chat_rooms')
|
|
30
|
+
], ChatRoomOrmEntity);
|
|
31
|
+
export { ChatRoomOrmEntity };
|
|
32
|
+
//# sourceMappingURL=chat-room.orm-entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-room.orm-entity.js","sourceRoot":"","sources":["../../../../../src/messaging/chat-room/adapters/typeorm/chat-room.orm-entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG5E,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE5B,EAAE,CAAU;IAGZ,OAAO,CAAU;IAGjB,SAAS,CAAQ;CAClB,CAAA;AAPC;IADC,sBAAsB,CAAC,MAAM,CAAC;;6CACnB;AAGZ;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAC1B;AAGjB;IADC,gBAAgB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC7B,IAAI;oDAAC;AARN,iBAAiB;IAD7B,MAAM,CAAC,YAAY,CAAC;GACR,iBAAiB,CAS7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { ChatRoomEntity } from '../../entities/chat-room.entity';
|
|
3
|
+
import { ChatRoomRepositoryPort } from '../../ports/chat-room.repository.port';
|
|
4
|
+
import { ChatRoomOrmEntity } from './chat-room.orm-entity';
|
|
5
|
+
import { ChatRoomMapper } from './chat-room.mapper';
|
|
6
|
+
export declare class ChatRoomRepository implements ChatRoomRepositoryPort {
|
|
7
|
+
private readonly repository;
|
|
8
|
+
private readonly mapper;
|
|
9
|
+
constructor(repository: Repository<ChatRoomOrmEntity>, mapper: ChatRoomMapper);
|
|
10
|
+
save(entity: ChatRoomEntity): Promise<void>;
|
|
11
|
+
findById(id: string): Promise<ChatRoomEntity | null>;
|
|
12
|
+
findByMatchId(matchId: string): Promise<ChatRoomEntity | null>;
|
|
13
|
+
findAll(): Promise<ChatRoomEntity[]>;
|
|
14
|
+
delete(id: string): Promise<boolean>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class ChatRoomRepository {
|
|
2
|
+
repository;
|
|
3
|
+
mapper;
|
|
4
|
+
constructor(repository, mapper) {
|
|
5
|
+
this.repository = repository;
|
|
6
|
+
this.mapper = mapper;
|
|
7
|
+
}
|
|
8
|
+
async save(entity) {
|
|
9
|
+
const ormEntity = this.mapper.toPersistence(entity);
|
|
10
|
+
await this.repository.save(ormEntity);
|
|
11
|
+
}
|
|
12
|
+
async findById(id) {
|
|
13
|
+
const ormEntity = await this.repository.findOne({ where: { id } });
|
|
14
|
+
if (!ormEntity) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return this.mapper.toDomain(ormEntity);
|
|
18
|
+
}
|
|
19
|
+
async findByMatchId(matchId) {
|
|
20
|
+
const ormEntity = await this.repository.findOne({
|
|
21
|
+
where: { matchId },
|
|
22
|
+
});
|
|
23
|
+
if (!ormEntity) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return this.mapper.toDomain(ormEntity);
|
|
27
|
+
}
|
|
28
|
+
async findAll() {
|
|
29
|
+
const ormEntities = await this.repository.find();
|
|
30
|
+
return ormEntities.map((orm) => this.mapper.toDomain(orm));
|
|
31
|
+
}
|
|
32
|
+
async delete(id) {
|
|
33
|
+
const result = await this.repository.delete(id);
|
|
34
|
+
return result.affected !== 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=chat-room.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-room.repository.js","sourceRoot":"","sources":["../../../../../src/messaging/chat-room/adapters/typeorm/chat-room.repository.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,kBAAkB;IAEV;IACA;IAFnB,YACmB,UAAyC,EACzC,MAAsB;QADtB,eAAU,GAAV,UAAU,CAA+B;QACzC,WAAM,GAAN,MAAM,CAAgB;IACtC,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,MAAsB;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACpD,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,OAAO,EAAE;SACnB,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACjD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseEntity } from '../../../core';
|
|
2
|
+
export interface ChatRoomProps {
|
|
3
|
+
matchId: string;
|
|
4
|
+
createdAt?: Date;
|
|
5
|
+
}
|
|
6
|
+
export declare class ChatRoomEntity extends BaseEntity<ChatRoomProps> {
|
|
7
|
+
constructor(id: string, props: ChatRoomProps);
|
|
8
|
+
get matchId(): string;
|
|
9
|
+
get createdAt(): Date;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseEntity } from '../../../core';
|
|
2
|
+
export class ChatRoomEntity extends BaseEntity {
|
|
3
|
+
constructor(id, props) {
|
|
4
|
+
if (!props.createdAt) {
|
|
5
|
+
props.createdAt = new Date();
|
|
6
|
+
}
|
|
7
|
+
super(id, props);
|
|
8
|
+
}
|
|
9
|
+
get matchId() {
|
|
10
|
+
return this.props.matchId;
|
|
11
|
+
}
|
|
12
|
+
get createdAt() {
|
|
13
|
+
return this.props.createdAt;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=chat-room.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-room.entity.js","sourceRoot":"","sources":["../../../../src/messaging/chat-room/entities/chat-room.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,MAAM,OAAO,cAAe,SAAQ,UAAyB;IAC3D,YAAY,EAAU,EAAE,KAAoB;QAC1C,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACrB,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IACD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAiB,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './entities/chat-room.entity';
|
|
2
|
+
export * from './ports/chat-room.repository.port';
|
|
3
|
+
export * from './adapters/typeorm/chat-room.orm-entity';
|
|
4
|
+
export * from './adapters/typeorm/chat-room.mapper';
|
|
5
|
+
export * from './adapters/typeorm/chat-room.repository';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/messaging/chat-room/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-room.repository.port.js","sourceRoot":"","sources":["../../../../src/messaging/chat-room/ports/chat-room.repository.port.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messaging/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Mapper } from '../../../../core';
|
|
2
|
+
import { MessageEntity } from '../../entities/message.entity';
|
|
3
|
+
import { MessageOrmEntity } from './message.orm-entity';
|
|
4
|
+
export declare class MessageMapper implements Mapper<MessageEntity, MessageOrmEntity> {
|
|
5
|
+
toDomain(raw: MessageOrmEntity): MessageEntity;
|
|
6
|
+
toPersistence(entity: MessageEntity): MessageOrmEntity;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MessageEntity } from '../../entities/message.entity';
|
|
2
|
+
import { MessageOrmEntity } from './message.orm-entity';
|
|
3
|
+
export class MessageMapper {
|
|
4
|
+
toDomain(raw) {
|
|
5
|
+
return new MessageEntity(raw.id.toString(), {
|
|
6
|
+
roomId: raw.roomId,
|
|
7
|
+
senderId: raw.senderId,
|
|
8
|
+
content: raw.content,
|
|
9
|
+
isRead: raw.isRead,
|
|
10
|
+
sentAt: raw.sentAt,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
toPersistence(entity) {
|
|
14
|
+
const ormEntity = new MessageOrmEntity();
|
|
15
|
+
if (entity.id) {
|
|
16
|
+
ormEntity.id = entity.id;
|
|
17
|
+
}
|
|
18
|
+
ormEntity.roomId = entity.roomId;
|
|
19
|
+
ormEntity.senderId = entity.senderId;
|
|
20
|
+
ormEntity.content = entity.content;
|
|
21
|
+
ormEntity.isRead = entity.isRead;
|
|
22
|
+
ormEntity.sentAt = entity.sentAt;
|
|
23
|
+
return ormEntity;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=message.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.mapper.js","sourceRoot":"","sources":["../../../../../src/messaging/message/adapters/typeorm/message.mapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,aAAa;IACxB,QAAQ,CAAC,GAAqB;QAC5B,OAAO,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC1C,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,MAAqB;QACjC,MAAM,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QAC3B,CAAC;QACD,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACjC,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACrC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QACnC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACjC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
|
|
11
|
+
let MessageOrmEntity = class MessageOrmEntity {
|
|
12
|
+
id;
|
|
13
|
+
roomId;
|
|
14
|
+
senderId;
|
|
15
|
+
content;
|
|
16
|
+
isRead;
|
|
17
|
+
sentAt;
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
PrimaryGeneratedColumn('increment', { type: 'bigint' }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], MessageOrmEntity.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
Column({ name: 'room_id', type: 'uuid' }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], MessageOrmEntity.prototype, "roomId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
Column({ name: 'sender_id', type: 'uuid' }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], MessageOrmEntity.prototype, "senderId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
Column({ type: 'text' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], MessageOrmEntity.prototype, "content", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
Column({ name: 'is_read', type: 'boolean', default: false }),
|
|
37
|
+
__metadata("design:type", Boolean)
|
|
38
|
+
], MessageOrmEntity.prototype, "isRead", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
CreateDateColumn({ name: 'sent_at' }),
|
|
41
|
+
__metadata("design:type", Date)
|
|
42
|
+
], MessageOrmEntity.prototype, "sentAt", void 0);
|
|
43
|
+
MessageOrmEntity = __decorate([
|
|
44
|
+
Entity('messages')
|
|
45
|
+
], MessageOrmEntity);
|
|
46
|
+
export { MessageOrmEntity };
|
|
47
|
+
//# sourceMappingURL=message.orm-entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.orm-entity.js","sourceRoot":"","sources":["../../../../../src/messaging/message/adapters/typeorm/message.orm-entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG5E,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,EAAE,CAAU;IAGZ,MAAM,CAAU;IAGhB,QAAQ,CAAU;IAGlB,OAAO,CAAU;IAGjB,MAAM,CAAW;IAGjB,MAAM,CAAQ;CACf,CAAA;AAhBC;IADC,sBAAsB,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;4CAC5C;AAGZ;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAC1B;AAGhB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAC1B;AAGlB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACR;AAGjB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;gDAC5C;AAGjB;IADC,gBAAgB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BAC7B,IAAI;gDAAC;AAjBH,gBAAgB;IAD5B,MAAM,CAAC,UAAU,CAAC;GACN,gBAAgB,CAkB5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { MessageEntity } from '../../entities/message.entity';
|
|
3
|
+
import { MessageRepositoryPort } from '../../ports/message.repository.port';
|
|
4
|
+
import { MessageOrmEntity } from './message.orm-entity';
|
|
5
|
+
import { MessageMapper } from './message.mapper';
|
|
6
|
+
export declare class MessageRepository implements MessageRepositoryPort {
|
|
7
|
+
private readonly repository;
|
|
8
|
+
private readonly mapper;
|
|
9
|
+
constructor(repository: Repository<MessageOrmEntity>, mapper: MessageMapper);
|
|
10
|
+
save(entity: MessageEntity): Promise<void>;
|
|
11
|
+
findById(id: string): Promise<MessageEntity | null>;
|
|
12
|
+
findByRoomId(roomId: string): Promise<MessageEntity[]>;
|
|
13
|
+
findUnreadMessagesInRoom(roomId: string): Promise<MessageEntity[]>;
|
|
14
|
+
findAll(): Promise<MessageEntity[]>;
|
|
15
|
+
delete(id: string): Promise<boolean>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export class MessageRepository {
|
|
2
|
+
repository;
|
|
3
|
+
mapper;
|
|
4
|
+
constructor(repository, mapper) {
|
|
5
|
+
this.repository = repository;
|
|
6
|
+
this.mapper = mapper;
|
|
7
|
+
}
|
|
8
|
+
async save(entity) {
|
|
9
|
+
const ormEntity = this.mapper.toPersistence(entity);
|
|
10
|
+
await this.repository.save(ormEntity);
|
|
11
|
+
}
|
|
12
|
+
async findById(id) {
|
|
13
|
+
const ormEntity = await this.repository.findOne({ where: { id } });
|
|
14
|
+
if (!ormEntity) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return this.mapper.toDomain(ormEntity);
|
|
18
|
+
}
|
|
19
|
+
async findByRoomId(roomId) {
|
|
20
|
+
const ormEntities = await this.repository.find({
|
|
21
|
+
where: { roomId },
|
|
22
|
+
order: { sentAt: 'ASC' },
|
|
23
|
+
});
|
|
24
|
+
return ormEntities.map((orm) => this.mapper.toDomain(orm));
|
|
25
|
+
}
|
|
26
|
+
async findUnreadMessagesInRoom(roomId) {
|
|
27
|
+
const ormEntities = await this.repository.find({
|
|
28
|
+
where: { roomId, isRead: false },
|
|
29
|
+
order: { sentAt: 'ASC' },
|
|
30
|
+
});
|
|
31
|
+
return ormEntities.map((orm) => this.mapper.toDomain(orm));
|
|
32
|
+
}
|
|
33
|
+
async findAll() {
|
|
34
|
+
const ormEntities = await this.repository.find();
|
|
35
|
+
return ormEntities.map((orm) => this.mapper.toDomain(orm));
|
|
36
|
+
}
|
|
37
|
+
async delete(id) {
|
|
38
|
+
const result = await this.repository.delete(id);
|
|
39
|
+
return result.affected !== 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=message.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.repository.js","sourceRoot":"","sources":["../../../../../src/messaging/message/adapters/typeorm/message.repository.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,iBAAiB;IAET;IACA;IAFnB,YACmB,UAAwC,EACxC,MAAqB;QADrB,eAAU,GAAV,UAAU,CAA8B;QACxC,WAAM,GAAN,MAAM,CAAe;IACrC,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,MAAqB;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACpD,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC7C,KAAK,EAAE,EAAE,MAAM,EAAE;YACjB,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;SACzB,CAAC,CAAC;QACH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,MAAc;QAC3C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC7C,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;YAChC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;SACzB,CAAC,CAAC;QACH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACjD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseEntity } from '../../../core';
|
|
2
|
+
export interface MessageProps {
|
|
3
|
+
roomId: string;
|
|
4
|
+
senderId: string;
|
|
5
|
+
content: string;
|
|
6
|
+
isRead: boolean;
|
|
7
|
+
sentAt?: Date;
|
|
8
|
+
}
|
|
9
|
+
export declare class MessageEntity extends BaseEntity<MessageProps> {
|
|
10
|
+
constructor(id: string, props: MessageProps);
|
|
11
|
+
get roomId(): string;
|
|
12
|
+
get senderId(): string;
|
|
13
|
+
get content(): string;
|
|
14
|
+
get isRead(): boolean;
|
|
15
|
+
get sentAt(): Date;
|
|
16
|
+
markAsRead(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseEntity } from '../../../core';
|
|
2
|
+
export class MessageEntity extends BaseEntity {
|
|
3
|
+
constructor(id, props) {
|
|
4
|
+
if (!props.sentAt) {
|
|
5
|
+
props.sentAt = new Date();
|
|
6
|
+
}
|
|
7
|
+
super(id, props);
|
|
8
|
+
}
|
|
9
|
+
get roomId() {
|
|
10
|
+
return this.props.roomId;
|
|
11
|
+
}
|
|
12
|
+
get senderId() {
|
|
13
|
+
return this.props.senderId;
|
|
14
|
+
}
|
|
15
|
+
get content() {
|
|
16
|
+
return this.props.content;
|
|
17
|
+
}
|
|
18
|
+
get isRead() {
|
|
19
|
+
return this.props.isRead;
|
|
20
|
+
}
|
|
21
|
+
get sentAt() {
|
|
22
|
+
return this.props.sentAt;
|
|
23
|
+
}
|
|
24
|
+
markAsRead() {
|
|
25
|
+
if (!this.props.isRead) {
|
|
26
|
+
this.logger.info(`Message ${this.id} lu par le destinataire`);
|
|
27
|
+
this.props.isRead = true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=message.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.entity.js","sourceRoot":"","sources":["../../../../src/messaging/message/entities/message.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAU3C,MAAM,OAAO,aAAc,SAAQ,UAAwB;IACzD,YAAY,EAAU,EAAE,KAAmB;QACzC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,KAAK,CAAC,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,CAAC;QACD,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IACD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IACD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAc,CAAC;IACnC,CAAC;IAEM,UAAU;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,yBAAyB,CAAC,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QAC3B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './entities/message.entity';
|
|
2
|
+
export * from './ports/message.repository.port';
|
|
3
|
+
export * from './adapters/typeorm/message.orm-entity';
|
|
4
|
+
export * from './adapters/typeorm/message.mapper';
|
|
5
|
+
export * from './adapters/typeorm/message.repository';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/messaging/message/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RepositoryPort } from '../../../core';
|
|
2
|
+
import { MessageEntity } from '../entities/message.entity';
|
|
3
|
+
export interface MessageRepositoryPort extends RepositoryPort<MessageEntity> {
|
|
4
|
+
findByRoomId(roomId: string): Promise<MessageEntity[]>;
|
|
5
|
+
findUnreadMessagesInRoom(roomId: string): Promise<MessageEntity[]>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.repository.port.js","sourceRoot":"","sources":["../../../../src/messaging/message/ports/message.repository.port.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yozu-libs/domain",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Modèles de domaine, entités, mappers, repositories pour le DDD",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"dev": "tsc -w",
|
|
15
|
+
"clean": "rm -rf dist",
|
|
16
|
+
"lint": "eslint \"src/**/*.ts\" --fix"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@yozu-libs/common": "workspace:^",
|
|
20
|
+
"@yozu-libs/logger": "workspace:^",
|
|
21
|
+
"typeorm": "^0.3.20"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
25
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
26
|
+
"eslint": "^10.0.1",
|
|
27
|
+
"eslint-config-prettier": "^10.1.8",
|
|
28
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
29
|
+
"prettier": "^3.8.1",
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"typescript-eslint": "^8.56.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/VictorAgahi/yozu-libs.git",
|
|
40
|
+
"directory": "packages/domain"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": "24.14.0"
|
|
44
|
+
}
|
|
45
|
+
}
|