diff --git a/src/http/controllers/orgs/authOrgsController.ts b/src/http/controllers/orgs/authOrgsController.ts index 83d30af..a5dfb5c 100644 --- a/src/http/controllers/orgs/authOrgsController.ts +++ b/src/http/controllers/orgs/authOrgsController.ts @@ -17,7 +17,7 @@ export const authOrgsController = async ( try { const authOrgsUseCase = makeAuthOrgsUseCase(); - authOrgsUseCase.execute(bodyData); + await authOrgsUseCase.execute(bodyData); } catch (error) { diff --git a/src/http/controllers/orgs/createOrgsController.ts b/src/http/controllers/orgs/createOrgsController.ts index 1a7f189..7aa466b 100644 --- a/src/http/controllers/orgs/createOrgsController.ts +++ b/src/http/controllers/orgs/createOrgsController.ts @@ -27,7 +27,7 @@ export const createOrgsController = async ( try { const createOrgsUseCase = makeCreateOrgsUseCase(); - createOrgsUseCase.execute(bodyData); + await createOrgsUseCase.execute(bodyData); } catch (error) { diff --git a/src/http/controllers/orgs/getOrgsProfileController.ts b/src/http/controllers/orgs/getOrgsProfileController.ts index 93bb72a..00033fa 100644 --- a/src/http/controllers/orgs/getOrgsProfileController.ts +++ b/src/http/controllers/orgs/getOrgsProfileController.ts @@ -1,6 +1,4 @@ -import { ResourceNotFoundErrors } from '@/use-cases/errors/resourceNotFound'; -import { GetOrgsProfileUseCase } from './../../../use-cases/orgs/getOrgsProfileUseCase'; -import { InvalidCredentialsError } from "@/use-cases/errors/invalidCredentialsError"; +import { ResourceNotFoundError } from '@/use-cases/errors/resourceNotFound'; import { makeAuthOrgsUseCase } from "@/use-cases/factories/makeAuthOrgsUseCase"; import { makeGetOrgsProfileUseCase } from "@/use-cases/factories/makeGetProfileOrgsUseCase"; import { FastifyReply, FastifyRequest } from "fastify"; @@ -14,17 +12,17 @@ export const getOrgsProfileController = async ( orgId: z.string() }); - const bodyData = getOrgsProfileBodySchema.parse(request.body); + const paramsData = getOrgsProfileBodySchema.parse(request.params); try { const getOrgsProfileUseCase = makeGetOrgsProfileUseCase(); - const org = getOrgsProfileUseCase.execute(bodyData); + const { org } = await getOrgsProfileUseCase.execute(paramsData); reply.status(200).send(org); } catch (error) { - if (error instanceof ResourceNotFoundErrors) + if (error instanceof ResourceNotFoundError) { return reply.status(404).send(error.message); } diff --git a/src/http/controllers/orgs/orgsRoutes.ts b/src/http/controllers/orgs/orgsRoutes.ts index 19948af..c6b4bc7 100644 --- a/src/http/controllers/orgs/orgsRoutes.ts +++ b/src/http/controllers/orgs/orgsRoutes.ts @@ -6,5 +6,5 @@ import { getOrgsProfileController } from "./getOrgsProfileController"; export const orgsRoutes = async (app: FastifyInstance) => { app.post('/orgs', createOrgsController); app.post('/orgs/auth', authOrgsController); - app.get('/orgs', getOrgsProfileController); + app.get('/orgs/:orgId', getOrgsProfileController); } \ No newline at end of file