@armi-wave/common 1.21.0 → 1.23.0

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.
@@ -6,6 +6,6 @@ export default class RequestValidationError extends CustomError {
6
6
  constructor(errors: ValidationError[]);
7
7
  serializeErrors(): {
8
8
  message: any;
9
- field: string;
9
+ field: any;
10
10
  }[];
11
11
  }
@@ -14,5 +14,5 @@ declare global {
14
14
  }
15
15
  }
16
16
  }
17
- export declare const currentUser: (req: Request, res: Response, next: NextFunction) => void;
17
+ export declare const currentUser: (req: Request, res: Response, next: NextFunction) => any;
18
18
  export {};
@@ -1,2 +1,2 @@
1
1
  import { Request, Response, NextFunction } from 'express';
2
- export declare const errorHandler: (err: Error, req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> | undefined;
2
+ export declare const errorHandler: (err: Error, req: Request, res: Response, next: NextFunction) => any;
@@ -0,0 +1,24 @@
1
+ import mongoose from 'mongoose';
2
+ interface FollowAttributes {
3
+ userId: string;
4
+ followers: Record<string, {
5
+ followedAt: Date;
6
+ }>;
7
+ following: Record<string, {
8
+ followedAt: Date;
9
+ }>;
10
+ }
11
+ interface FollowModel extends mongoose.Model<FollowDocument> {
12
+ build(attrs: FollowAttributes): FollowDocument;
13
+ }
14
+ interface FollowDocument extends mongoose.Document {
15
+ userId: string;
16
+ followers: Record<string, {
17
+ followedAt: Date;
18
+ }>;
19
+ following: Record<string, {
20
+ followedAt: Date;
21
+ }>;
22
+ }
23
+ declare const Follow: FollowModel;
24
+ export default Follow;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mongoose_1 = __importDefault(require("mongoose"));
7
+ const followSchema = new mongoose_1.default.Schema({
8
+ userId: { type: String, required: true },
9
+ followers: {
10
+ type: Map,
11
+ of: {
12
+ followedAt: { type: Date, required: true },
13
+ },
14
+ default: {},
15
+ },
16
+ following: {
17
+ type: Map,
18
+ of: {
19
+ followedAt: { type: Date, required: true },
20
+ },
21
+ default: {},
22
+ },
23
+ }, {
24
+ toJSON: {
25
+ transform(doc, ret) {
26
+ ret.id = ret._id;
27
+ delete ret.__v;
28
+ delete ret._id;
29
+ },
30
+ },
31
+ });
32
+ followSchema.statics.build = (attrs) => {
33
+ return new Follow(attrs);
34
+ };
35
+ const Follow = mongoose_1.default.model('Follow', followSchema);
36
+ exports.default = Follow;
@@ -6,8 +6,9 @@ interface UserAttributes {
6
6
  username: string;
7
7
  password: string;
8
8
  name: string;
9
- accountType: AccountType;
10
9
  surname: string;
10
+ profilePicUr?: string;
11
+ accountType: AccountType;
11
12
  followers?: number;
12
13
  following?: number;
13
14
  postsNr?: number;
@@ -39,8 +40,9 @@ interface UserDocument extends mongoose.Document {
39
40
  username: string;
40
41
  password: string;
41
42
  name: string;
42
- accountType: AccountType;
43
43
  surname: string;
44
+ profilePicUrl: string;
45
+ accountType: AccountType;
44
46
  followers: number;
45
47
  following: number;
46
48
  postsNr: number;
@@ -20,8 +20,9 @@ const userSchema = new mongoose_1.default.Schema({
20
20
  username: { type: String, required: true, unique: true },
21
21
  password: { type: String, required: true },
22
22
  name: { type: String, required: true },
23
- accountType: { type: String, required: true },
24
23
  surname: { type: String, required: true },
24
+ profilePicUrl: { type: String, required: false },
25
+ accountType: { type: String, required: true },
25
26
  followers: { type: Number, required: false, default: 0 },
26
27
  following: { type: Number, required: false, default: 0 },
27
28
  postsNr: { type: Number, required: false, default: 0 },
@@ -1,4 +1,3 @@
1
- import { Client } from 'minio';
2
- declare const minioClient: Client;
1
+ declare const minioClient: any;
3
2
  declare const ensureBucketExists: (bucketName: string) => Promise<void>;
4
3
  export { minioClient, ensureBucketExists };
@@ -1,3 +1,2 @@
1
- import multer from 'multer';
2
- declare const upload: multer.Multer;
1
+ declare const upload: any;
3
2
  export { upload };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armi-wave/common",
3
- "version": "1.21.0",
3
+ "version": "1.23.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",