Skip to content

Commit

Permalink
checkpost modified
Browse files Browse the repository at this point in the history
  • Loading branch information
shohan-pherones committed Jul 7, 2023
1 parent 320a72c commit 2bc60b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/checkpost.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ const createJoiningReq = async (req, res) => {

const getAllReqs = async (req, res) => {
try {
const reqs = await Checkpost.find({}).populate("user").exec();
const reqs = await Checkpost.find({})
.sort({ createdAt: -1 })
.populate("user")
.exec();

if (!reqs) {
throw new Error("No request found.");
Expand Down
1 change: 1 addition & 0 deletions models/checkpost.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const checkpostSchema = new mongoose.Schema(
required: true,
},
status: {
type: String,
enum: ["pending", "approved", "denied"],
default: "pending",
required: true,
Expand Down

0 comments on commit 2bc60b7

Please sign in to comment.