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 565c20a + 90970c8 commit de7d8f3
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Credentials/controllers/receiving/Create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export const createReceive = async (req: HttpRequest) => {
body: {
status: 'Created',
description: 'New resource created successfully.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
9 changes: 9 additions & 0 deletions Credentials/controllers/receiving/Get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const getReceive = async (req: HttpRequest) => {
body: {
status: 'Not found',
description: 'Resource with the provided id_connection does not exist.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -31,6 +34,9 @@ export const getReceive = async (req: HttpRequest) => {
body: {
status: 'OK',
payload: response_from_db
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -44,6 +50,9 @@ export const getReceive = async (req: HttpRequest) => {
body: {
status: 'Internal error',
description: 'An unexpected error occurred. Please try again later.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand Down
3 changes: 3 additions & 0 deletions Credentials/controllers/receiving/GetAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export const getAllReceive = async (req: HttpRequest) => {
body: {
status: 'Internal error',
description: 'An unexpected error occurred. Please try again later.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand Down
9 changes: 9 additions & 0 deletions Credentials/controllers/receiving/Remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const removeReceive = async (req: HttpRequest) => {
body: {
status: 'Not found',
description: 'Resource with the provided id_connection does not exist.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -38,6 +41,9 @@ export const removeReceive = async (req: HttpRequest) => {
body: {
status: 'Internal error',
description: 'An unexpected error occurred. Please try again later.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -47,6 +53,9 @@ export const removeReceive = async (req: HttpRequest) => {
body: {
status: 'OK',
description: 'Resource deleted successfully.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
6 changes: 6 additions & 0 deletions Credentials/controllers/receiving/Update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export const updateReceive = async (req: HttpRequest) => {
body: {
status: 'Not found',
description: 'Resource with the provided id_account does not exist.'
},
headers: {
'Content-Type': 'application/json'
}
}
}
Expand All @@ -47,6 +50,9 @@ export const updateReceive = async (req: HttpRequest) => {
body: {
status: 'OK',
description: 'Resource updated successfully.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
6 changes: 6 additions & 0 deletions _common/utils/DatabaseResponse.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const throwIfDatabaseResourceExists = (object: any, file_name: string) =>
body: {
status: 'Conflict',
description: `Resource with the provided ${file_name} already exists.`
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -29,6 +32,9 @@ export const throwIfDatabaseResourceNotExists = (object: any, file_name: string)
body: {
status: 'Not Found',
description: `Resource with the provided ${file_name} does not exists.`
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand Down
11 changes: 10 additions & 1 deletion _common/utils/FetchingRequest.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export const checkFetchingRequestBodyParamsForDelete = (id_connection: string) =
body: {
status: 'Bad Request',
description: returnRequiredParamsErrorMessage(['id_connection'], 'body')
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -19,6 +22,9 @@ export const checkFetchingRequestBodyParamsForCreateOrUpdate = (id_connection: s
body: {
status: 'Bad Request',
description: returnRequiredParamsErrorMessage(['id_connection', 'password'], 'body')
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -31,7 +37,10 @@ export const checkFetchingRequestQueryParamsForGetOrDelete = (id_connection: str
body: {
status: 'Bad Request',
description: returnRequiredParamsErrorMessage(['id_connection'], 'query')
},
headers: {
'Content-Type': 'application/json'
}
};
}
}
}
9 changes: 9 additions & 0 deletions _common/utils/ReceivingRequest.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export const checkReceivingRequestQueryParamsForGet = (uuid: string) => {
body: {
status: 'Bad Request',
description: returnRequiredParamsErrorMessage(['uuid'], 'query')
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -19,6 +22,9 @@ export const checkReceivingRequestBodyParamsForDelete = (uuid: string) => {
body: {
status: 'Bad Request',
description: returnRequiredParamsErrorMessage(['uuid'], 'body')
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -31,6 +37,9 @@ export const checkReceivingRequestBodyParamsForCreateOrUpdate = (uuid: string, u
body: {
status: 'Bad Request',
description: returnRequiredParamsErrorMessage(['uuid', 'username, id_account'], 'body')
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand Down
9 changes: 9 additions & 0 deletions _common/utils/Request.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const checkIfTypeIsString = (value: any, field_name: string) => {
body: {
status: 'Bad Request',
description: `Invalid data format: ${field_name} must be a string.`
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -33,6 +36,9 @@ export const checkIfRequestBodyExists = (body: any) => {
body: {
status: 'Bad Request',
description: 'Request body is missing.'
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand All @@ -51,6 +57,9 @@ export const checkIfTypeIsNumber = (value: any, field_name: string) => {
body: {
status: 'Bad Request',
description: `Invalid data format: ${field_name} must be a number.`
},
headers: {
'Content-Type': 'application/json'
}
};
}
Expand Down

0 comments on commit de7d8f3

Please sign in to comment.