@optimatech88/titomeet-shared-lib 1.0.7 → 1.0.9

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 (79) hide show
  1. package/.github/workflows/npm-publish.yml +34 -34
  2. package/.prettierrc +4 -4
  3. package/dist/auth/admin.middleware.d.ts +11 -0
  4. package/dist/auth/admin.middleware.d.ts.map +1 -0
  5. package/dist/auth/admin.middleware.js +26 -0
  6. package/dist/auth/admin.middleware.js.map +1 -0
  7. package/dist/auth/auth.guard.d.ts +17 -0
  8. package/dist/auth/auth.guard.d.ts.map +1 -0
  9. package/dist/auth/auth.guard.js +89 -0
  10. package/dist/auth/auth.guard.js.map +1 -0
  11. package/dist/auth/auth.module.d.ts +9 -0
  12. package/dist/auth/auth.module.d.ts.map +1 -0
  13. package/dist/auth/auth.module.js +32 -0
  14. package/dist/auth/auth.module.js.map +1 -0
  15. package/dist/cache/cache.module.d.ts +5 -0
  16. package/dist/cache/cache.module.d.ts.map +1 -0
  17. package/dist/cache/cache.module.js +41 -0
  18. package/dist/cache/cache.module.js.map +1 -0
  19. package/dist/cache/cache.service.d.ts +9 -0
  20. package/dist/cache/cache.service.d.ts.map +1 -0
  21. package/dist/cache/cache.service.js +38 -0
  22. package/dist/cache/cache.service.js.map +1 -0
  23. package/dist/index.d.ts +15 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +40 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/prisma/prisma.module.d.ts +3 -0
  28. package/dist/prisma/prisma.module.d.ts.map +1 -0
  29. package/dist/prisma/prisma.module.js +22 -0
  30. package/dist/prisma/prisma.module.js.map +1 -0
  31. package/dist/prisma/prisma.service.d.ts +7 -0
  32. package/dist/prisma/prisma.service.d.ts.map +1 -0
  33. package/dist/prisma/prisma.service.js +24 -0
  34. package/dist/prisma/prisma.service.js.map +1 -0
  35. package/dist/prisma/prisma.service.spec.d.ts +2 -0
  36. package/dist/prisma/prisma.service.spec.d.ts.map +1 -0
  37. package/dist/prisma/prisma.service.spec.js +17 -0
  38. package/dist/prisma/prisma.service.spec.js.map +1 -0
  39. package/dist/prisma/seed.d.ts +2 -0
  40. package/dist/prisma/seed.d.ts.map +1 -0
  41. package/dist/prisma/seed.js +73 -0
  42. package/dist/prisma/seed.js.map +1 -0
  43. package/dist/types/index.d.ts +12 -0
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/index.js +3 -0
  46. package/dist/types/index.js.map +1 -0
  47. package/dist/utils/api/endpoints.d.ts +7 -0
  48. package/dist/utils/api/endpoints.d.ts.map +1 -0
  49. package/dist/utils/api/endpoints.js +10 -0
  50. package/dist/utils/api/endpoints.js.map +1 -0
  51. package/dist/utils/constants.d.ts +3 -0
  52. package/dist/utils/constants.d.ts.map +1 -0
  53. package/dist/utils/constants.js +15 -0
  54. package/dist/utils/constants.js.map +1 -0
  55. package/dist/utils/events.d.ts +7 -0
  56. package/dist/utils/events.d.ts.map +1 -0
  57. package/dist/utils/events.js +10 -0
  58. package/dist/utils/events.js.map +1 -0
  59. package/dist/utils/index.d.ts +8 -0
  60. package/dist/utils/index.d.ts.map +1 -0
  61. package/dist/utils/index.js +14 -0
  62. package/dist/utils/index.js.map +1 -0
  63. package/package.json +1 -1
  64. package/prisma/schema.prisma +3 -1
  65. package/src/auth/admin.middleware.ts +20 -20
  66. package/src/auth/auth.guard.ts +98 -98
  67. package/src/auth/auth.module.ts +24 -24
  68. package/src/cache/cache.module.ts +25 -25
  69. package/src/cache/cache.service.ts +19 -19
  70. package/src/index.ts +29 -29
  71. package/src/prisma/prisma.module.ts +9 -9
  72. package/src/prisma/prisma.service.ts +13 -13
  73. package/src/prisma/seed.ts +82 -0
  74. package/src/types/index.ts +12 -12
  75. package/src/utils/api/endpoints.ts +6 -6
  76. package/src/utils/constants.ts +13 -13
  77. package/src/utils/events.ts +7 -7
  78. package/src/utils/index.ts +11 -11
  79. package/tsconfig.json +24 -24
package/src/index.ts CHANGED
@@ -1,30 +1,30 @@
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
-
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
+ export * from './prisma/seed';
25
+ export * from './types';
26
+ export * from './utils';
27
+ export * from './utils/api/endpoints';
28
+ export * from './utils/events';
29
+
30
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
+ }
@@ -0,0 +1,82 @@
1
+ //create a seed for the prisma client
2
+
3
+ import { PrismaClient } from '@prisma/client';
4
+
5
+ const prisma = new PrismaClient();
6
+
7
+ async function main() {
8
+ try {
9
+ const categories = [
10
+ {
11
+ name: 'Music',
12
+ description: 'Music events',
13
+ },
14
+ {
15
+ name: 'Food',
16
+ description: 'Food events',
17
+ },
18
+ {
19
+ name: 'Art',
20
+ description: 'Art events',
21
+ },
22
+ {
23
+ name: 'Sports',
24
+ description: 'Sports events',
25
+ },
26
+ {
27
+ name: 'Games',
28
+ description: 'Games events',
29
+ },
30
+ {
31
+ name: 'Dance',
32
+ description: 'Dance events',
33
+ },
34
+ {
35
+ name: 'Fashion',
36
+ description: 'Fashion events',
37
+ },
38
+ {
39
+ name: 'Tech',
40
+ description: 'Technology events',
41
+ },
42
+ {
43
+ name: 'Science',
44
+ description: 'Science events',
45
+ },
46
+
47
+ ];
48
+
49
+ const categoriesCreated = await prisma.eventCategory.findMany({
50
+ where: {
51
+ name: {
52
+ in: categories.map((category) => category.name),
53
+ },
54
+ },
55
+ });
56
+
57
+ const categoriesNotCreated = categories.filter((category) => !categoriesCreated.some((c) => c.name === category.name));
58
+
59
+ if(categoriesNotCreated.length > 0) {
60
+ console.log(`Creating ${categoriesNotCreated.length} categories`);
61
+ await prisma.eventCategory.createMany({
62
+ data: categoriesNotCreated,
63
+ });
64
+ console.log(`Created ${categoriesNotCreated.length} categories`);
65
+ }
66
+
67
+
68
+ } catch (error) {
69
+ console.error(error);
70
+ }
71
+
72
+
73
+ }
74
+
75
+ main()
76
+ .catch((error) => {
77
+ console.error(error);
78
+ process.exit(1);
79
+ })
80
+ .finally(async () => {
81
+ await prisma.$disconnect();
82
+ });
@@ -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}`;
package/tsconfig.json CHANGED
@@ -1,24 +1,24 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "declaration": true,
5
- "removeComments": true,
6
- "emitDecoratorMetadata": true,
7
- "experimentalDecorators": true,
8
- "target": "ES2017",
9
- "sourceMap": true,
10
- "outDir": "./dist",
11
- "baseUrl": ".",
12
- "rootDir": "./src",
13
- "paths": {
14
- "@/*": ["./src/*"]
15
- },
16
- "strict": true,
17
- "strictNullChecks": false,
18
- "esModuleInterop": true,
19
- "declarationMap": true,
20
- "resolveJsonModule": true,
21
- },
22
- "include": ["src/**/*.ts"],
23
- "exclude": ["node_modules", "dist"]
24
- }
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "declaration": true,
5
+ "removeComments": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "target": "ES2017",
9
+ "sourceMap": true,
10
+ "outDir": "./dist",
11
+ "baseUrl": ".",
12
+ "rootDir": "./src",
13
+ "paths": {
14
+ "@/*": ["./src/*"]
15
+ },
16
+ "strict": true,
17
+ "strictNullChecks": false,
18
+ "esModuleInterop": true,
19
+ "declarationMap": true,
20
+ "resolveJsonModule": true,
21
+ },
22
+ "include": ["src/**/*.ts"],
23
+ "exclude": ["node_modules", "dist"]
24
+ }