import { Request , Response } from 'express' ; import { container } from 'tsyringe' ; import { classToClass } from 'class-transformer' ; import UpdateProfileService from '@modules/users/services/UpdateProfileService' ; import ShowProfileService from '@modules/users/services/ShowProfileService' ; export default class Profilecontroller { public async show ( request , response ) { const user_id = request . user . id ; const showProfile = container . resolve ( ShowProfileService ) ; const user = await showProfile . execute ( { user_id } ) ; return response . json ( classToClass ( user ) ) ; } public async update ( request , response ) { const user_id = request . user . id ; const { name , email , old_password , password } = request . body ; const updateProfile = container . resolve ( UpdateProfileService ) ; const user = await updateProfile . execute ( { user_id , name , email , old_password , password , } ) ; return response . json ( classToClass ( user ) ) ; } }