@armi-wave/common 1.3.0 → 1.6.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.
Files changed (36) hide show
  1. package/build/enums/AccountType.d.ts +5 -0
  2. package/build/enums/AccountType.js +9 -0
  3. package/build/enums/PaidPlan.d.ts +3 -0
  4. package/build/enums/PaidPlan.js +7 -0
  5. package/build/enums/PostType.d.ts +7 -0
  6. package/build/enums/PostType.js +11 -0
  7. package/build/errors/bad-request-error.d.ts +9 -0
  8. package/build/errors/bad-request-error.js +18 -0
  9. package/build/errors/custom-error.d.ts +8 -0
  10. package/build/errors/custom-error.js +9 -0
  11. package/build/errors/database-connection-error.d.ts +9 -0
  12. package/build/errors/database-connection-error.js +22 -0
  13. package/build/errors/not-authorized-error.d.ts +8 -0
  14. package/build/errors/not-authorized-error.js +21 -0
  15. package/build/errors/not-found-error.d.ts +8 -0
  16. package/build/errors/not-found-error.js +21 -0
  17. package/build/errors/request-validation-error.d.ts +11 -0
  18. package/build/errors/request-validation-error.js +23 -0
  19. package/build/index.d.ts +15 -0
  20. package/build/index.js +35 -1
  21. package/build/middlewares/current-user.d.ts +14 -0
  22. package/build/middlewares/current-user.js +17 -0
  23. package/build/middlewares/error-handler.d.ts +2 -0
  24. package/build/middlewares/error-handler.js +17 -0
  25. package/build/middlewares/require-auth.d.ts +2 -0
  26. package/build/middlewares/require-auth.js +14 -0
  27. package/build/middlewares/validate-request.d.ts +2 -0
  28. package/build/middlewares/validate-request.js +16 -0
  29. package/build/models/Comment.d.ts +26 -0
  30. package/build/models/Comment.js +53 -0
  31. package/build/models/Post.d.ts +31 -0
  32. package/build/models/Post.js +61 -0
  33. package/build/models/User.d.ts +66 -0
  34. package/build/models/User.js +4 -0
  35. package/build/utils/password.d.ts +4 -0
  36. package/package.json +7 -2
@@ -0,0 +1,5 @@
1
+ export declare enum AccountType {
2
+ Normal = "normal",
3
+ Business = "business",
4
+ Page = "page"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountType = void 0;
4
+ var AccountType;
5
+ (function (AccountType) {
6
+ AccountType["Normal"] = "normal";
7
+ AccountType["Business"] = "business";
8
+ AccountType["Page"] = "page";
9
+ })(AccountType = exports.AccountType || (exports.AccountType = {}));
@@ -0,0 +1,3 @@
1
+ export declare enum PaidPlan {
2
+ Normal = "normal"
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaidPlan = void 0;
4
+ var PaidPlan;
5
+ (function (PaidPlan) {
6
+ PaidPlan["Normal"] = "normal";
7
+ })(PaidPlan = exports.PaidPlan || (exports.PaidPlan = {}));
@@ -0,0 +1,7 @@
1
+ export declare enum PostType {
2
+ Normal = "normal",
3
+ Sponsored = "sponsored",
4
+ Meme = "meme",
5
+ News = "news",
6
+ Paid = "paid"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PostType = void 0;
4
+ var PostType;
5
+ (function (PostType) {
6
+ PostType["Normal"] = "normal";
7
+ PostType["Sponsored"] = "sponsored";
8
+ PostType["Meme"] = "meme";
9
+ PostType["News"] = "news";
10
+ PostType["Paid"] = "paid";
11
+ })(PostType = exports.PostType || (exports.PostType = {}));
@@ -0,0 +1,9 @@
1
+ import CustomError from './custom-error';
2
+ export default class BadRequestError extends CustomError {
3
+ message: string;
4
+ statusCode: number;
5
+ constructor(message: string);
6
+ serializeErrors(): {
7
+ message: string;
8
+ }[];
9
+ }
@@ -0,0 +1,18 @@
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 custom_error_1 = __importDefault(require("./custom-error"));
7
+ class BadRequestError extends custom_error_1.default {
8
+ constructor(message) {
9
+ super(message);
10
+ this.message = message;
11
+ this.statusCode = 400;
12
+ Object.setPrototypeOf(this, BadRequestError.prototype);
13
+ }
14
+ serializeErrors() {
15
+ return [{ message: this.message }];
16
+ }
17
+ }
18
+ exports.default = BadRequestError;
@@ -0,0 +1,8 @@
1
+ export default abstract class CustomError extends Error {
2
+ abstract statusCode: number;
3
+ constructor(message: string);
4
+ abstract serializeErrors(): {
5
+ message: string;
6
+ field?: string;
7
+ }[];
8
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class CustomError extends Error {
4
+ constructor(message) {
5
+ super(message);
6
+ Object.setPrototypeOf(this, CustomError.prototype);
7
+ }
8
+ }
9
+ exports.default = CustomError;
@@ -0,0 +1,9 @@
1
+ import CustomError from './custom-error';
2
+ export default class DatabaseConnectionError extends CustomError {
3
+ statusCode: number;
4
+ reason: string;
5
+ constructor();
6
+ serializeErrors(): {
7
+ message: string;
8
+ }[];
9
+ }
@@ -0,0 +1,22 @@
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 custom_error_1 = __importDefault(require("./custom-error"));
7
+ class DatabaseConnectionError extends custom_error_1.default {
8
+ constructor() {
9
+ super('Error connecting to database');
10
+ this.statusCode = 500;
11
+ this.reason = 'Error connection to database';
12
+ Object.setPrototypeOf(this, DatabaseConnectionError.prototype);
13
+ }
14
+ serializeErrors() {
15
+ return [
16
+ {
17
+ message: this.reason,
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.default = DatabaseConnectionError;
@@ -0,0 +1,8 @@
1
+ import CustomError from './custom-error';
2
+ export default class NotAuthorizedError extends CustomError {
3
+ statusCode: number;
4
+ constructor();
5
+ serializeErrors(): {
6
+ message: string;
7
+ }[];
8
+ }
@@ -0,0 +1,21 @@
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 custom_error_1 = __importDefault(require("./custom-error"));
7
+ class NotAuthorizedError extends custom_error_1.default {
8
+ constructor() {
9
+ super('Not Authorized');
10
+ this.statusCode = 401;
11
+ Object.setPrototypeOf(this, NotAuthorizedError.prototype);
12
+ }
13
+ serializeErrors() {
14
+ return [
15
+ {
16
+ message: 'Not Authorized',
17
+ },
18
+ ];
19
+ }
20
+ }
21
+ exports.default = NotAuthorizedError;
@@ -0,0 +1,8 @@
1
+ import CustomError from './custom-error';
2
+ export default class NotFoundError extends CustomError {
3
+ statusCode: number;
4
+ constructor();
5
+ serializeErrors(): {
6
+ message: string;
7
+ }[];
8
+ }
@@ -0,0 +1,21 @@
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 custom_error_1 = __importDefault(require("./custom-error"));
7
+ class NotFoundError extends custom_error_1.default {
8
+ constructor() {
9
+ super('Not Found');
10
+ this.statusCode = 404;
11
+ Object.setPrototypeOf(this, NotFoundError.prototype);
12
+ }
13
+ serializeErrors() {
14
+ return [
15
+ {
16
+ message: 'Not Found',
17
+ },
18
+ ];
19
+ }
20
+ }
21
+ exports.default = NotFoundError;
@@ -0,0 +1,11 @@
1
+ import { ValidationError } from 'express-validator';
2
+ import CustomError from './custom-error';
3
+ export default class RequestValidationError extends CustomError {
4
+ errors: ValidationError[];
5
+ statusCode: number;
6
+ constructor(errors: ValidationError[]);
7
+ serializeErrors(): {
8
+ message: any;
9
+ field: string;
10
+ }[];
11
+ }
@@ -0,0 +1,23 @@
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 custom_error_1 = __importDefault(require("./custom-error"));
7
+ class RequestValidationError extends custom_error_1.default {
8
+ constructor(errors) {
9
+ super('Error with validation');
10
+ this.errors = errors;
11
+ this.statusCode = 400;
12
+ Object.setPrototypeOf(this, RequestValidationError.prototype);
13
+ }
14
+ serializeErrors() {
15
+ return this.errors.map((err) => {
16
+ return {
17
+ message: err.msg,
18
+ field: err.param,
19
+ };
20
+ });
21
+ }
22
+ }
23
+ exports.default = RequestValidationError;
@@ -0,0 +1,15 @@
1
+ import User from './models/User';
2
+ import Post from './models/Post';
3
+ import Comment from './models/Comment';
4
+ import BadRequestError from './errors/bad-request-error';
5
+ import DatabaseConnectionError from './errors/database-connection-error';
6
+ import CustomError from './errors/custom-error';
7
+ import NotAuthorizedError from './errors/not-authorized-error';
8
+ import NotFoundError from './errors/not-found-error';
9
+ import RequestValidationError from './errors/request-validation-error';
10
+ export { User, Post, Comment };
11
+ export { BadRequestError, DatabaseConnectionError, CustomError, NotAuthorizedError, NotFoundError, RequestValidationError, };
12
+ export * from './middlewares/current-user';
13
+ export * from './middlewares/error-handler';
14
+ export * from './middlewares/require-auth';
15
+ export * from './middlewares/validate-request';
package/build/index.js CHANGED
@@ -1,8 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.User = void 0;
20
+ exports.RequestValidationError = exports.NotFoundError = exports.NotAuthorizedError = exports.CustomError = exports.DatabaseConnectionError = exports.BadRequestError = exports.Comment = exports.Post = exports.User = void 0;
7
21
  const User_1 = __importDefault(require("./models/User"));
8
22
  exports.User = User_1.default;
23
+ const Post_1 = __importDefault(require("./models/Post"));
24
+ exports.Post = Post_1.default;
25
+ const Comment_1 = __importDefault(require("./models/Comment"));
26
+ exports.Comment = Comment_1.default;
27
+ const bad_request_error_1 = __importDefault(require("./errors/bad-request-error"));
28
+ exports.BadRequestError = bad_request_error_1.default;
29
+ const database_connection_error_1 = __importDefault(require("./errors/database-connection-error"));
30
+ exports.DatabaseConnectionError = database_connection_error_1.default;
31
+ const custom_error_1 = __importDefault(require("./errors/custom-error"));
32
+ exports.CustomError = custom_error_1.default;
33
+ const not_authorized_error_1 = __importDefault(require("./errors/not-authorized-error"));
34
+ exports.NotAuthorizedError = not_authorized_error_1.default;
35
+ const not_found_error_1 = __importDefault(require("./errors/not-found-error"));
36
+ exports.NotFoundError = not_found_error_1.default;
37
+ const request_validation_error_1 = __importDefault(require("./errors/request-validation-error"));
38
+ exports.RequestValidationError = request_validation_error_1.default;
39
+ __exportStar(require("./middlewares/current-user"), exports);
40
+ __exportStar(require("./middlewares/error-handler"), exports);
41
+ __exportStar(require("./middlewares/require-auth"), exports);
42
+ __exportStar(require("./middlewares/validate-request"), exports);
@@ -0,0 +1,14 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ interface UserPayload {
3
+ id: string;
4
+ email: string;
5
+ }
6
+ declare global {
7
+ namespace Express {
8
+ interface Request {
9
+ currentUser?: UserPayload;
10
+ }
11
+ }
12
+ }
13
+ export declare const currentUser: (req: Request, res: Response, next: NextFunction) => void;
14
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.currentUser = void 0;
4
+ const jsonwebtoken_1 = require("jsonwebtoken");
5
+ const currentUser = (req, res, next) => {
6
+ var _a;
7
+ if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
8
+ return next();
9
+ }
10
+ try {
11
+ const payload = (0, jsonwebtoken_1.verify)(req.session.jwt, process.env.JWT_KEY);
12
+ req.currentUser = payload;
13
+ }
14
+ catch (error) { }
15
+ next();
16
+ };
17
+ exports.currentUser = currentUser;
@@ -0,0 +1,2 @@
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;
@@ -0,0 +1,17 @@
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
+ exports.errorHandler = void 0;
7
+ const custom_error_1 = __importDefault(require("../errors/custom-error"));
8
+ const errorHandler = (err, req, res, next) => {
9
+ if (err instanceof custom_error_1.default) {
10
+ return res.status(err.statusCode).send({ errors: err.serializeErrors() });
11
+ }
12
+ console.error(err);
13
+ res.status(400).send({
14
+ errors: [{ message: 'Something went wrong' }],
15
+ });
16
+ };
17
+ exports.errorHandler = errorHandler;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ export declare const requireAuth: (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,14 @@
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
+ exports.requireAuth = void 0;
7
+ const not_authorized_error_1 = __importDefault(require("../errors/not-authorized-error"));
8
+ const requireAuth = (req, res, next) => {
9
+ if (!req.currentUser) {
10
+ throw new not_authorized_error_1.default();
11
+ }
12
+ next();
13
+ };
14
+ exports.requireAuth = requireAuth;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ export declare const validateRequest: (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,16 @@
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
+ exports.validateRequest = void 0;
7
+ const express_validator_1 = require("express-validator");
8
+ const request_validation_error_1 = __importDefault(require("../errors/request-validation-error"));
9
+ const validateRequest = (req, res, next) => {
10
+ const errors = (0, express_validator_1.validationResult)(req);
11
+ if (!errors.isEmpty()) {
12
+ throw new request_validation_error_1.default(errors.array());
13
+ }
14
+ next();
15
+ };
16
+ exports.validateRequest = validateRequest;
@@ -0,0 +1,26 @@
1
+ import mongoose from 'mongoose';
2
+ interface CommentAttributes {
3
+ idPost: string;
4
+ username: string;
5
+ likes: number;
6
+ upVotes: number;
7
+ downVotes: number;
8
+ reportNr: number;
9
+ contentUrl: string;
10
+ text: string;
11
+ }
12
+ interface CommentModel extends mongoose.Model<CommentDocument> {
13
+ build(attrs: CommentAttributes): CommentDocument;
14
+ }
15
+ interface CommentDocument extends mongoose.Document {
16
+ idPost: string;
17
+ username: string;
18
+ likes: number;
19
+ upVotes: number;
20
+ downVotes: number;
21
+ reportNr: number;
22
+ contentUrl: string;
23
+ text: string;
24
+ }
25
+ declare const Comment: CommentModel;
26
+ export default Comment;
@@ -0,0 +1,53 @@
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 commentSchema = new mongoose_1.default.Schema({
8
+ idPost: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ username: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ likes: {
17
+ type: Number,
18
+ required: true,
19
+ },
20
+ upVotes: {
21
+ type: Number,
22
+ required: true,
23
+ },
24
+ downVotes: {
25
+ type: Number,
26
+ required: true,
27
+ },
28
+ reportNr: {
29
+ type: Number,
30
+ required: true,
31
+ },
32
+ contentUrl: {
33
+ type: String,
34
+ required: true,
35
+ },
36
+ text: {
37
+ type: String,
38
+ required: true,
39
+ },
40
+ }, {
41
+ toJSON: {
42
+ transform(doc, ret) {
43
+ ret.id = ret._id;
44
+ delete ret.__v;
45
+ delete ret._id;
46
+ },
47
+ },
48
+ });
49
+ commentSchema.statics.build = (attrs) => {
50
+ return new Comment(attrs);
51
+ };
52
+ const Comment = mongoose_1.default.model('Comment', commentSchema);
53
+ exports.default = Comment;
@@ -0,0 +1,31 @@
1
+ import mongoose from 'mongoose';
2
+ import { PostType } from '../enums/PostType';
3
+ interface PostAttributes {
4
+ idUser: string;
5
+ username: string;
6
+ likes: number;
7
+ upVotes: number;
8
+ downVotes: number;
9
+ saved: number;
10
+ postType: PostType;
11
+ reportNr: number;
12
+ contentUrl: string;
13
+ text: string;
14
+ }
15
+ interface PostModel extends mongoose.Model<PostDocument> {
16
+ build(attrs: PostAttributes): PostDocument;
17
+ }
18
+ interface PostDocument extends mongoose.Document {
19
+ idUser: string;
20
+ username: string;
21
+ likes: number;
22
+ upVotes: number;
23
+ downVotes: number;
24
+ saved: number;
25
+ postType: PostType;
26
+ reportNr: number;
27
+ contentUrl: string;
28
+ text: string;
29
+ }
30
+ declare const Post: PostModel;
31
+ export default Post;
@@ -0,0 +1,61 @@
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 postSchema = new mongoose_1.default.Schema({
8
+ idUser: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ username: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ likes: {
17
+ type: Number,
18
+ required: true,
19
+ },
20
+ upVotes: {
21
+ type: Number,
22
+ required: true,
23
+ },
24
+ downVotes: {
25
+ type: Number,
26
+ required: true,
27
+ },
28
+ saved: {
29
+ type: Number,
30
+ required: true,
31
+ },
32
+ postType: {
33
+ type: String,
34
+ required: true,
35
+ },
36
+ reportNr: {
37
+ type: Number,
38
+ required: true,
39
+ },
40
+ contentUrl: {
41
+ type: String,
42
+ required: true,
43
+ },
44
+ text: {
45
+ type: String,
46
+ required: true,
47
+ },
48
+ }, {
49
+ toJSON: {
50
+ transform(doc, ret) {
51
+ ret.id = ret._id;
52
+ delete ret.__v;
53
+ delete ret._id;
54
+ },
55
+ },
56
+ });
57
+ postSchema.statics.build = (attrs) => {
58
+ return new Post(attrs);
59
+ };
60
+ const Post = mongoose_1.default.model('Post', postSchema);
61
+ exports.default = Post;
@@ -0,0 +1,66 @@
1
+ import mongoose from 'mongoose';
2
+ import { AccountType } from '../enums/AccountType';
3
+ import { PaidPlan } from '../enums/PaidPlan';
4
+ interface UserAttributes {
5
+ email: string;
6
+ username: string;
7
+ password: string;
8
+ name: string;
9
+ accountType: AccountType;
10
+ surname: string;
11
+ followers: number;
12
+ following: number;
13
+ phoneNumber: string;
14
+ verified: boolean;
15
+ paidPlan: PaidPlan;
16
+ savedPosts: string[];
17
+ likedPosts: string[];
18
+ upVotedPosts: string[];
19
+ likedComments: string[];
20
+ bannedAccounts: string[];
21
+ reportedPosts: string[];
22
+ validReportedPosts: string[];
23
+ totalLikes: number;
24
+ totalUpVotes: number;
25
+ totalDownVotes: number;
26
+ location: string;
27
+ height: number;
28
+ weight: number;
29
+ profession: string;
30
+ grossIncome: number;
31
+ netIncome: number;
32
+ }
33
+ interface UserModel extends mongoose.Model<UserDocument> {
34
+ build(attrs: UserAttributes): UserDocument;
35
+ }
36
+ interface UserDocument extends mongoose.Document {
37
+ email: string;
38
+ username: string;
39
+ password: string;
40
+ name: string;
41
+ accountType: AccountType;
42
+ surname: string;
43
+ followers: number;
44
+ following: number;
45
+ phoneNumber: string;
46
+ verified: boolean;
47
+ paidPlan: PaidPlan;
48
+ savedPosts: string[];
49
+ likedPosts: string[];
50
+ upVotedPosts: string[];
51
+ likedComments: string[];
52
+ bannedAccounts: string[];
53
+ reportedPosts: string[];
54
+ validReportedPosts: string[];
55
+ totalLikes: number;
56
+ totalUpVotes: number;
57
+ totalDownVotes: number;
58
+ location: string;
59
+ height: number;
60
+ weight: number;
61
+ profession: string;
62
+ grossIncome: number;
63
+ netIncome: number;
64
+ }
65
+ declare const User: UserModel;
66
+ export default User;
@@ -33,6 +33,10 @@ const userSchema = new mongoose_1.default.Schema({
33
33
  type: String,
34
34
  required: true,
35
35
  },
36
+ accountType: {
37
+ type: String,
38
+ required: true,
39
+ },
36
40
  surname: {
37
41
  type: String,
38
42
  required: true,
@@ -0,0 +1,4 @@
1
+ export default class Password {
2
+ static toHash(password: string): Promise<string>;
3
+ static compare(storedPassword: string, suppliedPassword: string): Promise<boolean>;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armi-wave/common",
3
- "version": "1.3.0",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -13,5 +13,10 @@
13
13
  "pub": "git add . && git commit -m \"Updates\" && npm version feature && npm run build && npm publish"
14
14
  },
15
15
  "author": "Armiron Kurbalaj",
16
- "license": "ISC"
16
+ "license": "ISC",
17
+ "dependencies": {
18
+ "express": "^4.18.1",
19
+ "express-validator": "^6.14.2",
20
+ "jsonwebtoken": "^8.5.1"
21
+ }
17
22
  }