Skip to content

Commit

Permalink
feat: setup messaging queue using bull and redis server
Browse files Browse the repository at this point in the history
  • Loading branch information
fktona committed Jul 24, 2024
2 parents 1897ddd + 83c22fd commit 8b57c82
Show file tree
Hide file tree
Showing 18 changed files with 1,052 additions and 89 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ temp/
env
src/entity
src/ormconfig.ts
build
build
issueformat.md
requests.rest
package-lock.json
90 changes: 90 additions & 0 deletions src/controllers/BlogController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,94 @@ export class BlogController {
});
}
}

async deleteBlogPost(req: Request, res: Response): Promise<void> {
try {
const { id } = req.params;
if (!id) {
res.status(401).json({
status_code: 401,
error: "Unauthorized",
});
}

const deletedPost = await this.blogService.deleteBlogPost(id);
if (!deletedPost) {
res.status(404).json({
status_code: 404,
error: "Blog post not found",
});
}

res.status(200).json({
status_code: 200,
message: "Blog post deleted successfully",
});
} catch (error) {
res.status(500).json({
status_code: 500,
error: "Internal server error",
details: error.message,
});
}
}

/**
* @swagger
* /api/v1/blog/{id}:
* delete:
* summary: Delete a blog post
* description: Delete a specific blog post by its ID
* tags: [Blog]
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* description: The ID of the blog post
* responses:
* 200:
* description: Blog post deleted successfully
* content:
* application/json:
* schema:
* type: object
* properties:
* status_code:
* type: integer
* example: 200
* message:
* type: string
* example: Blog post deleted successfully
* 404:
* description: Blog post not found
* content:
* application/json:
* schema:
* type: object
* properties:
* status_code:
* type: integer
* example: 404
* error:
* type: string
* example: Blog post not found
* 500:
* description: Internal server error
* content:
* application/json:
* schema:
* type: object
* properties:
* status_code:
* type: integer
* example: 500
* error:
* type: string
* example: Internal server error
* details:
* type: string
* example: Error message
*/
}
Loading

0 comments on commit 8b57c82

Please sign in to comment.