initial commit
Change-Id: Ifa2442bb2e786af351ef5f575ca69828870c8b6e
This commit is contained in:
13
src/app/routes/profile/profile.utils.ts
Normal file
13
src/app/routes/profile/profile.utils.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { User } from '../auth/user.model';
|
||||
import { Profile } from './profile.model';
|
||||
|
||||
const profileMapper = (user: any, id: number | undefined): Profile => ({
|
||||
username: user.username,
|
||||
bio: user.bio,
|
||||
image: user.image,
|
||||
following: id
|
||||
? user?.followedBy.some((followingUser: Partial<User>) => followingUser.id === id)
|
||||
: false,
|
||||
});
|
||||
|
||||
export default profileMapper;
|
||||
Reference in New Issue
Block a user