@optimatech88/titomeet-shared-lib 1.0.5 → 1.0.7

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 (70) hide show
  1. package/.github/workflows/npm-publish.yml +34 -34
  2. package/.prettierrc +4 -4
  3. package/package.json +4 -2
  4. package/prisma/schema.prisma +38 -0
  5. package/src/auth/admin.middleware.ts +20 -0
  6. package/src/auth/auth.guard.ts +98 -96
  7. package/src/auth/auth.module.ts +24 -24
  8. package/src/cache/cache.module.ts +25 -25
  9. package/src/cache/cache.service.ts +19 -19
  10. package/src/index.ts +29 -20
  11. package/src/prisma/prisma.module.ts +9 -9
  12. package/src/prisma/prisma.service.ts +13 -13
  13. package/src/types/index.ts +12 -12
  14. package/src/utils/api/endpoints.ts +6 -6
  15. package/src/utils/constants.ts +13 -13
  16. package/src/utils/events.ts +7 -7
  17. package/src/utils/index.ts +11 -11
  18. package/tsconfig.json +24 -24
  19. package/dist/auth/auth.guard.d.ts +0 -17
  20. package/dist/auth/auth.guard.d.ts.map +0 -1
  21. package/dist/auth/auth.guard.js +0 -89
  22. package/dist/auth/auth.guard.js.map +0 -1
  23. package/dist/auth/auth.module.d.ts +0 -9
  24. package/dist/auth/auth.module.d.ts.map +0 -1
  25. package/dist/auth/auth.module.js +0 -32
  26. package/dist/auth/auth.module.js.map +0 -1
  27. package/dist/cache/cache.module.d.ts +0 -5
  28. package/dist/cache/cache.module.d.ts.map +0 -1
  29. package/dist/cache/cache.module.js +0 -41
  30. package/dist/cache/cache.module.js.map +0 -1
  31. package/dist/cache/cache.service.d.ts +0 -9
  32. package/dist/cache/cache.service.d.ts.map +0 -1
  33. package/dist/cache/cache.service.js +0 -38
  34. package/dist/cache/cache.service.js.map +0 -1
  35. package/dist/index.d.ts +0 -14
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/index.js +0 -38
  38. package/dist/index.js.map +0 -1
  39. package/dist/prisma/prisma.module.d.ts +0 -3
  40. package/dist/prisma/prisma.module.d.ts.map +0 -1
  41. package/dist/prisma/prisma.module.js +0 -22
  42. package/dist/prisma/prisma.module.js.map +0 -1
  43. package/dist/prisma/prisma.service.d.ts +0 -7
  44. package/dist/prisma/prisma.service.d.ts.map +0 -1
  45. package/dist/prisma/prisma.service.js +0 -24
  46. package/dist/prisma/prisma.service.js.map +0 -1
  47. package/dist/prisma/prisma.service.spec.d.ts +0 -2
  48. package/dist/prisma/prisma.service.spec.d.ts.map +0 -1
  49. package/dist/prisma/prisma.service.spec.js +0 -17
  50. package/dist/prisma/prisma.service.spec.js.map +0 -1
  51. package/dist/types/index.d.ts +0 -12
  52. package/dist/types/index.d.ts.map +0 -1
  53. package/dist/types/index.js +0 -3
  54. package/dist/types/index.js.map +0 -1
  55. package/dist/utils/api/endpoints.d.ts +0 -7
  56. package/dist/utils/api/endpoints.d.ts.map +0 -1
  57. package/dist/utils/api/endpoints.js +0 -10
  58. package/dist/utils/api/endpoints.js.map +0 -1
  59. package/dist/utils/constants.d.ts +0 -3
  60. package/dist/utils/constants.d.ts.map +0 -1
  61. package/dist/utils/constants.js +0 -15
  62. package/dist/utils/constants.js.map +0 -1
  63. package/dist/utils/events.d.ts +0 -7
  64. package/dist/utils/events.d.ts.map +0 -1
  65. package/dist/utils/events.js +0 -10
  66. package/dist/utils/events.js.map +0 -1
  67. package/dist/utils/index.d.ts +0 -8
  68. package/dist/utils/index.d.ts.map +0 -1
  69. package/dist/utils/index.js +0 -14
  70. package/dist/utils/index.js.map +0 -1
@@ -1,34 +1,34 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- push:
8
- branches:
9
- - main # Or your main branch
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v4
17
- with:
18
- node-version: 20
19
- - run: npm ci
20
- #- run: npm test
21
-
22
- publish-npm:
23
- needs: build
24
- runs-on: ubuntu-latest
25
- steps:
26
- - uses: actions/checkout@v4
27
- - uses: actions/setup-node@v4
28
- with:
29
- node-version: 20
30
- registry-url: https://registry.npmjs.org/
31
- - run: npm ci
32
- - run: npm publish
33
- env:
34
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - main # Or your main branch
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: 20
19
+ - run: npm ci
20
+ - run: npm run build
21
+
22
+ publish-npm:
23
+ needs: build
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: actions/setup-node@v4
28
+ with:
29
+ node-version: 20
30
+ registry-url: https://registry.npmjs.org/
31
+ - run: npm ci
32
+ - run: npm publish --access public
33
+ env:
34
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/.prettierrc CHANGED
@@ -1,5 +1,5 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "endOfLine":"auto"
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all",
4
+ "endOfLine":"auto"
5
5
  }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@optimatech88/titomeet-shared-lib",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
8
  "build": "nest build",
9
- "format": "prettier --write \"src/**/*.ts\""
9
+ "format": "prettier --write \"src/**/*.ts\"",
10
+ "generate": "npx prisma generate"
10
11
  },
11
12
  "keywords": [],
12
13
  "author": "",
@@ -31,6 +32,7 @@
31
32
  "nestjs-seeder": "^0.3.2"
32
33
  },
33
34
  "devDependencies": {
35
+ "@nestjs/cli": "^11.0.5",
34
36
  "@types/express": "^4.17.21",
35
37
  "@types/node": "^22.2.0",
36
38
  "prettier": "^3.3.3",
@@ -40,6 +40,7 @@ model User {
40
40
  participatedEvents Participant[]
41
41
  notificationsReceived Notification[] @relation("NotificationRecipient")
42
42
  notificationsSent Notification[] @relation("NotificationSender")
43
+ providers Provider[]
43
44
  }
44
45
 
45
46
  model Account {
@@ -79,6 +80,16 @@ enum EventStatus {
79
80
  PUBLISHED
80
81
  }
81
82
 
83
+ model EventCategory {
84
+ id String @id @default(cuid())
85
+ name String
86
+ description String?
87
+ events Event[]
88
+
89
+ createdAt DateTime @default(now())
90
+ updatedAt DateTime @updatedAt
91
+ }
92
+
82
93
  model Event {
83
94
  id String @id @default(cuid())
84
95
  name String
@@ -98,6 +109,8 @@ model Event {
98
109
  chat Chat? // Optional one-to-one relation
99
110
  status EventStatus @default(DRAFT)
100
111
 
112
+ categories EventCategory[]
113
+
101
114
  address Address @relation(fields: [addressId], references: [id])
102
115
  addressId String
103
116
 
@@ -107,6 +120,8 @@ model Event {
107
120
  // Add participants relation
108
121
  participants Participant[]
109
122
 
123
+ providers Provider[]
124
+
110
125
  createdAt DateTime @default(now())
111
126
  updatedAt DateTime @updatedAt
112
127
  }
@@ -183,6 +198,29 @@ model Notification {
183
198
  read Boolean @default(false)
184
199
  data Json?
185
200
 
201
+ createdAt DateTime @default(now())
202
+ updatedAt DateTime @updatedAt
203
+ }
204
+
205
+ enum ProviderStatus {
206
+ PENDING
207
+ APPROVED
208
+ REJECTED
209
+ }
210
+
211
+ model Provider {
212
+ id String @id @default(cuid())
213
+ name String
214
+ description String?
215
+ image String?
216
+
217
+ user User @relation(fields: [userId], references: [id])
218
+ userId String
219
+
220
+ events Event[]
221
+
222
+ status ProviderStatus @default(PENDING)
223
+
186
224
  createdAt DateTime @default(now())
187
225
  updatedAt DateTime @updatedAt
188
226
  }
@@ -0,0 +1,20 @@
1
+ import { Injectable, NestMiddleware, UnauthorizedException } from '@nestjs/common';
2
+ import { Request, Response, NextFunction } from 'express';
3
+ import { UserRole, User } from '@prisma/client';
4
+
5
+ interface RequestWithUser extends Request {
6
+ user?: User;
7
+ }
8
+
9
+ @Injectable()
10
+ export class AdminMiddleware implements NestMiddleware {
11
+ use(req: RequestWithUser, res: Response, next: NextFunction) {
12
+ const user = req.user;
13
+
14
+ if (!user || !user.role?.includes(UserRole.ADMIN)) {
15
+ throw new UnauthorizedException('Access denied. Admins only.');
16
+ }
17
+
18
+ next();
19
+ }
20
+ }
@@ -1,96 +1,98 @@
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
+ //optional auth guard
55
+ @Injectable()
56
+ export class OptionalAuthGuard implements CanActivate {
57
+ private prisma: PrismaClient;
58
+
59
+ constructor(
60
+ private jwtService: JwtService,
61
+ ) {
62
+ this.prisma = new PrismaClient();
63
+ }
64
+
65
+ async canActivate(context: ExecutionContext): Promise<boolean> {
66
+ const request = context.switchToHttp().getRequest();
67
+ const token = this.extractTokenFromHeader(request);
68
+ if (!token) {
69
+ return true;
70
+ }
71
+ try {
72
+ const payload = (await this.jwtService.verifyAsync(token)) as {
73
+ userId: string;
74
+ };
75
+
76
+ const user = await this.prisma.user.findUnique({
77
+ where: { id: payload.userId }
78
+ });
79
+
80
+ if (!user) {
81
+ throw new UnauthorizedException();
82
+ }
83
+
84
+ request['user'] = user;
85
+
86
+ // Continue without setting user
87
+ } catch {
88
+ // Continue without setting user
89
+ }
90
+ return true;
91
+ }
92
+
93
+ private extractTokenFromHeader(request: Request & { headers: IncomingHttpHeaders }): string | undefined {
94
+ const [type, token] = request.headers.authorization?.split(' ') ?? [];
95
+ return type === 'Bearer' ? token : undefined;
96
+ }
97
+ }
98
+
@@ -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,30 @@
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 {
3
+ PrismaClient, User, Account,
4
+ UserRole, Event, EventAccess,
5
+ EventVisibility, EventStatus,
6
+ EventPrice, Address, Participant,
7
+ ParticipantStatus,
8
+ Provider,
9
+ ProviderStatus,
10
+ EventCategory
11
+ } from '@prisma/client';
12
+
13
+ //auth
14
+ export * from './auth/auth.guard';
15
+ export * from './auth/auth.module';
16
+
17
+ //cache
18
+ export * from './cache/cache.module';
19
+ export * from './cache/cache.service';
20
+
21
+ //prisma
22
+ export * from './prisma/prisma.module';
23
+ export * from './prisma/prisma.service';
24
+
25
+ export * from './types';
26
+ export * from './utils';
27
+ export * from './utils/api/endpoints';
28
+ export * from './utils/events';
29
+
21
30
  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
  }