Files
test-siva-node-1/src/app/routes/article/author.mapper.ts

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;