import { Controller, Post, Param, Body } from '@nestjs/common';
import { FavRepo } from '../../repos/fav.repo';
import { Public } from '@/models/users/decorators/public-route';

@Controller('photos')
export class AddFavorite {
  constructor(private favRepo: FavRepo) {}

  @Public()
  @Post(':id/favorite')
  async execute(
    @Param('id') photoId: string,
    @Body() body: { customerId: string },
  ) {
    await this.favRepo.addFavorite(body.customerId, photoId);

    return {};
  }
}
