13 lines
321 B
TypeScript
13 lines
321 B
TypeScript
import { User } from '../auth/user.model';
|
|
|
|
const authorMapper = (author: any, id?: number) => ({
|
|
username: author.username,
|
|
bio: author.bio,
|
|
image: author.image,
|
|
following: id
|
|
? author?.followedBy.some((followingUser: Partial<User>) => followingUser.id === id)
|
|
: false,
|
|
});
|
|
|
|
export default authorMapper;
|