MCPcopy Create free account
hub / github.com/CodeFox-Repo/codefox / updateAvatar

Method updateAvatar

backend/src/user/user.service.ts:51–68  ·  view source on GitHub ↗

* Updates the user's avatar * @param userId User ID * @param file File upload * @returns Updated user object

(userId: string, file: Promise<FileUpload>)

Source from the content-addressed store, hash-verified

49 // the caller there is no such user.
50 if (!user) {
51 const bare = await this.userRepository.findOne({
52 where: { id: userId, isDeleted: false },
53 });
54 if (bare) bare.chats = Promise.resolve([]) as any;
55 return bare;
56 }
57
58 return user;
59 }
60
61 async getUser(id: string): Promise<User> | null {
62 return await this.userRepository.findOneBy({
63 id,
64 });
65 }
66
67 async getUserByEmail(email: string): Promise<User | null> {
68 return await this.userRepository.findOne({
69 where: { email },
70 });
71 }

Callers 1

uploadAvatarMethod · 0.80

Calls 2

validateAndBufferFileFunction · 0.90
uploadMethod · 0.80

Tested by

no test coverage detected