@volontariapp/domain-social 0.1.0-snap-b34a5a8
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/CHANGELOG.md +10 -0
- package/dist/entities/index.d.ts +5 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +5 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/paginated-ids.entity.d.ts +6 -0
- package/dist/entities/paginated-ids.entity.d.ts.map +1 -0
- package/dist/entities/paginated-ids.entity.js +2 -0
- package/dist/entities/paginated-ids.entity.js.map +1 -0
- package/dist/entities/social-event.entity.d.ts +4 -0
- package/dist/entities/social-event.entity.d.ts.map +1 -0
- package/dist/entities/social-event.entity.js +4 -0
- package/dist/entities/social-event.entity.js.map +1 -0
- package/dist/entities/social-post.entity.d.ts +4 -0
- package/dist/entities/social-post.entity.d.ts.map +1 -0
- package/dist/entities/social-post.entity.js +4 -0
- package/dist/entities/social-post.entity.js.map +1 -0
- package/dist/entities/social-user.entity.d.ts +4 -0
- package/dist/entities/social-user.entity.d.ts.map +1 -0
- package/dist/entities/social-user.entity.js +4 -0
- package/dist/entities/social-user.entity.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/repositories/base/neo4j-base.repository.d.ts +16 -0
- package/dist/repositories/base/neo4j-base.repository.d.ts.map +1 -0
- package/dist/repositories/base/neo4j-base.repository.js +82 -0
- package/dist/repositories/base/neo4j-base.repository.js.map +1 -0
- package/dist/repositories/index.d.ts +9 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +9 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/interfaces/event-post-link.repository.d.ts +9 -0
- package/dist/repositories/interfaces/event-post-link.repository.d.ts.map +1 -0
- package/dist/repositories/interfaces/event-post-link.repository.js +2 -0
- package/dist/repositories/interfaces/event-post-link.repository.js.map +1 -0
- package/dist/repositories/interfaces/index.d.ts +7 -0
- package/dist/repositories/interfaces/index.d.ts.map +1 -0
- package/dist/repositories/interfaces/index.js +7 -0
- package/dist/repositories/interfaces/index.js.map +1 -0
- package/dist/repositories/interfaces/interaction.repository.d.ts +9 -0
- package/dist/repositories/interfaces/interaction.repository.d.ts.map +1 -0
- package/dist/repositories/interfaces/interaction.repository.js +2 -0
- package/dist/repositories/interfaces/interaction.repository.js.map +1 -0
- package/dist/repositories/interfaces/participation.repository.d.ts +15 -0
- package/dist/repositories/interfaces/participation.repository.d.ts.map +1 -0
- package/dist/repositories/interfaces/participation.repository.js +2 -0
- package/dist/repositories/interfaces/participation.repository.js.map +1 -0
- package/dist/repositories/interfaces/publication.repository.d.ts +12 -0
- package/dist/repositories/interfaces/publication.repository.d.ts.map +1 -0
- package/dist/repositories/interfaces/publication.repository.js +2 -0
- package/dist/repositories/interfaces/publication.repository.js.map +1 -0
- package/dist/repositories/interfaces/relationship.repository.d.ts +13 -0
- package/dist/repositories/interfaces/relationship.repository.d.ts.map +1 -0
- package/dist/repositories/interfaces/relationship.repository.js +2 -0
- package/dist/repositories/interfaces/relationship.repository.js.map +1 -0
- package/dist/repositories/interfaces/social-user.repository.d.ts +6 -0
- package/dist/repositories/interfaces/social-user.repository.d.ts.map +1 -0
- package/dist/repositories/interfaces/social-user.repository.js +2 -0
- package/dist/repositories/interfaces/social-user.repository.js.map +1 -0
- package/dist/repositories/neo4j-event-post-link.repository.d.ts +13 -0
- package/dist/repositories/neo4j-event-post-link.repository.d.ts.map +1 -0
- package/dist/repositories/neo4j-event-post-link.repository.js +46 -0
- package/dist/repositories/neo4j-event-post-link.repository.js.map +1 -0
- package/dist/repositories/neo4j-interaction.repository.d.ts +13 -0
- package/dist/repositories/neo4j-interaction.repository.d.ts.map +1 -0
- package/dist/repositories/neo4j-interaction.repository.js +48 -0
- package/dist/repositories/neo4j-interaction.repository.js.map +1 -0
- package/dist/repositories/neo4j-participation.repository.d.ts +19 -0
- package/dist/repositories/neo4j-participation.repository.d.ts.map +1 -0
- package/dist/repositories/neo4j-participation.repository.js +73 -0
- package/dist/repositories/neo4j-participation.repository.js.map +1 -0
- package/dist/repositories/neo4j-publication.repository.d.ts +16 -0
- package/dist/repositories/neo4j-publication.repository.d.ts.map +1 -0
- package/dist/repositories/neo4j-publication.repository.js +58 -0
- package/dist/repositories/neo4j-publication.repository.js.map +1 -0
- package/dist/repositories/neo4j-relationship.repository.d.ts +17 -0
- package/dist/repositories/neo4j-relationship.repository.d.ts.map +1 -0
- package/dist/repositories/neo4j-relationship.repository.js +69 -0
- package/dist/repositories/neo4j-relationship.repository.js.map +1 -0
- package/dist/repositories/neo4j-social-user.repository.d.ts +10 -0
- package/dist/repositories/neo4j-social-user.repository.d.ts.map +1 -0
- package/dist/repositories/neo4j-social-user.repository.js +37 -0
- package/dist/repositories/neo4j-social-user.repository.js.map +1 -0
- package/dist/services/event-post-link.service.d.ts +13 -0
- package/dist/services/event-post-link.service.d.ts.map +1 -0
- package/dist/services/event-post-link.service.js +78 -0
- package/dist/services/event-post-link.service.js.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +7 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/interaction.service.d.ts +13 -0
- package/dist/services/interaction.service.d.ts.map +1 -0
- package/dist/services/interaction.service.js +78 -0
- package/dist/services/interaction.service.js.map +1 -0
- package/dist/services/participation.service.d.ts +19 -0
- package/dist/services/participation.service.d.ts.map +1 -0
- package/dist/services/participation.service.js +148 -0
- package/dist/services/participation.service.js.map +1 -0
- package/dist/services/publication.service.d.ts +16 -0
- package/dist/services/publication.service.d.ts.map +1 -0
- package/dist/services/publication.service.js +113 -0
- package/dist/services/publication.service.js.map +1 -0
- package/dist/services/relationship.service.d.ts +17 -0
- package/dist/services/relationship.service.d.ts.map +1 -0
- package/dist/services/relationship.service.js +124 -0
- package/dist/services/relationship.service.js.map +1 -0
- package/dist/services/social-user.service.d.ts +10 -0
- package/dist/services/social-user.service.d.ts.map +1 -0
- package/dist/services/social-user.service.js +67 -0
- package/dist/services/social-user.service.js.map +1 -0
- package/dist/test/__test-utils__/factories/paginated-ids.factory.d.ts +7 -0
- package/dist/test/__test-utils__/factories/paginated-ids.factory.d.ts.map +1 -0
- package/dist/test/__test-utils__/factories/paginated-ids.factory.js +24 -0
- package/dist/test/__test-utils__/factories/paginated-ids.factory.js.map +1 -0
- package/dist/test/__test-utils__/factories/social-event.factory.d.ts +6 -0
- package/dist/test/__test-utils__/factories/social-event.factory.d.ts.map +1 -0
- package/dist/test/__test-utils__/factories/social-event.factory.js +14 -0
- package/dist/test/__test-utils__/factories/social-event.factory.js.map +1 -0
- package/dist/test/__test-utils__/factories/social-post.factory.d.ts +6 -0
- package/dist/test/__test-utils__/factories/social-post.factory.d.ts.map +1 -0
- package/dist/test/__test-utils__/factories/social-post.factory.js +14 -0
- package/dist/test/__test-utils__/factories/social-post.factory.js.map +1 -0
- package/dist/test/__test-utils__/factories/social-user.factory.d.ts +6 -0
- package/dist/test/__test-utils__/factories/social-user.factory.d.ts.map +1 -0
- package/dist/test/__test-utils__/factories/social-user.factory.js +14 -0
- package/dist/test/__test-utils__/factories/social-user.factory.js.map +1 -0
- package/dist/test/__test-utils__/mocks/event-post-link.repository.mock.d.ts +4 -0
- package/dist/test/__test-utils__/mocks/event-post-link.repository.mock.d.ts.map +1 -0
- package/dist/test/__test-utils__/mocks/event-post-link.repository.mock.js +8 -0
- package/dist/test/__test-utils__/mocks/event-post-link.repository.mock.js.map +1 -0
- package/dist/test/__test-utils__/mocks/interaction.repository.mock.d.ts +4 -0
- package/dist/test/__test-utils__/mocks/interaction.repository.mock.d.ts.map +1 -0
- package/dist/test/__test-utils__/mocks/interaction.repository.mock.js +8 -0
- package/dist/test/__test-utils__/mocks/interaction.repository.mock.js.map +1 -0
- package/dist/test/__test-utils__/mocks/participation.repository.mock.d.ts +4 -0
- package/dist/test/__test-utils__/mocks/participation.repository.mock.d.ts.map +1 -0
- package/dist/test/__test-utils__/mocks/participation.repository.mock.js +14 -0
- package/dist/test/__test-utils__/mocks/participation.repository.mock.js.map +1 -0
- package/dist/test/__test-utils__/mocks/publication.repository.mock.d.ts +4 -0
- package/dist/test/__test-utils__/mocks/publication.repository.mock.d.ts.map +1 -0
- package/dist/test/__test-utils__/mocks/publication.repository.mock.js +11 -0
- package/dist/test/__test-utils__/mocks/publication.repository.mock.js.map +1 -0
- package/dist/test/__test-utils__/mocks/relationship.repository.mock.d.ts +4 -0
- package/dist/test/__test-utils__/mocks/relationship.repository.mock.d.ts.map +1 -0
- package/dist/test/__test-utils__/mocks/relationship.repository.mock.js +12 -0
- package/dist/test/__test-utils__/mocks/relationship.repository.mock.js.map +1 -0
- package/dist/test/__test-utils__/mocks/social-user.repository.mock.d.ts +4 -0
- package/dist/test/__test-utils__/mocks/social-user.repository.mock.d.ts.map +1 -0
- package/dist/test/__test-utils__/mocks/social-user.repository.mock.js +7 -0
- package/dist/test/__test-utils__/mocks/social-user.repository.mock.js.map +1 -0
- package/dist/test/integration/event-post-link.repository.int.spec.d.ts +2 -0
- package/dist/test/integration/event-post-link.repository.int.spec.d.ts.map +1 -0
- package/dist/test/integration/event-post-link.repository.int.spec.js +123 -0
- package/dist/test/integration/event-post-link.repository.int.spec.js.map +1 -0
- package/dist/test/integration/interaction.repository.int.spec.d.ts +2 -0
- package/dist/test/integration/interaction.repository.int.spec.d.ts.map +1 -0
- package/dist/test/integration/interaction.repository.int.spec.js +114 -0
- package/dist/test/integration/interaction.repository.int.spec.js.map +1 -0
- package/dist/test/integration/participation.repository.int.spec.d.ts +2 -0
- package/dist/test/integration/participation.repository.int.spec.d.ts.map +1 -0
- package/dist/test/integration/participation.repository.int.spec.js +162 -0
- package/dist/test/integration/participation.repository.int.spec.js.map +1 -0
- package/dist/test/integration/publication.repository.int.spec.d.ts +2 -0
- package/dist/test/integration/publication.repository.int.spec.d.ts.map +1 -0
- package/dist/test/integration/publication.repository.int.spec.js +165 -0
- package/dist/test/integration/publication.repository.int.spec.js.map +1 -0
- package/dist/test/integration/relationship.repository.int.spec.d.ts +2 -0
- package/dist/test/integration/relationship.repository.int.spec.d.ts.map +1 -0
- package/dist/test/integration/relationship.repository.int.spec.js +132 -0
- package/dist/test/integration/relationship.repository.int.spec.js.map +1 -0
- package/dist/test/integration/social-user.repository.int.spec.d.ts +2 -0
- package/dist/test/integration/social-user.repository.int.spec.d.ts.map +1 -0
- package/dist/test/integration/social-user.repository.int.spec.js +55 -0
- package/dist/test/integration/social-user.repository.int.spec.js.map +1 -0
- package/dist/test/neo4j-driver.d.ts +6 -0
- package/dist/test/neo4j-driver.d.ts.map +1 -0
- package/dist/test/neo4j-driver.js +28 -0
- package/dist/test/neo4j-driver.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +2 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/test/unit/event-post-link.service.unit.spec.d.ts +2 -0
- package/dist/test/unit/event-post-link.service.unit.spec.d.ts.map +1 -0
- package/dist/test/unit/event-post-link.service.unit.spec.js +88 -0
- package/dist/test/unit/event-post-link.service.unit.spec.js.map +1 -0
- package/dist/test/unit/interaction.service.unit.spec.d.ts +2 -0
- package/dist/test/unit/interaction.service.unit.spec.d.ts.map +1 -0
- package/dist/test/unit/interaction.service.unit.spec.js +89 -0
- package/dist/test/unit/interaction.service.unit.spec.js.map +1 -0
- package/dist/test/unit/participation.service.unit.spec.d.ts +2 -0
- package/dist/test/unit/participation.service.unit.spec.d.ts.map +1 -0
- package/dist/test/unit/participation.service.unit.spec.js +171 -0
- package/dist/test/unit/participation.service.unit.spec.js.map +1 -0
- package/dist/test/unit/publication.service.unit.spec.d.ts +2 -0
- package/dist/test/unit/publication.service.unit.spec.d.ts.map +1 -0
- package/dist/test/unit/publication.service.unit.spec.js +129 -0
- package/dist/test/unit/publication.service.unit.spec.js.map +1 -0
- package/dist/test/unit/relationship.service.unit.spec.d.ts +2 -0
- package/dist/test/unit/relationship.service.unit.spec.d.ts.map +1 -0
- package/dist/test/unit/relationship.service.unit.spec.js +135 -0
- package/dist/test/unit/relationship.service.unit.spec.js.map +1 -0
- package/dist/test/unit/social-user.service.unit.spec.d.ts +2 -0
- package/dist/test/unit/social-user.service.unit.spec.d.ts.map +1 -0
- package/dist/test/unit/social-user.service.unit.spec.js +73 -0
- package/dist/test/unit/social-user.service.unit.spec.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
2
|
+
import type { PaginationRequest } from '@volontariapp/contracts';
|
|
3
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
4
|
+
import type { IParticipationRepository } from './interfaces/participation.repository.js';
|
|
5
|
+
import type { PaginatedIds } from '../entities/paginated-ids.entity.js';
|
|
6
|
+
export declare class Neo4jParticipationRepository extends Neo4jBaseRepository implements IParticipationRepository {
|
|
7
|
+
constructor(provider: NestNeo4jProvider);
|
|
8
|
+
createEventNode(eventId: string): Promise<void>;
|
|
9
|
+
deleteEventNode(eventId: string): Promise<void>;
|
|
10
|
+
eventExists(eventId: string): Promise<boolean>;
|
|
11
|
+
createUserEvent(userId: string, eventId: string): Promise<void>;
|
|
12
|
+
deleteUserEvent(userId: string, eventId: string): Promise<void>;
|
|
13
|
+
createParticipation(userId: string, eventId: string): Promise<void>;
|
|
14
|
+
deleteParticipation(userId: string, eventId: string): Promise<void>;
|
|
15
|
+
getUserEvents(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
16
|
+
getUserParticipations(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
17
|
+
getEventParticipants(eventId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=neo4j-participation.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AE,MAAM,EACf,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,YAAY,CAAC;CAWzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
14
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
15
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
16
|
+
let Neo4jParticipationRepository = class Neo4jParticipationRepository extends Neo4jBaseRepository {
|
|
17
|
+
constructor(provider) {
|
|
18
|
+
super(provider);
|
|
19
|
+
}
|
|
20
|
+
async createEventNode(eventId) {
|
|
21
|
+
await this.write('MERGE (e:SocialEvent {eventId: $eventId})', { eventId });
|
|
22
|
+
}
|
|
23
|
+
async deleteEventNode(eventId) {
|
|
24
|
+
await this.write('MATCH (e:SocialEvent {eventId: $eventId}) DETACH DELETE e', { eventId });
|
|
25
|
+
}
|
|
26
|
+
async eventExists(eventId) {
|
|
27
|
+
const result = await this.readOne('MATCH (e:SocialEvent {eventId: $eventId}) RETURN e.eventId AS id', { eventId }, (r) => r.get('id'));
|
|
28
|
+
return result !== null;
|
|
29
|
+
}
|
|
30
|
+
async createUserEvent(userId, eventId) {
|
|
31
|
+
await this.write(`MATCH (u:SocialUser {userId: $userId})
|
|
32
|
+
MATCH (e:SocialEvent {eventId: $eventId})
|
|
33
|
+
MERGE (u)-[:CREATED]->(e)`, { userId, eventId });
|
|
34
|
+
}
|
|
35
|
+
async deleteUserEvent(userId, eventId) {
|
|
36
|
+
await this.write(`MATCH (:SocialUser {userId: $userId})-[r:CREATED]->(:SocialEvent {eventId: $eventId})
|
|
37
|
+
DELETE r`, { userId, eventId });
|
|
38
|
+
}
|
|
39
|
+
async createParticipation(userId, eventId) {
|
|
40
|
+
await this.write(`MATCH (u:SocialUser {userId: $userId})
|
|
41
|
+
MATCH (e:SocialEvent {eventId: $eventId})
|
|
42
|
+
MERGE (u)-[:PARTICIPATE]->(e)`, { userId, eventId });
|
|
43
|
+
}
|
|
44
|
+
async deleteParticipation(userId, eventId) {
|
|
45
|
+
await this.write(`MATCH (:SocialUser {userId: $userId})-[r:PARTICIPATE]->(:SocialEvent {eventId: $eventId})
|
|
46
|
+
DELETE r`, { userId, eventId });
|
|
47
|
+
}
|
|
48
|
+
async getUserEvents(userId, pagination) {
|
|
49
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})-[:CREATED]->(e:SocialEvent)
|
|
50
|
+
RETURN e.eventId AS id
|
|
51
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})-[:CREATED]->(e:SocialEvent)
|
|
52
|
+
RETURN count(e) AS total`, { userId }, pagination);
|
|
53
|
+
}
|
|
54
|
+
async getUserParticipations(userId, pagination) {
|
|
55
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})-[:PARTICIPATE]->(e:SocialEvent)
|
|
56
|
+
RETURN e.eventId AS id
|
|
57
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})-[:PARTICIPATE]->(e:SocialEvent)
|
|
58
|
+
RETURN count(e) AS total`, { userId }, pagination);
|
|
59
|
+
}
|
|
60
|
+
async getEventParticipants(eventId, pagination) {
|
|
61
|
+
return this.readPaginated(`MATCH (u:SocialUser)-[:PARTICIPATE]->(:SocialEvent {eventId: $eventId})
|
|
62
|
+
RETURN u.userId AS id
|
|
63
|
+
SKIP $skip LIMIT $limit`, `MATCH (u:SocialUser)-[:PARTICIPATE]->(:SocialEvent {eventId: $eventId})
|
|
64
|
+
RETURN count(u) AS total`, { eventId }, pagination);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
Neo4jParticipationRepository = __decorate([
|
|
68
|
+
Injectable(),
|
|
69
|
+
__param(0, Inject(NestNeo4jProvider)),
|
|
70
|
+
__metadata("design:paramtypes", [NestNeo4jProvider])
|
|
71
|
+
], Neo4jParticipationRepository);
|
|
72
|
+
export { Neo4jParticipationRepository };
|
|
73
|
+
//# sourceMappingURL=neo4j-participation.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-participation.repository.js","sourceRoot":"","sources":["../../src/repositories/neo4j-participation.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAK/D,IAAM,4BAA4B,GAAlC,MAAM,4BACX,SAAQ,mBAAmB;IAG3B,YAEE,QAA2B;QAE3B,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAe;QACnC,MAAM,IAAI,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAe;QACnC,MAAM,IAAI,CAAC,KAAK,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UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,OAAe,EACf,UAA6B;QAE7B,OAAO,IAAI,CAAC,aAAa,CACvB;;+BAEyB,EACzB;gCAC0B,EAC1B,EAAE,OAAO,EAAE,EACX,UAAU,CACX,CAAC;IACJ,CAAC;CACF,CAAA;AAvGY,4BAA4B;IADxC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;qCAChB,iBAAiB;GANlB,4BAA4B,CAuGxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
2
|
+
import type { PaginationRequest } from '@volontariapp/contracts';
|
|
3
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
4
|
+
import type { IPublicationRepository } from './interfaces/publication.repository.js';
|
|
5
|
+
import type { PaginatedIds } from '../entities/paginated-ids.entity.js';
|
|
6
|
+
export declare class Neo4jPublicationRepository extends Neo4jBaseRepository implements IPublicationRepository {
|
|
7
|
+
constructor(provider: NestNeo4jProvider);
|
|
8
|
+
createPostNode(postId: string): Promise<void>;
|
|
9
|
+
deletePostNode(postId: string): Promise<void>;
|
|
10
|
+
postExists(postId: string): Promise<boolean>;
|
|
11
|
+
createOwnership(userId: string, postId: string): Promise<void>;
|
|
12
|
+
deleteOwnership(userId: string, postId: string): Promise<void>;
|
|
13
|
+
getUserPosts(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
14
|
+
getFeed(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=neo4j-publication.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-publication.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/neo4j-publication.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBACa,0BACX,SAAQ,mBACR,YAAW,sBAAsB;gBAI/B,QAAQ,EAAE,iBAAiB;IAKvB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS5C,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9D,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9D,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAYlF,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;CAWpF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
14
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
15
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
16
|
+
let Neo4jPublicationRepository = class Neo4jPublicationRepository extends Neo4jBaseRepository {
|
|
17
|
+
constructor(provider) {
|
|
18
|
+
super(provider);
|
|
19
|
+
}
|
|
20
|
+
async createPostNode(postId) {
|
|
21
|
+
await this.write('MERGE (p:SocialPost {postId: $postId})', { postId });
|
|
22
|
+
}
|
|
23
|
+
async deletePostNode(postId) {
|
|
24
|
+
await this.write('MATCH (p:SocialPost {postId: $postId}) DETACH DELETE p', { postId });
|
|
25
|
+
}
|
|
26
|
+
async postExists(postId) {
|
|
27
|
+
const result = await this.readOne('MATCH (p:SocialPost {postId: $postId}) RETURN p.postId AS id', { postId }, (r) => r.get('id'));
|
|
28
|
+
return result !== null;
|
|
29
|
+
}
|
|
30
|
+
async createOwnership(userId, postId) {
|
|
31
|
+
await this.write(`MATCH (u:SocialUser {userId: $userId})
|
|
32
|
+
MATCH (p:SocialPost {postId: $postId})
|
|
33
|
+
MERGE (u)-[:OWN]->(p)`, { userId, postId });
|
|
34
|
+
}
|
|
35
|
+
async deleteOwnership(userId, postId) {
|
|
36
|
+
await this.write(`MATCH (:SocialUser {userId: $userId})-[r:OWN]->(:SocialPost {postId: $postId})
|
|
37
|
+
DELETE r`, { userId, postId });
|
|
38
|
+
}
|
|
39
|
+
async getUserPosts(userId, pagination) {
|
|
40
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})-[:OWN]->(p:SocialPost)
|
|
41
|
+
RETURN p.postId AS id
|
|
42
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})-[:OWN]->(p:SocialPost)
|
|
43
|
+
RETURN count(p) AS total`, { userId }, pagination);
|
|
44
|
+
}
|
|
45
|
+
async getFeed(userId, pagination) {
|
|
46
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})-[:FOLLOW]->(followed:SocialUser)-[:OWN]->(p:SocialPost)
|
|
47
|
+
RETURN DISTINCT p.postId AS id
|
|
48
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})-[:FOLLOW]->(followed:SocialUser)-[:OWN]->(p:SocialPost)
|
|
49
|
+
RETURN count(DISTINCT p) AS total`, { userId }, pagination);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
Neo4jPublicationRepository = __decorate([
|
|
53
|
+
Injectable(),
|
|
54
|
+
__param(0, Inject(NestNeo4jProvider)),
|
|
55
|
+
__metadata("design:paramtypes", [NestNeo4jProvider])
|
|
56
|
+
], Neo4jPublicationRepository);
|
|
57
|
+
export { Neo4jPublicationRepository };
|
|
58
|
+
//# sourceMappingURL=neo4j-publication.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-publication.repository.js","sourceRoot":"","sources":["../../src/repositories/neo4j-publication.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAK/D,IAAM,0BAA0B,GAAhC,MAAM,0BACX,SAAQ,mBAAmB;IAG3B,YAEE,QAA2B;QAE3B,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC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ANlB,0BAA0B,CAoEtC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
2
|
+
import type { PaginationRequest } from '@volontariapp/contracts';
|
|
3
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
4
|
+
import type { IRelationshipRepository } from './interfaces/relationship.repository.js';
|
|
5
|
+
import type { PaginatedIds } from '../entities/paginated-ids.entity.js';
|
|
6
|
+
export declare class Neo4jRelationshipRepository extends Neo4jBaseRepository implements IRelationshipRepository {
|
|
7
|
+
constructor(provider: NestNeo4jProvider);
|
|
8
|
+
createFollow(followerId: string, followedId: string): Promise<void>;
|
|
9
|
+
deleteFollow(followerId: string, followedId: string): Promise<void>;
|
|
10
|
+
createBlock(blockerId: string, blockedId: string): Promise<void>;
|
|
11
|
+
deleteBlock(blockerId: string, blockedId: string): Promise<void>;
|
|
12
|
+
getFollows(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
13
|
+
getFollowers(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
14
|
+
getBlocks(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
15
|
+
getWhoBlockedMe(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=neo4j-relationship.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-relationship.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/neo4j-relationship.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBACa,2BACX,SAAQ,mBACR,YAAW,uBAAuB;gBAIhC,QAAQ,EAAE,iBAAiB;IAKvB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAShE,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAYhF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAYlF,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAY/E,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;CAW5F"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
14
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
15
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
16
|
+
let Neo4jRelationshipRepository = class Neo4jRelationshipRepository extends Neo4jBaseRepository {
|
|
17
|
+
constructor(provider) {
|
|
18
|
+
super(provider);
|
|
19
|
+
}
|
|
20
|
+
async createFollow(followerId, followedId) {
|
|
21
|
+
await this.write(`MATCH (f:SocialUser {userId: $followerId})
|
|
22
|
+
MATCH (t:SocialUser {userId: $followedId})
|
|
23
|
+
MERGE (f)-[:FOLLOW]->(t)`, { followerId, followedId });
|
|
24
|
+
}
|
|
25
|
+
async deleteFollow(followerId, followedId) {
|
|
26
|
+
await this.write(`MATCH (:SocialUser {userId: $followerId})-[r:FOLLOW]->(:SocialUser {userId: $followedId})
|
|
27
|
+
DELETE r`, { followerId, followedId });
|
|
28
|
+
}
|
|
29
|
+
async createBlock(blockerId, blockedId) {
|
|
30
|
+
await this.write(`MATCH (b:SocialUser {userId: $blockerId})
|
|
31
|
+
MATCH (t:SocialUser {userId: $blockedId})
|
|
32
|
+
MERGE (b)-[:BLOCK]->(t)`, { blockerId, blockedId });
|
|
33
|
+
}
|
|
34
|
+
async deleteBlock(blockerId, blockedId) {
|
|
35
|
+
await this.write(`MATCH (:SocialUser {userId: $blockerId})-[r:BLOCK]->(:SocialUser {userId: $blockedId})
|
|
36
|
+
DELETE r`, { blockerId, blockedId });
|
|
37
|
+
}
|
|
38
|
+
async getFollows(userId, pagination) {
|
|
39
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})-[:FOLLOW]->(u:SocialUser)
|
|
40
|
+
RETURN u.userId AS id
|
|
41
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})-[:FOLLOW]->(u:SocialUser)
|
|
42
|
+
RETURN count(u) AS total`, { userId }, pagination);
|
|
43
|
+
}
|
|
44
|
+
async getFollowers(userId, pagination) {
|
|
45
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})<-[:FOLLOW]-(u:SocialUser)
|
|
46
|
+
RETURN u.userId AS id
|
|
47
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})<-[:FOLLOW]-(u:SocialUser)
|
|
48
|
+
RETURN count(u) AS total`, { userId }, pagination);
|
|
49
|
+
}
|
|
50
|
+
async getBlocks(userId, pagination) {
|
|
51
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})-[:BLOCK]->(u:SocialUser)
|
|
52
|
+
RETURN u.userId AS id
|
|
53
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})-[:BLOCK]->(u:SocialUser)
|
|
54
|
+
RETURN count(u) AS total`, { userId }, pagination);
|
|
55
|
+
}
|
|
56
|
+
async getWhoBlockedMe(userId, pagination) {
|
|
57
|
+
return this.readPaginated(`MATCH (:SocialUser {userId: $userId})<-[:BLOCK]-(u:SocialUser)
|
|
58
|
+
RETURN u.userId AS id
|
|
59
|
+
SKIP $skip LIMIT $limit`, `MATCH (:SocialUser {userId: $userId})<-[:BLOCK]-(u:SocialUser)
|
|
60
|
+
RETURN count(u) AS total`, { userId }, pagination);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
Neo4jRelationshipRepository = __decorate([
|
|
64
|
+
Injectable(),
|
|
65
|
+
__param(0, Inject(NestNeo4jProvider)),
|
|
66
|
+
__metadata("design:paramtypes", [NestNeo4jProvider])
|
|
67
|
+
], Neo4jRelationshipRepository);
|
|
68
|
+
export { Neo4jRelationshipRepository };
|
|
69
|
+
//# sourceMappingURL=neo4j-relationship.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-relationship.repository.js","sourceRoot":"","sources":["../../src/repositories/neo4j-relationship.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAK/D,IAAM,2BAA2B,GAAjC,MAAM,2BACX,SAAQ,mBAAmB;IAG3B,YAEE,QAA2B;QAE3B,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,UAAkB;QACvD,MAAM,IAAI,CAAC,KAAK,CACd;;gCAE0B,EAC1B,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,UAAkB;QACvD,MAAM,IAAI,CAAC,KAAK,CACd;gBACU,EACV,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,SAAiB;QACpD,MAAM,IAAI,CAAC,KAAK,CACd;;+BAEyB,EACzB,EAAE,SAAS,EAAE,SAAS,EAAE,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,SAAiB;QACpD,MAAM,IAAI,CAAC,KAAK,CACd;gBACU,EACV,EAAE,SAAS,EAAE,SAAS,EAAE,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,UAA6B;QAC5D,OAAO,IAAI,CAAC,aAAa,CACvB;;+BAEyB,EACzB;gCAC0B,EAC1B,EAAE,MAAM,EAAE,EACV,UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,UAA6B;QAC9D,OAAO,IAAI,CAAC,aAAa,CACvB;;+BAEyB,EACzB;gCAC0B,EAC1B,EAAE,MAAM,EAAE,EACV,UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,UAA6B;QAC3D,OAAO,IAAI,CAAC,aAAa,CACvB;;+BAEyB,EACzB;gCAC0B,EAC1B,EAAE,MAAM,EAAE,EACV,UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,MAAc,EAAE,UAA6B;QACjE,OAAO,IAAI,CAAC,aAAa,CACvB;;+BAEyB,EACzB;gCAC0B,EAC1B,EAAE,MAAM,EAAE,EACV,UAAU,CACX,CAAC;IACJ,CAAC;CACF,CAAA;AA5FY,2BAA2B;IADvC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;qCAChB,iBAAiB;GANlB,2BAA2B,CA4FvC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
2
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
3
|
+
import type { ISocialUserRepository } from './interfaces/social-user.repository.js';
|
|
4
|
+
export declare class Neo4jSocialUserRepository extends Neo4jBaseRepository implements ISocialUserRepository {
|
|
5
|
+
constructor(provider: NestNeo4jProvider);
|
|
6
|
+
createNode(userId: string): Promise<void>;
|
|
7
|
+
deleteNode(userId: string): Promise<void>;
|
|
8
|
+
exists(userId: string): Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=neo4j-social-user.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-social-user.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/neo4j-social-user.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAEpF,qBACa,yBACX,SAAQ,mBACR,YAAW,qBAAqB;gBAI9B,QAAQ,EAAE,iBAAiB;IAKvB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAQ/C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
14
|
+
import { NestNeo4jProvider } from '@volontariapp/bridge-nest';
|
|
15
|
+
import { Neo4jBaseRepository } from './base/neo4j-base.repository.js';
|
|
16
|
+
let Neo4jSocialUserRepository = class Neo4jSocialUserRepository extends Neo4jBaseRepository {
|
|
17
|
+
constructor(provider) {
|
|
18
|
+
super(provider);
|
|
19
|
+
}
|
|
20
|
+
async createNode(userId) {
|
|
21
|
+
await this.write('MERGE (u:SocialUser {userId: $userId})', { userId });
|
|
22
|
+
}
|
|
23
|
+
async deleteNode(userId) {
|
|
24
|
+
await this.write('MATCH (u:SocialUser {userId: $userId}) DETACH DELETE u', { userId });
|
|
25
|
+
}
|
|
26
|
+
async exists(userId) {
|
|
27
|
+
const result = await this.readOne('MATCH (u:SocialUser {userId: $userId}) RETURN u.userId AS id', { userId }, (r) => r.get('id'));
|
|
28
|
+
return result !== null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
Neo4jSocialUserRepository = __decorate([
|
|
32
|
+
Injectable(),
|
|
33
|
+
__param(0, Inject(NestNeo4jProvider)),
|
|
34
|
+
__metadata("design:paramtypes", [NestNeo4jProvider])
|
|
35
|
+
], Neo4jSocialUserRepository);
|
|
36
|
+
export { Neo4jSocialUserRepository };
|
|
37
|
+
//# sourceMappingURL=neo4j-social-user.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j-social-user.repository.js","sourceRoot":"","sources":["../../src/repositories/neo4j-social-user.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAI/D,IAAM,yBAAyB,GAA/B,MAAM,yBACX,SAAQ,mBAAmB;IAG3B,YAEE,QAA2B;QAE3B,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAAc;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,wCAAwC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAAc;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,wDAAwD,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAC/B,8DAA8D,EAC9D,EAAE,MAAM,EAAE,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAW,CAC7B,CAAC;QACF,OAAO,MAAM,KAAK,IAAI,CAAC;IACzB,CAAC;CACF,CAAA;AA3BY,yBAAyB;IADrC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;qCAChB,iBAAiB;GANlB,yBAAyB,CA2BrC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PaginationRequest } from '@volontariapp/contracts';
|
|
2
|
+
import type { IEventPostLinkRepository } from '../repositories/interfaces/event-post-link.repository.js';
|
|
3
|
+
import type { PaginatedIds } from '../entities/paginated-ids.entity.js';
|
|
4
|
+
export declare class EventPostLinkService {
|
|
5
|
+
private readonly repository;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(repository: IEventPostLinkRepository);
|
|
8
|
+
linkPostToEvent(postId: string, eventId: string): Promise<void>;
|
|
9
|
+
unlinkPostFromEvent(postId: string, eventId: string): Promise<void>;
|
|
10
|
+
getEventRelatedToPost(postId: string): Promise<string | null>;
|
|
11
|
+
getEventPosts(eventId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=event-post-link.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-post-link.service.d.ts","sourceRoot":"","sources":["../../src/services/event-post-link.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBACa,oBAAoB;IAK7B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;gBAI1D,UAAU,EAAE,wBAAwB;IAGjD,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW/D,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnE,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAU7D,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;CAS3F"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var EventPostLinkService_1;
|
|
14
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
15
|
+
import { Logger } from '@volontariapp/logger';
|
|
16
|
+
import { DATABASE_ERROR } from '@volontariapp/errors-nest';
|
|
17
|
+
import { isBaseError } from '@volontariapp/errors';
|
|
18
|
+
import { Neo4jEventPostLinkRepository } from '../repositories/neo4j-event-post-link.repository.js';
|
|
19
|
+
let EventPostLinkService = EventPostLinkService_1 = class EventPostLinkService {
|
|
20
|
+
repository;
|
|
21
|
+
logger = new Logger({ context: EventPostLinkService_1.name });
|
|
22
|
+
constructor(repository) {
|
|
23
|
+
this.repository = repository;
|
|
24
|
+
}
|
|
25
|
+
async linkPostToEvent(postId, eventId) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log(`Linking post ${postId} to event ${eventId}`);
|
|
28
|
+
await this.repository.linkPostToEvent(postId, eventId);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (isBaseError(error))
|
|
32
|
+
throw error;
|
|
33
|
+
this.logger.error(`Failed to link post ${postId} to event ${eventId}`, error);
|
|
34
|
+
throw DATABASE_ERROR('linking post to event', error.message);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async unlinkPostFromEvent(postId, eventId) {
|
|
38
|
+
try {
|
|
39
|
+
this.logger.log(`Unlinking post ${postId} from event ${eventId}`);
|
|
40
|
+
await this.repository.unlinkPostFromEvent(postId, eventId);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (isBaseError(error))
|
|
44
|
+
throw error;
|
|
45
|
+
this.logger.error(`Failed to unlink post ${postId} from event ${eventId}`, error);
|
|
46
|
+
throw DATABASE_ERROR('unlinking post from event', error.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async getEventRelatedToPost(postId) {
|
|
50
|
+
try {
|
|
51
|
+
return await this.repository.getEventRelatedToPost(postId);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (isBaseError(error))
|
|
55
|
+
throw error;
|
|
56
|
+
this.logger.error(`Failed to get event for post: ${postId}`, error);
|
|
57
|
+
throw DATABASE_ERROR('fetching event related to post', error.message);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async getEventPosts(eventId, pagination) {
|
|
61
|
+
try {
|
|
62
|
+
return await this.repository.getEventPosts(eventId, pagination);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (isBaseError(error))
|
|
66
|
+
throw error;
|
|
67
|
+
this.logger.error(`Failed to get posts for event: ${eventId}`, error);
|
|
68
|
+
throw DATABASE_ERROR('fetching event posts', error.message);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
EventPostLinkService = EventPostLinkService_1 = __decorate([
|
|
73
|
+
Injectable(),
|
|
74
|
+
__param(0, Inject(Neo4jEventPostLinkRepository)),
|
|
75
|
+
__metadata("design:paramtypes", [Object])
|
|
76
|
+
], EventPostLinkService);
|
|
77
|
+
export { EventPostLinkService };
|
|
78
|
+
//# sourceMappingURL=event-post-link.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-post-link.service.js","sourceRoot":"","sources":["../../src/services/event-post-link.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AAK5F,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAKZ;IAJF,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,sBAAoB,CAAC,IAAI,EAAE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qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,WAAW,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,MAAM,EAAE,EAAE,KAAc,CAAC,CAAC;YAC7E,MAAM,cAAc,CAAC,gCAAgC,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAe,EAAE,UAA6B;QAChE,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,WAAW,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,OAAO,EAAE,EAAE,KAAc,CAAC,CAAC;YAC/E,MAAM,cAAc,CAAC,sBAAsB,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CACF,CAAA;AAjDY,oBAAoB;IADhC,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,4BAA4B,CAAC,CAAA;;GAJ5B,oBAAoB,CAiDhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './social-user.service.js';
|
|
2
|
+
export * from './relationship.service.js';
|
|
3
|
+
export * from './publication.service.js';
|
|
4
|
+
export * from './interaction.service.js';
|
|
5
|
+
export * from './participation.service.js';
|
|
6
|
+
export * from './event-post-link.service.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './social-user.service.js';
|
|
2
|
+
export * from './relationship.service.js';
|
|
3
|
+
export * from './publication.service.js';
|
|
4
|
+
export * from './interaction.service.js';
|
|
5
|
+
export * from './participation.service.js';
|
|
6
|
+
export * from './event-post-link.service.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PaginationRequest } from '@volontariapp/contracts';
|
|
2
|
+
import type { IInteractionRepository } from '../repositories/interfaces/interaction.repository.js';
|
|
3
|
+
import type { PaginatedIds } from '../entities/paginated-ids.entity.js';
|
|
4
|
+
export declare class InteractionService {
|
|
5
|
+
private readonly repository;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(repository: IInteractionRepository);
|
|
8
|
+
likePost(userId: string, postId: string): Promise<void>;
|
|
9
|
+
unlikePost(userId: string, postId: string): Promise<void>;
|
|
10
|
+
getUserLikes(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
11
|
+
getPostLikers(postId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=interaction.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.service.d.ts","sourceRoot":"","sources":["../../src/services/interaction.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBACa,kBAAkB;IAK3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoD;gBAIxD,UAAU,EAAE,sBAAsB;IAG/C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzD,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAUlF,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;CAS1F"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var InteractionService_1;
|
|
14
|
+
import { Injectable, Inject } from '@nestjs/common';
|
|
15
|
+
import { Logger } from '@volontariapp/logger';
|
|
16
|
+
import { DATABASE_ERROR } from '@volontariapp/errors-nest';
|
|
17
|
+
import { isBaseError } from '@volontariapp/errors';
|
|
18
|
+
import { Neo4jInteractionRepository } from '../repositories/neo4j-interaction.repository.js';
|
|
19
|
+
let InteractionService = InteractionService_1 = class InteractionService {
|
|
20
|
+
repository;
|
|
21
|
+
logger = new Logger({ context: InteractionService_1.name });
|
|
22
|
+
constructor(repository) {
|
|
23
|
+
this.repository = repository;
|
|
24
|
+
}
|
|
25
|
+
async likePost(userId, postId) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log(`Creating like: user ${userId} -> post ${postId}`);
|
|
28
|
+
await this.repository.createLike(userId, postId);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (isBaseError(error))
|
|
32
|
+
throw error;
|
|
33
|
+
this.logger.error(`Failed to create like: ${userId} -> ${postId}`, error);
|
|
34
|
+
throw DATABASE_ERROR('creating like relationship', error.message);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async unlikePost(userId, postId) {
|
|
38
|
+
try {
|
|
39
|
+
this.logger.log(`Deleting like: user ${userId} -> post ${postId}`);
|
|
40
|
+
await this.repository.deleteLike(userId, postId);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (isBaseError(error))
|
|
44
|
+
throw error;
|
|
45
|
+
this.logger.error(`Failed to delete like: ${userId} -> ${postId}`, error);
|
|
46
|
+
throw DATABASE_ERROR('deleting like relationship', error.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async getUserLikes(userId, pagination) {
|
|
50
|
+
try {
|
|
51
|
+
return await this.repository.getUserLikes(userId, pagination);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (isBaseError(error))
|
|
55
|
+
throw error;
|
|
56
|
+
this.logger.error(`Failed to get likes for user: ${userId}`, error);
|
|
57
|
+
throw DATABASE_ERROR('fetching user likes', error.message);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async getPostLikers(postId, pagination) {
|
|
61
|
+
try {
|
|
62
|
+
return await this.repository.getPostLikers(postId, pagination);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (isBaseError(error))
|
|
66
|
+
throw error;
|
|
67
|
+
this.logger.error(`Failed to get likers for post: ${postId}`, error);
|
|
68
|
+
throw DATABASE_ERROR('fetching post likers', error.message);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
InteractionService = InteractionService_1 = __decorate([
|
|
73
|
+
Injectable(),
|
|
74
|
+
__param(0, Inject(Neo4jInteractionRepository)),
|
|
75
|
+
__metadata("design:paramtypes", [Object])
|
|
76
|
+
], InteractionService);
|
|
77
|
+
export { InteractionService };
|
|
78
|
+
//# sourceMappingURL=interaction.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.service.js","sourceRoot":"","sources":["../../src/services/interaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAKtF,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAKV;IAJF,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,oBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;IA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AAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,WAAW,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,MAAM,EAAE,EAAE,KAAc,CAAC,CAAC;YAC7E,MAAM,cAAc,CAAC,qBAAqB,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAc,EAAE,UAA6B;QAC/D,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,WAAW,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,MAAM,EAAE,EAAE,KAAc,CAAC,CAAC;YAC9E,MAAM,cAAc,CAAC,sBAAsB,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CACF,CAAA;AAjDY,kBAAkB;IAD9B,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,0BAA0B,CAAC,CAAA;;GAJ1B,kBAAkB,CAiD9B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PaginationRequest } from '@volontariapp/contracts';
|
|
2
|
+
import type { IParticipationRepository } from '../repositories/interfaces/participation.repository.js';
|
|
3
|
+
import type { PaginatedIds } from '../entities/paginated-ids.entity.js';
|
|
4
|
+
export declare class ParticipationService {
|
|
5
|
+
private readonly repository;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(repository: IParticipationRepository);
|
|
8
|
+
createEvent(eventId: string): Promise<void>;
|
|
9
|
+
deleteEvent(eventId: string): Promise<void>;
|
|
10
|
+
getEventExists(eventId: string): Promise<boolean>;
|
|
11
|
+
setEventCreator(userId: string, eventId: string): Promise<void>;
|
|
12
|
+
removeEventCreator(userId: string, eventId: string): Promise<void>;
|
|
13
|
+
participateEvent(userId: string, eventId: string): Promise<void>;
|
|
14
|
+
leaveEvent(userId: string, eventId: string): Promise<void>;
|
|
15
|
+
getUserEvents(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
16
|
+
getUserParticipations(userId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
17
|
+
getEventParticipants(eventId: string, pagination: PaginationRequest): Promise<PaginatedIds>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=participation.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participation.service.d.ts","sourceRoot":"","sources":["../../src/services/participation.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBACa,oBAAoB;IAK7B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;gBAI1D,UAAU,EAAE,wBAAwB;IAGjD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3C,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjD,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW/D,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW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