Skip to content

Commit

Permalink
Merge branch 'MEP-4859' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrMurdzia committed Apr 17, 2024
2 parents de7d8f3 + ef98051 commit 6e44367
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Credentials/controllers/fetching/Create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { checkIfRequestBodyExists, checkIfTypeIsString } from "../../../_common/utils/Request.utils";
import { checkFetchingRequestBodyParamsForCreateOrUpdate } from "../../../_common/utils/FetchingRequest.utils";

import Credential from '../../../_common/models/Credential.model';
import { HttpRequest } from "@azure/functions";
import { Password } from '../../models/Password';
import { checkFetchingRequestBodyParamsForCreateOrUpdate } from "../../../_common/utils/FetchingRequest.utils";
import { throwIfDatabaseResourceExists } from "../../../_common/utils/DatabaseResponse.utils";

export const create = async (req: HttpRequest) => {
Expand Down Expand Up @@ -36,6 +36,9 @@ export const create = async (req: HttpRequest) => {
body: {
status: 'Created',
description: 'New resource created successfully.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
3 changes: 2 additions & 1 deletion Credentials/controllers/receiving/Get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const getReceive = async (req: HttpRequest) => {
status: 404,
body: {
status: 'Not found',
description: 'Resource with the provided id_connection does not exist.'
field_name: 'id_account',
description: 'Resource with the provided id_account does not exist.'
},
headers: {
'Content-Type': 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion Credentials/controllers/receiving/Remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const removeReceive = async (req: HttpRequest) => {
status: 404,
body: {
status: 'Not found',
description: 'Resource with the provided id_connection does not exist.'
description: 'Resource with the provided id_account does not exist.'
},
headers: {
'Content-Type': 'application/json'
Expand Down
1 change: 1 addition & 0 deletions Credentials/controllers/receiving/Update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const updateReceive = async (req: HttpRequest) => {
status: 404,
body: {
status: 'Not found',
field_name: 'id_account',
description: 'Resource with the provided id_account does not exist.'
},
headers: {
Expand Down
2 changes: 2 additions & 0 deletions _common/utils/FetchingRequest.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const checkFetchingRequestBodyParamsForDelete = (id_connection: string) =
status: 400,
body: {
status: 'Bad Request',
field_name: 'id_connection',
description: returnRequiredParamsErrorMessage(['id_connection'], 'body')
},
headers: {
Expand Down Expand Up @@ -36,6 +37,7 @@ export const checkFetchingRequestQueryParamsForGetOrDelete = (id_connection: str
status: 400,
body: {
status: 'Bad Request',
field_name: 'id_connection',
description: returnRequiredParamsErrorMessage(['id_connection'], 'query')
},
headers: {
Expand Down
2 changes: 2 additions & 0 deletions _common/utils/Request.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const checkIfTypeIsString = (value: any, field_name: string) => {
status: 400,
body: {
status: 'Bad Request',
field_name: field_name,
description: `Invalid data format: ${field_name} must be a string.`
},
headers: {
Expand Down Expand Up @@ -56,6 +57,7 @@ export const checkIfTypeIsNumber = (value: any, field_name: string) => {
status: 400,
body: {
status: 'Bad Request',
field_name: field_name,
description: `Invalid data format: ${field_name} must be a number.`
},
headers: {
Expand Down

0 comments on commit 6e44367

Please sign in to comment.