feat: add individual post page

This commit is contained in:
Stevan Freeborn
2023-09-11 22:05:12 -05:00
parent 41401cd3c5
commit 5389a86ed1
5 changed files with 85 additions and 10 deletions
+18
View File
@@ -32,6 +32,24 @@ export const getUserByClerkId = query({
},
});
export const getUserById = query({
args: { id: v.id('users') },
async handler(ctx, args): Promise<UserDto | 'USER_NOT_FOUND'> {
const user = await ctx.db.get(args.id);
if (user === null) {
return 'USER_NOT_FOUND';
}
return {
_id: user._id,
_creationTime: user._creationTime,
clerkUsername: user.clerkUser.username,
clerkImageUrl: user.clerkUser.image_url,
};
},
});
export const getUser = internalQuery({
args: { subject: v.string() },
async handler(ctx, args) {