mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Feat: create user page, add user bio and avatar
This commit is contained in:
@@ -27,7 +27,7 @@ const createNewBeerComment = async ({
|
||||
id: true,
|
||||
content: true,
|
||||
rating: true,
|
||||
postedBy: { select: { id: true, username: true } },
|
||||
postedBy: { select: { id: true, username: true, userAvatar: true } },
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
},
|
||||
|
||||
@@ -22,7 +22,9 @@ const editBeerCommentById = async ({
|
||||
rating: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: { select: { id: true, username: true, createdAt: true } },
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -17,7 +17,9 @@ const findBeerCommentById = async ({
|
||||
rating: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: { select: { id: true, username: true, createdAt: true } },
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,7 +24,9 @@ const getAllBeerComments = async ({
|
||||
rating: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: { select: { id: true, username: true, createdAt: true } },
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -27,9 +27,11 @@ const createNewBeerStyleComment = async ({
|
||||
id: true,
|
||||
content: true,
|
||||
rating: true,
|
||||
postedBy: { select: { id: true, username: true } },
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,7 +24,9 @@ const getAllBeerStyleComments = async ({
|
||||
rating: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: { select: { id: true, username: true, createdAt: true } },
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -27,9 +27,11 @@ const createNewBreweryComment = async ({
|
||||
id: true,
|
||||
content: true,
|
||||
rating: true,
|
||||
postedBy: { select: { id: true, username: true } },
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -23,7 +23,9 @@ const getAllBreweryComments = async ({
|
||||
rating: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
postedBy: { select: { id: true, username: true, createdAt: true } },
|
||||
postedBy: {
|
||||
select: { id: true, username: true, createdAt: true, userAvatar: true },
|
||||
},
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
});
|
||||
|
||||
@@ -33,6 +33,8 @@ const createNewUser = async ({
|
||||
accountIsVerified: true,
|
||||
updatedAt: true,
|
||||
role: true,
|
||||
userAvatar: true,
|
||||
bio: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ const deleteUserById = async (id: string) => {
|
||||
accountIsVerified: true,
|
||||
updatedAt: true,
|
||||
role: true,
|
||||
userAvatar: true,
|
||||
bio: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -17,6 +17,17 @@ const findUserById = async (id: string) => {
|
||||
accountIsVerified: true,
|
||||
updatedAt: true,
|
||||
role: true,
|
||||
userAvatar: {
|
||||
select: {
|
||||
path: true,
|
||||
alt: true,
|
||||
caption: true,
|
||||
createdAt: true,
|
||||
id: true,
|
||||
updatedAt: true,
|
||||
},
|
||||
},
|
||||
bio: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -11,6 +11,17 @@ const GetUserSchema = z.object({
|
||||
dateOfBirth: z.coerce.date(),
|
||||
accountIsVerified: z.boolean(),
|
||||
role: z.enum(['USER', 'ADMIN']),
|
||||
bio: z.string().nullable(),
|
||||
userAvatar: z
|
||||
.object({
|
||||
id: z.string().cuid(),
|
||||
path: z.string().url(),
|
||||
alt: z.string(),
|
||||
caption: z.string(),
|
||||
createdAt: z.coerce.date(),
|
||||
updatedAt: z.coerce.date().nullable(),
|
||||
})
|
||||
.nullable(),
|
||||
});
|
||||
|
||||
export default GetUserSchema;
|
||||
|
||||
@@ -17,6 +17,17 @@ const updateUserToBeConfirmedById = async (id: string) => {
|
||||
updatedAt: true,
|
||||
dateOfBirth: true,
|
||||
role: true,
|
||||
bio: true,
|
||||
userAvatar: {
|
||||
select: {
|
||||
id: true,
|
||||
path: true,
|
||||
alt: true,
|
||||
caption: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,14 @@ const CommentQueryResult = z.object({
|
||||
postedBy: z.object({
|
||||
id: z.string().cuid(),
|
||||
username: z.string().min(1).max(50),
|
||||
userAvatar: z
|
||||
.object({
|
||||
id: z.string().cuid(),
|
||||
path: z.string().url(),
|
||||
alt: z.string().min(1).max(50),
|
||||
caption: z.string().min(1).max(50),
|
||||
})
|
||||
.nullable(),
|
||||
}),
|
||||
updatedAt: z.coerce.date().nullable(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user