Skip to content

Commit

Permalink
Update app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ankithreddypati committed Dec 6, 2023
1 parent 1f34773 commit 551688b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ app.use(express.json());


// Create Assignment
app.post('/demo/assignments', authenticate, async (req, res) => {
app.post('/v3/assignments', authenticate, async (req, res) => {
try {
await sequelize.authenticate();
// Specify the fields you want to accept
Expand Down Expand Up @@ -355,7 +355,7 @@ app.post('/demo/assignments', authenticate, async (req, res) => {


// Delete Assignment by ID
app.delete('/demo/assignments/:id',rejectRequestsWithBody, authenticate, async (req, res) => {
app.delete('/v3/assignments/:id',rejectRequestsWithBody, authenticate, async (req, res) => {
try {
const assignmentId = req.params.id;

Expand Down Expand Up @@ -390,7 +390,7 @@ app.delete('/demo/assignments/:id',rejectRequestsWithBody, authenticate, async (


// Get Assignment by ID
app.get('/demo/assignments/:assignmentId', rejectRequestsWithBody, authenticate, async (req, res) => {
app.get('/v3/assignments/:assignmentId', rejectRequestsWithBody, authenticate, async (req, res) => {
try {
const assignmentId = req.params.assignmentId;

Expand All @@ -415,13 +415,13 @@ app.get('/demo/assignments/:assignmentId', rejectRequestsWithBody, authenticate,
}
});

app.patch('/demo/assignments/:id', (req, res) => {
app.patch('/v3/assignments/:id', (req, res) => {
res.status(405).json({ error: 'Update (PATCH) is not allowed' });

});

// Get all Assignments of a user by authentication
app.get('/demo/assignments',rejectRequestsWithBody, authenticate, async (req, res) => {
app.get('/v3/assignments',rejectRequestsWithBody, authenticate, async (req, res) => {
try {
// Use the authenticated user from the middleware
const authenticatedUser = req.user;
Expand All @@ -446,7 +446,7 @@ app.get('/demo/assignments',rejectRequestsWithBody, authenticate, async (req, re
}
});

app.put('/demo/assignments/:id', async (req, res) => {
app.put('/v3/assignments/:id', async (req, res) => {
try {
const assignmentId = req.params.id;
const updatedAssignmentData = req.body;
Expand Down Expand Up @@ -542,7 +542,7 @@ function publishToSNSTopic(message, topicArn) {
}


app.post('/demo/assignments/:id/submission', authenticate, async (req, res) => {
app.post('/v3/assignments/:id/submission', authenticate, async (req, res) => {
try {
const assignmentId = req.params.id;
const { submission_url } = req.body;
Expand Down

0 comments on commit 551688b

Please sign in to comment.