Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-029
2023-029
Commits
8081474a
Commit
8081474a
authored
Sep 07, 2023
by
janithgamage1.ed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
Desc : update project
parent
47720cbe
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
2368 additions
and
1097 deletions
+2368
-1097
Project/Backend/Server_Node/controllers/curriculum.controller.js
.../Backend/Server_Node/controllers/curriculum.controller.js
+0
-1
Project/Backend/Server_Node/package-lock.json
Project/Backend/Server_Node/package-lock.json
+477
-0
Project/Backend/Server_Node/package.json
Project/Backend/Server_Node/package.json
+2
-0
Project/Backend/Server_Node/routes/curriculum.routes.js
Project/Backend/Server_Node/routes/curriculum.routes.js
+117
-0
Project/Backend/Server_Node/routes/feedback.routes.js
Project/Backend/Server_Node/routes/feedback.routes.js
+47
-0
Project/Backend/Server_Node/routes/leaderboard.routes.js
Project/Backend/Server_Node/routes/leaderboard.routes.js
+14
-0
Project/Backend/Server_Node/routes/marksCalculator.routes.js
Project/Backend/Server_Node/routes/marksCalculator.routes.js
+43
-2
Project/Backend/Server_Node/routes/tutorial.routes.js
Project/Backend/Server_Node/routes/tutorial.routes.js
+120
-3
Project/Backend/Server_Node/routes/user.routes.js
Project/Backend/Server_Node/routes/user.routes.js
+185
-3
Project/Backend/Server_Node/routes/userProgress.routes.js
Project/Backend/Server_Node/routes/userProgress.routes.js
+71
-0
Project/Backend/Server_Node/server.js
Project/Backend/Server_Node/server.js
+29
-1
Project/Backend/Server_Node/yarn.lock
Project/Backend/Server_Node/yarn.lock
+1263
-1087
No files found.
Project/Backend/Server_Node/controllers/curriculum.controller.js
View file @
8081474a
...
...
@@ -45,7 +45,6 @@ export const createCurriculum = async (req, res) => {
}
}
export
const
updateCurriculum
=
async
(
req
,
res
)
=>
{
const
{
id
}
=
req
.
params
;
const
updatedCurriculum
=
req
.
body
;
...
...
Project/Backend/Server_Node/package-lock.json
View file @
8081474a
This diff is collapsed.
Click to expand it.
Project/Backend/Server_Node/package.json
View file @
8081474a
...
...
@@ -22,6 +22,8 @@
"nodemailer"
:
"^6.9.1"
,
"nodemon"
:
"^2.0.22"
,
"react-mic"
:
"^12.4.6"
,
"swagger-jsdoc"
:
"^6.2.8"
,
"swagger-ui-express"
:
"^5.0.0"
,
"torch"
:
"^0.2.7"
,
"uuid"
:
"^9.0.0"
}
...
...
Project/Backend/Server_Node/routes/curriculum.routes.js
View file @
8081474a
...
...
@@ -9,10 +9,127 @@ import {
const
router
=
express
.
Router
();
/**
* @swagger
* /rest_node/curriculum:
* get:
* summary: Get all curriculums
* description: Retrieve a list of all curriculums along with their tutorials.
* tags:
* - Curriculum
* responses:
* 200:
* description: Successful response with curriculum data.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/
'
,
getAllCurriculums
);
/**
* @swagger
* /rest_node/curriculum/{id}:
* get:
* summary: Get a curriculum by ID
* description: Retrieve a curriculum by its ID along with its tutorials.
* tags:
* - Curriculum
* parameters:
* - in: path
* name: id
* description: Curriculum ID to fetch
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Successful response with curriculum data.
* 404:
* description: Curriculum not found.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/:id
'
,
getCurriculumById
);
/**
* @swagger
* /rest_node/curriculum:
* post:
* summary: Create a new curriculum
* description: Create a new curriculum along with calculating its total tutorial mark.
* tags:
* - Curriculum
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/Curriculum'
* responses:
* 201:
* description: Curriculum created successfully.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/
'
,
createCurriculum
);
/**
* @swagger
* /rest_node/curriculum/{id}:
* put:
* summary: Update a curriculum by ID
* description: Update a curriculum by its ID along with recalculating its total tutorial mark.
* tags:
* - Curriculum
* parameters:
* - in: path
* name: id
* description: Curriculum ID to update
* required: true
* schema:
* type: string
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/Curriculum'
* responses:
* 200:
* description: Curriculum updated successfully.
* 404:
* description: Curriculum not found.
* 500:
* description: Internal server error.
*/
router
.
put
(
'
/:id
'
,
updateCurriculum
);
/**
* @swagger
* /rest_node/curriculum/{id}:
* delete:
* summary: Delete a curriculum by ID
* description: Delete a curriculum by its ID.
* tags:
* - Curriculum
* parameters:
* - in: path
* name: id
* description: Curriculum ID to delete
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Curriculum deleted successfully.
* 404:
* description: Curriculum not found.
* 500:
* description: Internal server error.
*/
router
.
delete
(
'
/:id
'
,
deleteCurriculum
);
export
default
router
;
Project/Backend/Server_Node/routes/feedback.routes.js
View file @
8081474a
...
...
@@ -3,7 +3,54 @@ import { createFeedback, getFeedbackForEntity } from '../controllers/feedback.co
const
router
=
express
.
Router
();
/**
* @swagger
* /rest_node/feedback:
* post:
* summary: Create feedback for an entity
* description: Create feedback for a specific entity.
* tags:
* - Feedback
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/FeedbackInput'
* responses:
* 201:
* description: Feedback created successfully.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/
'
,
createFeedback
);
/**
* @swagger
* /rest_node/feedback/{entityId}:
* get:
* summary: Get feedback for an entity
* description: Retrieve feedback for a specific entity based on its ID.
* tags:
* - Feedback
* parameters:
* - in: path
* name: entityId
* description: Entity ID to fetch feedback for
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Successful response with feedback data.
* 404:
* description: Feedback not found for the specified entity.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/:entityId
'
,
getFeedbackForEntity
);
export
default
router
;
Project/Backend/Server_Node/routes/leaderboard.routes.js
View file @
8081474a
...
...
@@ -3,6 +3,20 @@ import { getGlobalLeaderboard } from '../controllers/leaderboard.controller.js';
const
router
=
express
.
Router
();
/**
* @swagger
* /rest_node/leaderboard/global:
* get:
* summary: Get global leaderboard
* description: Retrieve the global leaderboard data.
* tags:
* - Lead Board
* responses:
* 200:
* description: Successful response with global leaderboard data.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/global
'
,
getGlobalLeaderboard
);
export
default
router
;
Project/Backend/Server_Node/routes/marksCalculator.routes.js
View file @
8081474a
...
...
@@ -8,6 +8,47 @@ const upload = multer({ storage: storage });
const
router
=
express
.
Router
();
router
.
post
(
'
/curriculum/:curriculumIndex/tutorial/:tutorialIndex
'
,
upload
.
single
(
'
image
'
),
marksCalculator
)
/**
* @swagger
* /rest_node/marks-calculator/curriculum/{curriculumIndex}/tutorial/{tutorialIndex}:
* post:
* summary: Calculate marks for a tutorial
* description: Calculate marks for a tutorial within a curriculum.
* tags:
* - Score Calculator
* parameters:
* - in: path
* name: curriculumIndex
* description: Index of the curriculum
* required: true
* schema:
* type: integer
* - in: path
* name: tutorialIndex
* description: Index of the tutorial
* required: true
* schema:
* type: integer
* requestBody:
* required: true
* content:
* multipart/form-data:
* schema:
* type: object
* properties:
* image:
* type: string
* format: binary
* required:
* - image
* responses:
* 200:
* description: Marks calculated successfully.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/curriculum/:curriculumIndex/tutorial/:tutorialIndex
'
,
upload
.
single
(
'
image
'
),
marksCalculator
);
export
default
router
;
Project/Backend/Server_Node/routes/tutorial.routes.js
View file @
8081474a
import
express
from
"
express
"
;
import
{
createTutorial
,
deleteTutorial
,
getAllTutorials
,
getTutorialById
,
createTutorial
,
updateTutorial
,
deleteTutorial
updateTutorial
}
from
"
../controllers/tutorial.controller.js
"
;
const
router
=
express
.
Router
();
/**
* @swagger
* /rest_node/tutorial:
* get:
* summary: Get all tutorials
* description: Retrieve a list of all tutorials.
* tags:
* - Tutorial
* responses:
* 200:
* description: Successful response with tutorial data.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/
'
,
getAllTutorials
);
/**
* @swagger
* /rest_node/tutorial/{id}:
* get:
* summary: Get a tutorial by ID
* description: Retrieve a tutorial by its ID.
* tags:
* - Tutorial
* parameters:
* - in: path
* name: id
* description: Tutorial ID to fetch
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Successful response with tutorial data.
* 404:
* description: Tutorial not found.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/:id
'
,
getTutorialById
);
/**
* @swagger
* /rest_node/tutorial:
* post:
* summary: Create a new tutorial
* description: Create a new tutorial.
* tags:
* - Tutorial
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/TutorialInput'
* responses:
* 201:
* description: Tutorial created successfully.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/
'
,
createTutorial
);
/**
* @swagger
* /rest_node/tutorial/{id}:
* put:
* summary: Update a tutorial by ID
* description: Update a tutorial by its ID.
* tags:
* - Tutorial
* parameters:
* - in: path
* name: id
* description: Tutorial ID to update
* required: true
* schema:
* type: string
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/TutorialInput'
* responses:
* 200:
* description: Tutorial updated successfully.
* 404:
* description: Tutorial not found.
* 500:
* description: Internal server error.
*/
router
.
put
(
'
/:id
'
,
updateTutorial
);
/**
* @swagger
* /rest_node/tutorial/{id}:
* delete:
* summary: Delete a tutorial by ID
* description: Delete a tutorial by its ID.
* tags:
* - Tutorial
* parameters:
* - in: path
* name: id
* description: Tutorial ID to delete
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Tutorial deleted successfully.
* 404:
* description: Tutorial not found.
* 500:
* description: Internal server error.
*/
router
.
delete
(
'
/:id
'
,
deleteTutorial
);
export
default
router
;
Project/Backend/Server_Node/routes/user.routes.js
View file @
8081474a
...
...
@@ -4,13 +4,195 @@ import auth from "../middleware/auth.middleware.js";
const
router
=
express
.
Router
();
router
.
post
(
'
/sign-in
'
,
signIn
)
router
.
post
(
'
/sign-up
'
,
signUp
)
/**
* @swagger
* /rest_node/user/sign-in:
* post:
* summary: Sign in
* description: Sign in to the application.
* tags:
* - User
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/SignInInput'
* responses:
* 200:
* description: Sign in successful.
* 400:
* description: Bad request, check your input data.
* 401:
* description: Unauthorized, invalid credentials.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/sign-in
'
,
signIn
);
/**
* @swagger
* /rest_node/user/sign-up:
* post:
* summary: Sign up
* description: Sign up for a new user account.
* tags:
* - User
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/SignUpInput'
* responses:
* 201:
* description: Sign up successful.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/sign-up
'
,
signUp
);
/**
* @swagger
* /rest_node/user/all:
* get:
* summary: Get all users
* description: Retrieve a list of all users.
* tags:
* - User
* responses:
* 200:
* description: Successful response with user data.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/all
'
,
getUsers
);
/**
* @swagger
* /rest_node/user/current-user:
* get:
* summary: Get current user
* description: Retrieve information about the current authenticated user.
* tags:
* - User
* responses:
* 200:
* description: Successful response with current user data.
* 401:
* description: Unauthorized, authentication required.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/current-user
'
,
auth
,
currentUser
);
/**
* @swagger
* /rest_node/user/{id}:
* get:
* summary: Get user by ID
* description: Retrieve a user by their ID.
* tags:
* - User
* parameters:
* - in: path
* name: id
* description: User ID to fetch
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Successful response with user data.
* 404:
* description: User not found.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/:id
'
,
getUser
);
/**
* @swagger
* /rest_node/user/all/type/{userType}:
* get:
* summary: Get users by user type
* description: Retrieve users based on their user type.
* tags:
* - User
* parameters:
* - in: path
* name: userType
* description: User type to filter users by
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Successful response with filtered user data.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/all/type/:userType
'
,
getUserAccordingToType
);
/**
* @swagger
* /rest_node/user/{id}:
* put:
* summary: Update user by ID
* description: Update a user by their ID.
* tags:
* - User
* parameters:
* - in: path
* name: id
* description: User ID to update
* required: true
* schema:
* type: string
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/UserUpdateInput'
* responses:
* 200:
* description: User updated successfully.
* 404:
* description: User not found.
* 500:
* description: Internal server error.
*/
router
.
put
(
'
/:id
'
,
updateUser
);
/**
* @swagger
* /rest_node/user/{id}:
* delete:
* summary: Delete user by ID
* description: Delete a user by their ID.
* tags:
* - User
* parameters:
* - in: path
* name: id
* description: User ID to delete
* required: true
* schema:
* type: string
* responses:
* 200:
* description: User deleted successfully.
* 404:
* description: User not found.
* 500:
* description: Internal server error.
*/
router
.
delete
(
'
/:id
'
,
deleteUser
);
export
default
router
;
Project/Backend/Server_Node/routes/userProgress.routes.js
View file @
8081474a
...
...
@@ -3,8 +3,79 @@ import { getUserProgress, subscribeCurriculum, updateTaskItemProgress } from "..
const
router
=
express
.
Router
();
/**
* @swagger
* /rest_node/user-progress/subscribe-curriculum:
* post:
* summary: Subscribe to a curriculum
* description: Subscribe a user to a curriculum to track their progress.
* tags:
* - User Progress
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/SubscribeCurriculumInput'
* responses:
* 200:
* description: User subscribed to the curriculum successfully.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
post
(
'
/subscribe-curriculum
'
,
subscribeCurriculum
);
/**
* @swagger
* /rest_node/user-progress/{userId}:
* get:
* summary: Get user progress
* description: Retrieve the progress of a user by their ID.
* tags:
* - User Progress
* parameters:
* - in: path
* name: userId
* description: User ID to fetch progress for
* required: true
* schema:
* type: string
* responses:
* 200:
* description: Successful response with user progress data.
* 404:
* description: User not found or progress not available.
* 500:
* description: Internal server error.
*/
router
.
get
(
'
/:userId
'
,
getUserProgress
);
/**
* @swagger
* /rest_node/user-progress/update-task-item-progress:
* put:
* summary: Update task item progress
* description: Update the progress of a task item for a user.
* tags:
* - User Progress
* requestBody:
* required: true
* content:
* application/json:
* schema:
* # You can define the schema separately.
* $ref: '#/components/schemas/UpdateTaskItemProgressInput'
* responses:
* 200:
* description: Task item progress updated successfully.
* 400:
* description: Bad request, check your input data.
* 500:
* description: Internal server error.
*/
router
.
put
(
'
/update-task-item-progress
'
,
updateTaskItemProgress
);
export
default
router
;
Project/Backend/Server_Node/server.js
View file @
8081474a
...
...
@@ -3,9 +3,35 @@ import cors from "cors";
import
dotenv
from
"
dotenv
"
;
import
express
from
"
express
"
;
import
mongoose
from
"
mongoose
"
;
import
multer
from
"
multer
"
;
//swagger doc
import
swaggerJsdoc
from
"
swagger-jsdoc
"
;
import
swaggerUi
from
"
swagger-ui-express
"
;
const
swaggerOptions
=
{
swaggerDefinition
:
{
info
:
{
title
:
"
Sign Connect Plus API Documentation
"
,
version
:
"
1.0.0
"
,
description
:
"
Documentation for Sign Connect Plus Node Backend API
"
,
},
basePath
:
"
/rest_node
"
,
// Specify the base path of your API
},
apis
:
[
"
./routes/curriculum.routes.js
"
,
"
./routes/feedback.routes.js
"
,
"
./routes/leaderboard.routes.js
"
,
"
./routes/marksCalculator.routes.js
"
,
"
./routes/translate.routes.js
"
,
"
./routes/tutorial.routes.js
"
,
"
./routes/user.routes.js
"
,
"
./routes/userProgress.routes.js
"
,
],
};
const
swaggerSpec
=
swaggerJsdoc
(
swaggerOptions
);
// Set up storage for uploaded images
const
storage
=
multer
.
memoryStorage
();
const
upload
=
multer
({
storage
:
storage
});
...
...
@@ -47,6 +73,8 @@ app.use("/rest_node/feedback", feedbackRoutes);
app
.
use
(
"
/rest_node/leaderboard
"
,
leaderboardRoutes
);
app
.
use
(
"
/rest_node/marks-calculator
"
,
marksCalculatorRoutes
);
app
.
use
(
"
/api-docs
"
,
swaggerUi
.
serve
,
swaggerUi
.
setup
(
swaggerSpec
));
const
CONNECTION_URL
=
`mongodb+srv://
${
process
.
env
.
DB_USERNAME
}
:
${
process
.
env
.
DB_PASSWORD
}
@researchmanagement-appl.vzhn4.mongodb.net/?retryWrites=true&w=majority`
;
const
PORT
=
process
.
env
.
PORT
||
5000
;
...
...
Project/Backend/Server_Node/yarn.lock
View file @
8081474a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment