@duvdu-v1/duvdu 1.1.31 → 1.1.33

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/build/index.d.ts CHANGED
@@ -58,3 +58,4 @@ export * from './models/copyrights.model';
58
58
  export * from './models/studio-booking.model';
59
59
  export * from './models/allProjects.model';
60
60
  export * from './models/report.model';
61
+ export * from './models/messages.model';
package/build/index.js CHANGED
@@ -74,3 +74,4 @@ __exportStar(require("./models/copyrights.model"), exports);
74
74
  __exportStar(require("./models/studio-booking.model"), exports);
75
75
  __exportStar(require("./models/allProjects.model"), exports);
76
76
  __exportStar(require("./models/report.model"), exports);
77
+ __exportStar(require("./models/messages.model"), exports);
@@ -1,5 +1,5 @@
1
1
  import RedisStore from 'connect-redis';
2
- export declare const redisConnection: (url: string) => import("@redis/client").RedisClientType<{
2
+ export declare const redisConnection: (url: string, password: string) => import("@redis/client").RedisClientType<{
3
3
  graph: {
4
4
  CONFIG_GET: typeof import("@redis/graph/dist/commands/CONFIG_GET");
5
5
  configGet: typeof import("@redis/graph/dist/commands/CONFIG_GET");
@@ -289,4 +289,4 @@ export declare const redisConnection: (url: string) => import("@redis/client").R
289
289
  reserve: typeof import("@redis/bloom/dist/commands/top-k/RESERVE");
290
290
  };
291
291
  } & import("redis").RedisModules, import("redis").RedisFunctions, import("redis").RedisScripts>;
292
- export declare const sessionStore: (url: string) => RedisStore;
292
+ export declare const sessionStore: (url: string, password: string) => RedisStore;
@@ -7,8 +7,8 @@ exports.sessionStore = exports.redisConnection = void 0;
7
7
  const connect_redis_1 = __importDefault(require("connect-redis"));
8
8
  const redis_1 = require("redis");
9
9
  const data_base_connections_1 = require("../errors/data-base-connections");
10
- const redisConnection = (url) => {
11
- const client = (0, redis_1.createClient)({ url });
10
+ const redisConnection = (url, password) => {
11
+ const client = (0, redis_1.createClient)({ url, password });
12
12
  client
13
13
  .connect()
14
14
  .then(() => console.log(`redis connected in : ${url}`))
@@ -18,5 +18,5 @@ const redisConnection = (url) => {
18
18
  return client;
19
19
  };
20
20
  exports.redisConnection = redisConnection;
21
- const sessionStore = (url) => new connect_redis_1.default({ client: (0, exports.redisConnection)(url) });
21
+ const sessionStore = (url, password) => new connect_redis_1.default({ client: (0, exports.redisConnection)(url, password) });
22
22
  exports.sessionStore = sessionStore;
@@ -0,0 +1,46 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import { Types } from 'mongoose';
26
+ import { Iuser } from '../types/User';
27
+ interface Ireaction {
28
+ type: string;
29
+ user: Types.ObjectId | Iuser;
30
+ }
31
+ export interface ImessageDoc {
32
+ sender: Types.ObjectId | Iuser;
33
+ receiver: Types.ObjectId | Iuser;
34
+ content?: string;
35
+ media?: {
36
+ type: string;
37
+ url: string;
38
+ };
39
+ reactions: Ireaction[];
40
+ watched: boolean;
41
+ updated: boolean;
42
+ }
43
+ export declare const Message: import("mongoose").Model<ImessageDoc, {}, {}, {}, import("mongoose").Document<unknown, {}, ImessageDoc> & ImessageDoc & {
44
+ _id: Types.ObjectId;
45
+ }, any>;
46
+ export {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Message = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const model_names_1 = require("../types/model-names");
6
+ const reactionSchema = new mongoose_1.Schema({
7
+ type: { type: String, required: true },
8
+ user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user, required: true },
9
+ });
10
+ exports.Message = (0, mongoose_1.model)(model_names_1.MODELS.messages, new mongoose_1.Schema({
11
+ sender: {
12
+ type: mongoose_1.Schema.Types.ObjectId,
13
+ ref: model_names_1.MODELS.user,
14
+ required: true
15
+ },
16
+ receiver: {
17
+ type: mongoose_1.Schema.Types.ObjectId,
18
+ ref: model_names_1.MODELS.user,
19
+ required: true
20
+ },
21
+ content: {
22
+ type: String,
23
+ default: null
24
+ },
25
+ reactions: [reactionSchema],
26
+ media: {
27
+ type: {
28
+ type: String
29
+ },
30
+ url: String,
31
+ },
32
+ watched: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ updated: {
37
+ type: Boolean,
38
+ default: false
39
+ }
40
+ }, { timestamps: true, collection: model_names_1.MODELS.messages, toJSON: {
41
+ transform(doc, ret) {
42
+ var _a;
43
+ if ((_a = ret.media) === null || _a === void 0 ? void 0 : _a.url)
44
+ ret.media.url = process.env.BUCKET_HOST + '/' + ret.media.url;
45
+ }
46
+ }
47
+ }));
@@ -12,5 +12,6 @@ export declare enum MODELS {
12
12
  report = "report",
13
13
  copyrights = "copyrights",
14
14
  projects = "allProjects",
15
- messages = "messages"
15
+ messages = "messages",
16
+ notifications = "notifications"
16
17
  }
@@ -17,4 +17,5 @@ var MODELS;
17
17
  MODELS["copyrights"] = "copyrights";
18
18
  MODELS["projects"] = "allProjects";
19
19
  MODELS["messages"] = "messages";
20
+ MODELS["notifications"] = "notifications";
20
21
  })(MODELS || (exports.MODELS = MODELS = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.31",
3
+ "version": "1.1.33",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [