import { Payment } from "../lib/models.js"; import { API } from "../lib/api.js"; export const get = async (req, res) => { const api = new API(req, res); // the user should be authenticated already const [paid, payment] = await Payment.paid(api.user); if(!paid) { api.error(402, "Payment required to access this course."); } else { res.status(200).send(); } } get.authenticated = true;