Skip to content

Commit 0f4da0a

Browse files
Merge pull request #450 from tcet-opensource/development
Biweekly Merge
2 parents aa2379a + 09824b0 commit 0f4da0a

File tree

102 files changed

+3943
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3943
-459
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules
22
coverage
33
logs
4-
.env
4+
.env

.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
PORT=4000
2+
TOKEN_SECRET=mysecret
3+
ENVIRONMENT=local
4+
DB_URL=mongodb://mongo1:30001,mongo2:30002,mongo3:30003/?replicaSet=my-replica-set
5+
EMAIL_HOST=
6+
EMAIL_PORT=
7+
EMAIL_USER=
8+
EMAIL_PASS=
9+
10+
# get email stuff from mailtrap

.eslintrc.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ module.exports = {
2222
"alias": {
2323
"map": [
2424
["#app", "./app.js"],
25-
["#util", "./util.js"],
26-
["#constant", "./constant.js"],
25+
["#util", "./misc/util.js"],
26+
["#constant", "./misc/constant.js"],
2727
["#routes", "./routes"],
2828
["#models", "./models"],
2929
["#middleware", "./middleware"],
3030
["#controller", "./controller"],
3131
["#services", "./services"],
32-
["#error", "./error"]
32+
["#error", "./error"],
33+
["#misc", "./misc"],
34+
["#mockDB", "./misc/mockDB"]
3335
],
3436
"extensions": [".js"]
3537
}

.github/workflows/dockerhub.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Dockerhub
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Uploading Img
15+
timeout-minutes: 30
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Building Docker Image
21+
run: docker build -t ${{ secrets.username }}/erp-backend:prod .
22+
- name: DockerHub Login
23+
run: docker login -u ${{ secrets.username }} -p ${{ secrets.pass }}
24+
- name: Uploading Image to DockerHub
25+
run: docker push ${{ secrets.username }}/erp-backend:prod

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,7 @@ dist
130130
.pnp.*
131131

132132
# ingore genrated APIdocs
133-
apidoc
133+
apidoc
134+
135+
# data generated by mongo replicas
136+
data/

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN npm ci
88

99
COPY . .
1010

11-
EXPOSE 3500
12-
CMD ["npm", "run", "start"]
11+
EXPOSE 4000
12+
CMD ["npm", "run", "serverstart"]
1313

1414

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TCET ERP System
22

3-
TCET ERP System is a project that aims to simplify and automate daily operation in TCET.
3+
TCET ERP System is a project that aims to simplify and automate daily operations in TCET.
44

55
This ERP system will be used to manage various aspects of the operations of colleges, including admissions, registration, student records, financial aid, course scheduling, and fees. The ERP system would typically consist of multiple integrated modules that support these functions.
66

@@ -32,7 +32,7 @@ node -e "console.log(require('crypto').randomBytes(256).toString('base64'));
3232
Set this on 'local'
3333

3434
`DB_URL`
35-
For this parameter you will need to open your account on MongoDB Atlas, don't forget to note down you account password, then create new cluster and through that you will get your connection string which will be your DB_URL in .env, make sure instead of "password" in connection string, you enter your own account password.
35+
For this parameter, you will need to open your account on MongoDB Atlas, don't forget to note down your account password, then create new cluster and through that you will get your connection string which will be your DB_URL in .env, make sure instead of "password" in connection string, you enter your own account password.
3636

3737
`EMAIL_HOST`,
3838
`EMAIL_PORT`,

_apidoc.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
* @apiBody {String} wing The wing where the infrastructure is located.
173173
* @apiBody {Number} floor The floor where the infrastructure is located.
174174
* @apiBody {Number} capacity The capacity of the infrastructure.
175+
* @apiBody {connector.Schema.Types.ObjectId} organization The organization which is associated.
175176
*
176177
* @apiSuccess {String} res Success message with the ID of the added infrastructure.
177178
*
@@ -198,6 +199,7 @@
198199
* @apiSuccess {String} infrastructure.wing Wing of Infrastructure. One of possible A,B,C.
199200
* @apiSuccess {Number} infrastructure.floor Floor of Infrastructure.
200201
* @apiSuccess {Number} infrastructure.capacity Capacity of Infrastructure.
202+
* @apiSuccess {connector.Schema.Types.ObjectId} department.organization associated Organization.
201203
*/
202204

203205
/**
@@ -226,6 +228,7 @@
226228
* @apiBody {String} [wing] The wing where the infrastructure is located.
227229
* @apiBody {Number} [floor] The floor where the infrastructure is located.
228230
* @apiBody {Number} [capacity] The capacity of the infrastructure.
231+
* @apiSuccess {connector.Schema.Types.ObjectId} department.organization associated Organization.
229232
*
230233
* @apiSuccess {String} res infrastructure updated.
231234
* @apiError (Error 500) err Error in updating database
@@ -432,6 +435,7 @@
432435
* @apiBody {Date} yearOfStarting The year of establishment of the Department.
433436
* @apiBody {connector.Schema.Types.ObjectId} accreditations The accreditation which is associated.
434437
* @apiBody {connector.Schema.Types.ObjectId} infrastructure The infrastructure which is associated.
438+
* @apiBody {connector.Schema.Types.ObjectId} organization The organization which is associated.
435439
*
436440
* @apiSuccess {String} res added Department successfully.
437441
*
@@ -450,6 +454,7 @@
450454
* @apiBody {Date} [yearOfStarting] The year of establishment of the Department.
451455
* @apiBody {connector.Schema.Types.ObjectId} [accreditations] Accreditation which is associated.
452456
* @apiBody {connector.Schema.Types.ObjectId} [infrastructure] Infrastructure which is associated.
457+
* @apiBody {connector.Schema.Types.ObjectId} organization The organization which is associated.
453458
*
454459
* @apiSuccess {Department[]} res Array of Filtered Department Doc .
455460
* @apiSuccess {String} department._id ID of document given by database.
@@ -458,6 +463,7 @@
458463
* @apiSuccess {Date} department.yearOfStarting The year of establishment of the Department.
459464
* @apiSuccess {connector.Schema.Types.ObjectId} department.accreditations associated Accreditation.
460465
* @apiSuccess {connector.Schema.Types.ObjectId} department.infrastructure associatedInfrastructure.
466+
* @apiSuccess {connector.Schema.Types.ObjectId} department.organization associated Organization.
461467
* @apiError (Error 500) err Error while fetching the data.
462468
*/
463469

@@ -488,6 +494,7 @@
488494
* @apiSuccess {Date} department.yearOfStarting The year of establishment of the Department.
489495
* @apiSuccess {connector.Schema.Types.ObjectId} department.accreditations associated Accreditation.
490496
* @apiSuccess {connector.Schema.Types.ObjectId} department.infrastructure associatedInfrastructure.
497+
* @apiSuccess {connector.Schema.Types.ObjectId} department.organization associated Organization.
491498
*
492499
* @apiSuccess {String} res updated infrastructure with id.
493500
* @apiError (Error 500) err Error while inserting in DB
@@ -655,8 +662,8 @@
655662
*
656663
* @apiQuery {Number} [no] Module number.
657664
* @apiQuery {String} [name] Name of the module.
658-
* @apiQuery {String} [outcome] Module outcome.
659665
* @apiQuery {String[]} [contents] Array of contents of the module.
666+
* @apiQuery {ObjectId} content ID of the Topics (ObjectId).
660667
* @apiQuery {Number} [hrsPerModule] Number of hours required per module.
661668
* @apiQuery {String[]} [cognitiveLevels] Array of cognitive levels
662669
* of attainment as per Bloom's Taxanomy (L1-L6).
@@ -665,7 +672,6 @@
665672
* @apiSuccess {String} module._id ID of document given by database.
666673
* @apiSuccess {String} module.no Module number.
667674
* @apiSuccess {String} module.name Name of the module.
668-
* @apiSuccess {String} module.outcome Module outcome.
669675
* @apiSuccess {String[]} module.contents Array of contents of the module.
670676
* @apiSuccess {Number} module.hrsPerModule Number of hours required per module.
671677
* @apiSuccess {String[]} module.cognitiveLevels Array of cognitive levels of
@@ -741,8 +747,8 @@
741747
*
742748
* @apiBody {Number} [no] Module number.
743749
* @apiBody {String} [name] Name of the module.
744-
* @apiBody {String} [outcome] Module outcome.
745750
* @apiBody {String[]} [contents] Array of contents of the module.
751+
* @apiBody {ObjectId} content ID of the Topics (ObjectId).
746752
* @apiBody {Number} [hrsPerModule] Number of hours required per module.
747753
* @apiBody {String[]} [cognitiveLevels] Array of cognitive levels
748754
* of attainment as per Bloom's Taxanomy (L1-L6).
@@ -772,8 +778,8 @@
772778
* @apiParam {String} moduleId The ID of the Module document to update.
773779
* @apiBody {Number} [no] Module number.
774780
* @apiBody {String} [name] Name of the module.
775-
* @apiBody {String} [outcome] Module outcome.
776781
* @apiBody {String[]} [contents] Array of contents of the module.
782+
* @apiBody {ObjectId} content ID of the Topics (ObjectId).
777783
* @apiBody {Number} [hrsPerModule] Number of hours required per module.
778784
* @apiBody {String[]} [cognitiveLevels] Array of cognitive levels
779785
* of attainment as per Bloom's Taxanomy (L1-L6).
@@ -1875,3 +1881,5 @@
18751881
* @apiError (Error 500) err Error in updating database
18761882
*
18771883
*/
1884+
1885+
// TODO ADD COURSE ENDPOINT APIDOCS

app.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import groupRouter from "#routes/group";
3030
import performarouter from "#routes/performance";
3131
import notificationRouter from "#routes/notification";
3232
import topicRouter from "#routes/topic";
33+
import courseRouter from "#routes/course";
34+
import activityBlueprintRouter from "#routes/activityBlueprint";
3335

3436
const app = express();
3537
const currDirName = dirname(fileURLToPath(import.meta.url));
@@ -40,10 +42,12 @@ app.use(cors());
4042
app.use(express.json());
4143
app.use(express.urlencoded({ extended: false }));
4244
app.use(cookieParser());
43-
app.use(morgan(
44-
":remote-addr - :remote-user \":method :url HTTP/:http-version\" :status \":referrer\" \":user-agent\"",
45-
{ stream: logger.stream },
46-
));
45+
app.use(
46+
morgan(
47+
":remote-addr - :remote-user \":method :url HTTP/:http-version\" :status \":referrer\" \":user-agent\"",
48+
{ stream: logger.stream },
49+
),
50+
);
4751

4852
app.use(express.static(path.join(currDirName, "public")));
4953

@@ -71,6 +75,8 @@ app.use("/semester", semesterRouter);
7175
app.use("/faculty", facultyRouter);
7276
app.use("/performance", performarouter);
7377
app.use("/notification", notificationRouter);
74-
app.use("/topic",topicRouter);
78+
app.use("/topic", topicRouter);
79+
app.use("/course", courseRouter);
80+
app.use("/activityBlueprint", activityBlueprintRouter);
7581

7682
export default app;

controller/activity.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ async function addActivity(req, res) {
1010
const {
1111
activityBlueprint,
1212
startTime,
13-
duration,
1413
course,
1514
faculty,
1615
type,
@@ -22,7 +21,6 @@ async function addActivity(req, res) {
2221
const newActivity = await createActivity(
2322
activityBlueprint,
2423
startTime,
25-
duration,
2624
course,
2725
faculty,
2826
type,

0 commit comments

Comments
 (0)