Skip to content

Commit cd765d5

Browse files
Refactoting coding
1 parent d24d122 commit cd765d5

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/controllers/auth/auth.controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import config from "../../config/config";
22

33
import { Request, Response } from "express";
4-
import User, { IUser } from "../../models/User";
4+
import { IUser } from "../../models/IUser";
5+
import User from "../../models/User";
56
import bcrypt from "bcrypt";
67
import jwt from "jsonwebtoken";
78

src/models/IUser.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Document } from 'mongoose'
2+
3+
export interface IUser extends Document {
4+
displayName: string;
5+
username: string;
6+
email: string;
7+
password: string;
8+
avatar: string;
9+
role: string;
10+
status: boolean;
11+
}

src/models/User.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
import { model, Schema, Document } from "mongoose";
1+
import { model, Schema } from "mongoose";
22
import bcrypt from "bcrypt";
3-
4-
export interface IUser extends Document {
5-
displayName: string;
6-
username: string;
7-
email: string;
8-
password: string;
9-
avatar: string;
10-
role: string;
11-
status: boolean;
12-
}
3+
import { IUser } from "./IUser";
134

145
const UserSchema = new Schema(
156
{

0 commit comments

Comments
 (0)