This is my method to return all videos, when i make the request besides returning the video it returns the category object, but i want to return only the category name and not the whole object.
async listAll(request: Request, response: Response): Promise<Response> {
const repo = getRepository(Video);
const videos = await repo.find({
relations: ['category']
});
return response.status(200).json(videos);
}
My video model has the fllowing structure:
@Column()
category_id!: string;
@ManyToOne(() => Category)
@JoinColumn({ name: "category_id" })
category!: Category