@optimatech88/titomeet-shared-lib 1.0.4 → 1.0.5

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.
Files changed (69) hide show
  1. package/.github/workflows/npm-publish.yml +34 -34
  2. package/.prettierrc +4 -4
  3. package/dist/auth/auth.guard.d.ts +17 -0
  4. package/dist/auth/auth.guard.d.ts.map +1 -0
  5. package/dist/auth/auth.guard.js +89 -0
  6. package/dist/auth/auth.guard.js.map +1 -0
  7. package/dist/auth/auth.module.d.ts +9 -0
  8. package/dist/auth/auth.module.d.ts.map +1 -0
  9. package/dist/auth/auth.module.js +32 -0
  10. package/dist/auth/auth.module.js.map +1 -0
  11. package/dist/cache/cache.module.d.ts +5 -0
  12. package/dist/cache/cache.module.d.ts.map +1 -0
  13. package/dist/cache/cache.module.js +41 -0
  14. package/dist/cache/cache.module.js.map +1 -0
  15. package/dist/cache/cache.service.d.ts +9 -0
  16. package/dist/cache/cache.service.d.ts.map +1 -0
  17. package/dist/cache/cache.service.js +38 -0
  18. package/dist/cache/cache.service.js.map +1 -0
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +38 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/prisma/prisma.module.d.ts +3 -0
  24. package/dist/prisma/prisma.module.d.ts.map +1 -0
  25. package/dist/prisma/prisma.module.js +22 -0
  26. package/dist/prisma/prisma.module.js.map +1 -0
  27. package/dist/prisma/prisma.service.d.ts +7 -0
  28. package/dist/prisma/prisma.service.d.ts.map +1 -0
  29. package/dist/prisma/prisma.service.js +24 -0
  30. package/dist/prisma/prisma.service.js.map +1 -0
  31. package/dist/prisma/prisma.service.spec.d.ts +2 -0
  32. package/dist/prisma/prisma.service.spec.d.ts.map +1 -0
  33. package/dist/prisma/prisma.service.spec.js +17 -0
  34. package/dist/prisma/prisma.service.spec.js.map +1 -0
  35. package/dist/types/index.d.ts +12 -0
  36. package/dist/types/index.d.ts.map +1 -0
  37. package/dist/types/index.js +3 -0
  38. package/dist/types/index.js.map +1 -0
  39. package/dist/utils/api/endpoints.d.ts +7 -0
  40. package/dist/utils/api/endpoints.d.ts.map +1 -0
  41. package/dist/utils/api/endpoints.js +10 -0
  42. package/dist/utils/api/endpoints.js.map +1 -0
  43. package/dist/utils/constants.d.ts +3 -0
  44. package/dist/utils/constants.d.ts.map +1 -0
  45. package/dist/utils/constants.js +15 -0
  46. package/dist/utils/constants.js.map +1 -0
  47. package/dist/utils/events.d.ts +7 -0
  48. package/dist/utils/events.d.ts.map +1 -0
  49. package/dist/utils/events.js +10 -0
  50. package/dist/utils/events.js.map +1 -0
  51. package/dist/utils/index.d.ts +8 -0
  52. package/dist/utils/index.d.ts.map +1 -0
  53. package/dist/utils/index.js +14 -0
  54. package/dist/utils/index.js.map +1 -0
  55. package/package.json +1 -1
  56. package/prisma/schema.prisma +24 -0
  57. package/src/auth/auth.guard.ts +96 -96
  58. package/src/auth/auth.module.ts +24 -24
  59. package/src/cache/cache.module.ts +25 -25
  60. package/src/cache/cache.service.ts +19 -19
  61. package/src/index.ts +20 -20
  62. package/src/prisma/prisma.module.ts +9 -9
  63. package/src/prisma/prisma.service.ts +13 -13
  64. package/src/types/index.ts +12 -12
  65. package/src/utils/api/endpoints.ts +6 -6
  66. package/src/utils/constants.ts +13 -13
  67. package/src/utils/events.ts +7 -7
  68. package/src/utils/index.ts +11 -11
  69. package/tsconfig.json +24 -24
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;CAKzB,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOCKET_EVENTS = void 0;
4
+ exports.SOCKET_EVENTS = {
5
+ INBOX_OPENED: 'events.sockets.inboxOpened',
6
+ INBOX_CHANGED: 'events.sockets.inboxChanged',
7
+ NEW_MESSAGE: 'events.sockets.newMessage',
8
+ GET_UNREAD_MESSAGES_COUNT: 'events.sockets.getUnreadMessagesCount',
9
+ };
10
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,YAAY,EAAE,4BAA4B;IAC1C,aAAa,EAAE,6BAA6B;IAC5C,WAAW,EAAE,2BAA2B;IACxC,yBAAyB,EAAE,uCAAuC;CACrE,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { PaginationQuery } from "@/types";
2
+ export declare const getPaginationData: (query: PaginationQuery) => {
3
+ page: number;
4
+ skip: number;
5
+ limit: number;
6
+ };
7
+ export declare const getUserChannel: (userId: string) => string;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,iBAAiB,UAAW,eAAe;;;;CAOvD,CAAC;AAEF,eAAO,MAAM,cAAc,WAAY,MAAM,WAA8B,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUserChannel = exports.getPaginationData = void 0;
4
+ const getPaginationData = (query) => {
5
+ const page = query.page;
6
+ const PAGE = parseInt(page, 10) || 1;
7
+ const LIMIT = Number(query.limit) || 10;
8
+ const SKIP = (PAGE - 1) * LIMIT;
9
+ return { page: PAGE, skip: SKIP, limit: LIMIT };
10
+ };
11
+ exports.getPaginationData = getPaginationData;
12
+ const getUserChannel = (userId) => `channels-user-${userId}`;
13
+ exports.getUserChannel = getUserChannel;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAc,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IAEhC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAClD,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B;AAEK,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,iBAAiB,MAAM,EAAE,CAAC;AAA/D,QAAA,cAAc,kBAAiD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimatech88/titomeet-shared-lib",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -29,6 +29,8 @@ model User {
29
29
  password String?
30
30
  role UserRole @default(USER)
31
31
 
32
+ profilePicture String?
33
+
32
34
  createdAt DateTime @default(now())
33
35
  updatedAt DateTime @updatedAt
34
36
 
@@ -36,6 +38,8 @@ model User {
36
38
  messages Message[]
37
39
  events Event[]
38
40
  participatedEvents Participant[]
41
+ notificationsReceived Notification[] @relation("NotificationRecipient")
42
+ notificationsSent Notification[] @relation("NotificationSender")
39
43
  }
40
44
 
41
45
  model Account {
@@ -49,6 +53,7 @@ model Account {
49
53
  model Address {
50
54
  id String @id @default(uuid())
51
55
  name String
56
+ line2 String?
52
57
  city String
53
58
  state String
54
59
  country String
@@ -162,3 +167,22 @@ enum ParticipantStatus {
162
167
  CANCELLED
163
168
  }
164
169
 
170
+ enum NotificationType {
171
+ NEW_MESSAGE
172
+ EVENT_REMINDER
173
+ EVENT_PARTICIPATION_CONFIRMATION
174
+ }
175
+
176
+ model Notification {
177
+ id String @id @default(cuid())
178
+ notifiedTo User @relation("NotificationRecipient", fields: [notifiedToId], references: [id])
179
+ notifiedToId String
180
+ user User? @relation("NotificationSender", fields: [userId], references: [id])
181
+ userId String?
182
+ type NotificationType
183
+ read Boolean @default(false)
184
+ data Json?
185
+
186
+ createdAt DateTime @default(now())
187
+ updatedAt DateTime @updatedAt
188
+ }
@@ -1,96 +1,96 @@
1
- import {
2
- CanActivate,
3
- ExecutionContext,
4
- Injectable,
5
- UnauthorizedException,
6
- } from '@nestjs/common';
7
- import { JwtService } from '@nestjs/jwt';
8
- import { PrismaClient } from '@prisma/client';
9
- import { Request } from 'express';
10
- import { IncomingHttpHeaders } from 'http';
11
-
12
- @Injectable()
13
- export class AuthGuard implements CanActivate {
14
- private prisma: PrismaClient;
15
-
16
- constructor(
17
- private jwtService: JwtService,
18
- ) {
19
- this.prisma = new PrismaClient();
20
- }
21
-
22
- async canActivate(context: ExecutionContext): Promise<boolean> {
23
- const request = context.switchToHttp().getRequest();
24
- const token = this.extractTokenFromHeader(request);
25
- if (!token) {
26
- throw new UnauthorizedException();
27
- }
28
- try {
29
- const payload = (await this.jwtService.verifyAsync(token)) as {
30
- userId: string;
31
- };
32
-
33
- const user = await this.prisma.user.findUnique({
34
- where: { id: payload.userId }
35
- });
36
-
37
- if (!user) {
38
- throw new UnauthorizedException();
39
- }
40
-
41
- request['user'] = user;
42
- } catch {
43
- throw new UnauthorizedException();
44
- }
45
- return true;
46
- }
47
-
48
- private extractTokenFromHeader(request: Request & { headers: IncomingHttpHeaders }): string | undefined {
49
- const [type, token] = request.headers.authorization?.split(' ') ?? [];
50
- return type === 'Bearer' ? token : undefined;
51
- }
52
- }
53
-
54
- @Injectable()
55
- export class OptionalAuthGuard implements CanActivate {
56
- private prisma: PrismaClient;
57
-
58
- constructor(
59
- private jwtService: JwtService,
60
- ) {
61
- this.prisma = new PrismaClient();
62
- }
63
-
64
- async canActivate(context: ExecutionContext): Promise<boolean> {
65
- const request = context.switchToHttp().getRequest();
66
- const token = this.extractTokenFromHeader(request);
67
- if (!token) {
68
- return true;
69
- }
70
- try {
71
- const payload = (await this.jwtService.verifyAsync(token)) as {
72
- userId: string;
73
- };
74
-
75
- const user = await this.prisma.user.findUnique({
76
- where: { id: payload.userId }
77
- });
78
-
79
- if (!user) {
80
- throw new UnauthorizedException();
81
- }
82
-
83
- request['user'] = user;
84
-
85
- // Continue without setting user
86
- } catch {
87
- // Continue without setting user
88
- }
89
- return true;
90
- }
91
-
92
- private extractTokenFromHeader(request: Request & { headers: IncomingHttpHeaders }): string | undefined {
93
- const [type, token] = request.headers.authorization?.split(' ') ?? [];
94
- return type === 'Bearer' ? token : undefined;
95
- }
96
- }
1
+ import {
2
+ CanActivate,
3
+ ExecutionContext,
4
+ Injectable,
5
+ UnauthorizedException,
6
+ } from '@nestjs/common';
7
+ import { JwtService } from '@nestjs/jwt';
8
+ import { PrismaClient } from '@prisma/client';
9
+ import { Request } from 'express';
10
+ import { IncomingHttpHeaders } from 'http';
11
+
12
+ @Injectable()
13
+ export class AuthGuard implements CanActivate {
14
+ private prisma: PrismaClient;
15
+
16
+ constructor(
17
+ private jwtService: JwtService,
18
+ ) {
19
+ this.prisma = new PrismaClient();
20
+ }
21
+
22
+ async canActivate(context: ExecutionContext): Promise<boolean> {
23
+ const request = context.switchToHttp().getRequest();
24
+ const token = this.extractTokenFromHeader(request);
25
+ if (!token) {
26
+ throw new UnauthorizedException();
27
+ }
28
+ try {
29
+ const payload = (await this.jwtService.verifyAsync(token)) as {
30
+ userId: string;
31
+ };
32
+
33
+ const user = await this.prisma.user.findUnique({
34
+ where: { id: payload.userId }
35
+ });
36
+
37
+ if (!user) {
38
+ throw new UnauthorizedException();
39
+ }
40
+
41
+ request['user'] = user;
42
+ } catch {
43
+ throw new UnauthorizedException();
44
+ }
45
+ return true;
46
+ }
47
+
48
+ private extractTokenFromHeader(request: Request & { headers: IncomingHttpHeaders }): string | undefined {
49
+ const [type, token] = request.headers.authorization?.split(' ') ?? [];
50
+ return type === 'Bearer' ? token : undefined;
51
+ }
52
+ }
53
+
54
+ @Injectable()
55
+ export class OptionalAuthGuard implements CanActivate {
56
+ private prisma: PrismaClient;
57
+
58
+ constructor(
59
+ private jwtService: JwtService,
60
+ ) {
61
+ this.prisma = new PrismaClient();
62
+ }
63
+
64
+ async canActivate(context: ExecutionContext): Promise<boolean> {
65
+ const request = context.switchToHttp().getRequest();
66
+ const token = this.extractTokenFromHeader(request);
67
+ if (!token) {
68
+ return true;
69
+ }
70
+ try {
71
+ const payload = (await this.jwtService.verifyAsync(token)) as {
72
+ userId: string;
73
+ };
74
+
75
+ const user = await this.prisma.user.findUnique({
76
+ where: { id: payload.userId }
77
+ });
78
+
79
+ if (!user) {
80
+ throw new UnauthorizedException();
81
+ }
82
+
83
+ request['user'] = user;
84
+
85
+ // Continue without setting user
86
+ } catch {
87
+ // Continue without setting user
88
+ }
89
+ return true;
90
+ }
91
+
92
+ private extractTokenFromHeader(request: Request & { headers: IncomingHttpHeaders }): string | undefined {
93
+ const [type, token] = request.headers.authorization?.split(' ') ?? [];
94
+ return type === 'Bearer' ? token : undefined;
95
+ }
96
+ }
@@ -1,24 +1,24 @@
1
- import { Module, DynamicModule, Global } from '@nestjs/common';
2
- import { JwtModule } from '@nestjs/jwt';
3
-
4
- export interface AuthModuleOptions {
5
- jwtSecret: string;
6
- jwtExpiresIn?: string | number;
7
- }
8
-
9
- @Global()
10
- @Module({})
11
- export class AuthModule {
12
- static forRoot(options: AuthModuleOptions): DynamicModule {
13
- return {
14
- module: AuthModule,
15
- imports: [
16
- JwtModule.register({
17
- secret: options.jwtSecret,
18
- signOptions: { expiresIn: options.jwtExpiresIn || '7d' },
19
- }),
20
- ],
21
- exports: [JwtModule],
22
- };
23
- }
24
- }
1
+ import { Module, DynamicModule, Global } from '@nestjs/common';
2
+ import { JwtModule } from '@nestjs/jwt';
3
+
4
+ export interface AuthModuleOptions {
5
+ jwtSecret: string;
6
+ jwtExpiresIn?: string | number;
7
+ }
8
+
9
+ @Global()
10
+ @Module({})
11
+ export class AuthModule {
12
+ static forRoot(options: AuthModuleOptions): DynamicModule {
13
+ return {
14
+ module: AuthModule,
15
+ imports: [
16
+ JwtModule.register({
17
+ secret: options.jwtSecret,
18
+ signOptions: { expiresIn: options.jwtExpiresIn || '7d' },
19
+ }),
20
+ ],
21
+ exports: [JwtModule],
22
+ };
23
+ }
24
+ }
@@ -1,25 +1,25 @@
1
- import { Module, DynamicModule, Global } from '@nestjs/common';
2
- import { Cacheable } from 'cacheable';
3
- import { CacheService } from './cache.service';
4
- import KeyvRedis from '@keyv/redis';
5
-
6
- @Global()
7
- @Module({})
8
- export class CacheModule {
9
- static forRoot(redisUrl: string): DynamicModule {
10
- return {
11
- module: CacheModule,
12
- providers: [
13
- {
14
- provide: 'CACHE_INSTANCE',
15
- useFactory: () => {
16
- const secondary = new KeyvRedis(redisUrl);
17
- return new Cacheable({ secondary, ttl: '1h' });
18
- },
19
- },
20
- CacheService,
21
- ],
22
- exports: ['CACHE_INSTANCE', CacheService],
23
- };
24
- }
25
- }
1
+ import { Module, DynamicModule, Global } from '@nestjs/common';
2
+ import { Cacheable } from 'cacheable';
3
+ import { CacheService } from './cache.service';
4
+ import KeyvRedis from '@keyv/redis';
5
+
6
+ @Global()
7
+ @Module({})
8
+ export class CacheModule {
9
+ static forRoot(redisUrl: string): DynamicModule {
10
+ return {
11
+ module: CacheModule,
12
+ providers: [
13
+ {
14
+ provide: 'CACHE_INSTANCE',
15
+ useFactory: () => {
16
+ const secondary = new KeyvRedis(redisUrl);
17
+ return new Cacheable({ secondary, ttl: '1h' });
18
+ },
19
+ },
20
+ CacheService,
21
+ ],
22
+ exports: ['CACHE_INSTANCE', CacheService],
23
+ };
24
+ }
25
+ }
@@ -1,19 +1,19 @@
1
- import { Inject, Injectable } from '@nestjs/common';
2
- import { Cacheable } from 'cacheable';
3
-
4
- @Injectable()
5
- export class CacheService<T> {
6
- constructor(@Inject('CACHE_INSTANCE') private readonly cache: Cacheable) {}
7
-
8
- async get<T>(key: string): Promise<T> {
9
- return await this.cache.get(key);
10
- }
11
-
12
- async set(key: string, value: T, ttl?: number | string): Promise<void> {
13
- await this.cache.set(key, value, ttl);
14
- }
15
-
16
- async delete(key: string): Promise<void> {
17
- await this.cache.delete(key);
18
- }
19
- }
1
+ import { Inject, Injectable } from '@nestjs/common';
2
+ import { Cacheable } from 'cacheable';
3
+
4
+ @Injectable()
5
+ export class CacheService<T> {
6
+ constructor(@Inject('CACHE_INSTANCE') private readonly cache: Cacheable) {}
7
+
8
+ async get<T>(key: string): Promise<T> {
9
+ return await this.cache.get(key);
10
+ }
11
+
12
+ async set(key: string, value: T, ttl?: number | string): Promise<void> {
13
+ await this.cache.set(key, value, ttl);
14
+ }
15
+
16
+ async delete(key: string): Promise<void> {
17
+ await this.cache.delete(key);
18
+ }
19
+ }
package/src/index.ts CHANGED
@@ -1,21 +1,21 @@
1
- export * from './auth/auth.guard';
2
- export { PrismaClient, User, Account, UserRole, Event, EventAccess, EventVisibility, EventStatus, EventPrice, Address, Participant, ParticipantStatus } from '@prisma/client';
3
-
4
- //auth
5
- export * from './auth/auth.guard';
6
- export * from './auth/auth.module';
7
-
8
- //cache
9
- export * from './cache/cache.module';
10
- export * from './cache/cache.service';
11
-
12
- //prisma
13
- export * from './prisma/prisma.module';
14
- export * from './prisma/prisma.service';
15
-
16
- export * from './types';
17
- export * from './utils';
18
- export * from './utils/api/endpoints';
19
- export * from './utils/events';
20
-
1
+ export * from './auth/auth.guard';
2
+ export { PrismaClient, User, Account, UserRole, Event, EventAccess, EventVisibility, EventStatus, EventPrice, Address, Participant, ParticipantStatus } from '@prisma/client';
3
+
4
+ //auth
5
+ export * from './auth/auth.guard';
6
+ export * from './auth/auth.module';
7
+
8
+ //cache
9
+ export * from './cache/cache.module';
10
+ export * from './cache/cache.service';
11
+
12
+ //prisma
13
+ export * from './prisma/prisma.module';
14
+ export * from './prisma/prisma.service';
15
+
16
+ export * from './types';
17
+ export * from './utils';
18
+ export * from './utils/api/endpoints';
19
+ export * from './utils/events';
20
+
21
21
  export { JwtService } from "@nestjs/jwt";
@@ -1,9 +1,9 @@
1
- import { Module, Global } from '@nestjs/common';
2
- import { PrismaService } from './prisma.service';
3
-
4
- @Global()
5
- @Module({
6
- providers: [PrismaService],
7
- exports: [PrismaService],
8
- })
9
- export class PrismaModule {}
1
+ import { Module, Global } from '@nestjs/common';
2
+ import { PrismaService } from './prisma.service';
3
+
4
+ @Global()
5
+ @Module({
6
+ providers: [PrismaService],
7
+ exports: [PrismaService],
8
+ })
9
+ export class PrismaModule {}
@@ -1,13 +1,13 @@
1
- import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
2
- import { PrismaClient } from '@prisma/client';
3
-
4
- @Injectable()
5
- export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
6
- async onModuleInit() {
7
- await this.$connect();
8
- }
9
-
10
- async onModuleDestroy() {
11
- await this.$disconnect();
12
- }
13
- }
1
+ import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
2
+ import { PrismaClient } from '@prisma/client';
3
+
4
+ @Injectable()
5
+ export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
6
+ async onModuleInit() {
7
+ await this.$connect();
8
+ }
9
+
10
+ async onModuleDestroy() {
11
+ await this.$disconnect();
12
+ }
13
+ }
@@ -1,12 +1,12 @@
1
- export interface PaginatedData<T> {
2
- items: T[];
3
- total: number;
4
- page: number;
5
- limit: number;
6
- totalPages: number;
7
- }
8
-
9
- export interface PaginationQuery {
10
- page?: string;
11
- limit?: string;
12
- }
1
+ export interface PaginatedData<T> {
2
+ items: T[];
3
+ total: number;
4
+ page: number;
5
+ limit: number;
6
+ totalPages: number;
7
+ }
8
+
9
+ export interface PaginationQuery {
10
+ page?: string;
11
+ limit?: string;
12
+ }
@@ -1,7 +1,7 @@
1
- export const CHAT_API_URL: string = "api/chats"
2
- export const PROPERTIES_API_URL: string = "api/properties"
3
-
4
- export const API_ENDPOINTS = {
5
- CHAT: 'api/chats',
6
- PROPERTIES_API_URL: 'api/properties',
1
+ export const CHAT_API_URL: string = "api/chats"
2
+ export const PROPERTIES_API_URL: string = "api/properties"
3
+
4
+ export const API_ENDPOINTS = {
5
+ CHAT: 'api/chats',
6
+ PROPERTIES_API_URL: 'api/properties',
7
7
  }
@@ -1,13 +1,13 @@
1
- export const DEFAULT_AVATAR_IMAGE =
2
- 'https://immob-bucket-2.s3.us-east-2.amazonaws.com/pictures/images.png';
3
-
4
- export const TEMPORARY_EMAIL_DOMAINS = [
5
- '10minutemail.com',
6
- 'guerrillamail.com',
7
- 'mailinator.com',
8
- 'dispostable.com',
9
- 'yopmail.com',
10
- 'trashmail.com',
11
- 'tempmail.com',
12
- 'temp-mail.org',
13
- ];
1
+ export const DEFAULT_AVATAR_IMAGE =
2
+ 'https://immob-bucket-2.s3.us-east-2.amazonaws.com/pictures/images.png';
3
+
4
+ export const TEMPORARY_EMAIL_DOMAINS = [
5
+ '10minutemail.com',
6
+ 'guerrillamail.com',
7
+ 'mailinator.com',
8
+ 'dispostable.com',
9
+ 'yopmail.com',
10
+ 'trashmail.com',
11
+ 'tempmail.com',
12
+ 'temp-mail.org',
13
+ ];
@@ -1,7 +1,7 @@
1
- export const SOCKET_EVENTS = {
2
- INBOX_OPENED: 'events.sockets.inboxOpened',
3
- INBOX_CHANGED: 'events.sockets.inboxChanged',
4
- NEW_MESSAGE: 'events.sockets.newMessage',
5
- GET_UNREAD_MESSAGES_COUNT: 'events.sockets.getUnreadMessagesCount',
6
- }
7
-
1
+ export const SOCKET_EVENTS = {
2
+ INBOX_OPENED: 'events.sockets.inboxOpened',
3
+ INBOX_CHANGED: 'events.sockets.inboxChanged',
4
+ NEW_MESSAGE: 'events.sockets.newMessage',
5
+ GET_UNREAD_MESSAGES_COUNT: 'events.sockets.getUnreadMessagesCount',
6
+ }
7
+
@@ -1,12 +1,12 @@
1
- import { PaginationQuery } from "@/types";
2
-
3
- export const getPaginationData = (query: PaginationQuery) => {
4
- const page = query.page as string;
5
- const PAGE = parseInt(page, 10) || 1;
6
- const LIMIT = Number(query.limit) || 10;
7
- const SKIP = (PAGE - 1) * LIMIT;
8
-
9
- return { page: PAGE, skip: SKIP, limit: LIMIT };
10
- };
11
-
1
+ import { PaginationQuery } from "@/types";
2
+
3
+ export const getPaginationData = (query: PaginationQuery) => {
4
+ const page = query.page as string;
5
+ const PAGE = parseInt(page, 10) || 1;
6
+ const LIMIT = Number(query.limit) || 10;
7
+ const SKIP = (PAGE - 1) * LIMIT;
8
+
9
+ return { page: PAGE, skip: SKIP, limit: LIMIT };
10
+ };
11
+
12
12
  export const getUserChannel = (userId: string) => `channels-user-${userId}`;