Skip to content

Commit

Permalink
change avatar column to img
Browse files Browse the repository at this point in the history
  • Loading branch information
didoslavov committed Mar 25, 2024
1 parent 0331799 commit 89a8015
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/src/components/User/User.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class User extends Model<UserInterface> {
declare email: string;

@Column({ type: DataType.STRING, allowNull: true })
declare avatar: string | undefined;
declare img: string | undefined;

@Column({ type: DataType.STRING, allowNull: false })
declare password: string;
Expand Down
4 changes: 3 additions & 1 deletion server/src/components/User/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const register = expressAsyncHandler(async (req: Request, res: Response): Promis
throw new AppError(409, 'User already exist!');
}

console.log(userData);

const user = await createUser(userData);

if (!user) {
Expand Down Expand Up @@ -55,7 +57,7 @@ const login = expressAsyncHandler(async (req: Request, res: Response): Promise<v
}

const token = createToken(user);
const userData = { id: user.id, firstName: user.firstName, lastName: user.lastName, avatar: user.avatar, email: user.email };
const userData = { id: user.id, firstName: user.firstName, lastName: user.lastName, img: user.img, email: user.email };

res.cookie('auth', token, { sameSite: 'none', secure: true });

Expand Down
2 changes: 1 addition & 1 deletion server/src/components/User/user.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface UserInterface {
firstName: string;
lastName: string;
email: string;
avatar?: string;
img?: string;
password: string;
}

Expand Down

0 comments on commit 89a8015

Please sign in to comment.