Feat: create user page, add user bio and avatar

This commit is contained in:
Aaron William Po
2023-11-05 21:54:09 -05:00
parent fcc43c305c
commit 7f9ddb40a1
26 changed files with 324 additions and 79 deletions

View File

@@ -3,6 +3,7 @@ import { z } from 'zod';
import { hashPassword } from '../../../config/auth/passwordFns';
import DBClient from '../../DBClient';
import GetUserSchema from '../../../services/User/schema/GetUserSchema';
import imageUrls from '../util/imageUrls';
const createAdminUser = async () => {
const hash = await hashPassword('Pas!3word');
@@ -15,6 +16,14 @@ const createAdminUser = async () => {
dateOfBirth: new Date('1990-01-01'),
role: 'ADMIN',
hash,
userAvatar: {
create: {
path: imageUrls[Math.floor(Math.random() * imageUrls.length)],
alt: 'Admin User',
caption: 'Admin User',
createdAt: new Date(),
},
},
},
select: {
id: true,
@@ -27,6 +36,8 @@ const createAdminUser = async () => {
accountIsVerified: true,
updatedAt: true,
role: true,
bio: true,
userAvatar: true,
},
});