import { Request , Response } from 'express' ; import { container } from 'tsyringe' ; import CreateAppointmentService from '@modules/appointments/services/CreateAppointmentService' ; export default class AppointmentsController { public async create ( request , response ) { const user_id = request . user . id ; const { provider_id , date } = request . body ; const createAppointment = container . resolve ( CreateAppointmentService ) ; const appointment = await createAppointment . execute ( { date , provider_id , user_id , } ) ; return response . json ( appointment ) ; } }