import Training from '#models/training';
export default class TrainingsController {
    async index({ response }) {
        const trainings = await Training.query()
            .preload('projects')
            .orderBy('start', 'desc');
        return response.ok({
            data: trainings.map((t) => ({
                name: t.name,
                start: t.start?.toISODate() ?? null,
                end: t.end?.toISODate() ?? null,
                skill: t.skill,
                place: t.place,
                projects: t.projects,
            })),
        });
    }
}
//# sourceMappingURL=trainings_controller.js.map