import type { Request, Response } from 'express';
import UserProgressService from '@/services/user_progress';

export async function list(req: Request, res: Response): Promise<void> {
  const payload = await UserProgressService.list(req.query, req.currentUser);
  res.status(200).send(payload);
}

export async function upsert(req: Request, res: Response): Promise<void> {
  const payload = await UserProgressService.upsert(
    req.body.data,
    req.currentUser,
  );
  res.status(200).send(payload);
}

export async function removeByItem(req: Request, res: Response): Promise<void> {
  const payload = await UserProgressService.removeByItem(
    req.query,
    req.currentUser,
  );
  res.status(200).send(payload);
}
