Skip to content

Commit

Permalink
#230 [Backend] CURD Student CMS
Browse files Browse the repository at this point in the history
  • Loading branch information
fdhhhdjd committed Mar 24, 2023
2 parents b7a4745 + 498a040 commit 4ac50c9
Show file tree
Hide file tree
Showing 63 changed files with 2,139 additions and 409 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ paths:
post:
summary: Create categories
tags: [Create categories]
operationId: createcategories
operationId: createCategories
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const authorController = {
const { author_id, name, avatar_uri, dob, gender } = req.body.input.author_input;

// Check input
if (!author_id) {
if (!author_id || !HELPER.validateBigInt(author_id)) {
return res.status(CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST).json({
status: CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST,
message: returnReasons(CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const bookController = {
} = req.body.input.book_input;

// Check input
if (!book_id) {
if (!book_id || !HELPER.validateBigInt(book_id)) {
return res.status(CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST).json({
status: CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST,
message: returnReasons(CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST),
Expand Down Expand Up @@ -163,7 +163,11 @@ const bookController = {
let err;
let result;
[err, result] = await HELPER.handleRequest(
book_model.updateBook(data_update, { book_id }, { book_id: 'book_id' }),
book_model.updateBook(
data_update,
{ book_id, isdeleted: CONSTANTS.DELETED_DISABLE },
{ book_id: 'book_id' },
),
);
if (result) {
// Create key Cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ const BorrowBookController = {
* @return {Object:{Number,String}
*/
updateBorrowBook: async (req, res) => {
const {
book_id,
user_id,
start_date,
due_date,
status,
} = req.body.input.borrow_book_input;
const { book_id, user_id, start_date, due_date, status } = req.body.input.borrow_book_input;

// Check input
if (!book_id || !user_id || !start_date || !due_date || !status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const categoriesController = {
const { category_id, name } = req.body.input.categories_input;

// Check input
if (!category_id) {
if (!category_id || !HELPER.validateBigInt(category_id)) {
return res.status(CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST).json({
status: CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST,
message: returnReasons(CONSTANTS.HTTP.STATUS_4XX_BAD_REQUEST),
Expand Down
Loading

0 comments on commit 4ac50c9

Please sign in to comment.