-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from tcet-opensource/development
Biweekly Merge
- Loading branch information
Showing
102 changed files
with
3,943 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
node_modules | ||
coverage | ||
logs | ||
.env | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
PORT=4000 | ||
TOKEN_SECRET=mysecret | ||
ENVIRONMENT=local | ||
DB_URL=mongodb://mongo1:30001,mongo2:30002,mongo3:30003/?replicaSet=my-replica-set | ||
EMAIL_HOST= | ||
EMAIL_PORT= | ||
EMAIL_USER= | ||
EMAIL_PASS= | ||
|
||
# get email stuff from mailtrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Dockerhub | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
name: Uploading Img | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Building Docker Image | ||
run: docker build -t ${{ secrets.username }}/erp-backend:prod . | ||
- name: DockerHub Login | ||
run: docker login -u ${{ secrets.username }} -p ${{ secrets.pass }} | ||
- name: Uploading Image to DockerHub | ||
run: docker push ${{ secrets.username }}/erp-backend:prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,7 @@ dist | |
.pnp.* | ||
|
||
# ingore genrated APIdocs | ||
apidoc | ||
apidoc | ||
|
||
# data generated by mongo replicas | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ RUN npm ci | |
|
||
COPY . . | ||
|
||
EXPOSE 3500 | ||
CMD ["npm", "run", "start"] | ||
EXPOSE 4000 | ||
CMD ["npm", "run", "serverstart"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { | ||
createActivityBP, | ||
updateActivityBlueprintById, | ||
deleteActivityBlueprintById, | ||
activityBlueprintList, | ||
} from "#services/activityBlueprint"; | ||
import { logger } from "#util"; | ||
|
||
async function addActivityBP(req, res) { | ||
const { | ||
number, | ||
academicYear, | ||
day, | ||
startTime, | ||
duration, | ||
infra, | ||
course, | ||
faculty, | ||
type, | ||
group, | ||
} = req.body; | ||
try { | ||
const newActivityBP = await createActivityBP( | ||
number, | ||
academicYear, | ||
day, | ||
startTime, | ||
duration, | ||
infra, | ||
course, | ||
faculty, | ||
type, | ||
group, | ||
); | ||
return res.json({ | ||
res: `added activity ${newActivityBP.id}`, | ||
id: newActivityBP.id, | ||
}); | ||
} catch (error) { | ||
logger.error("Error while inserting", error); | ||
res.status(500); | ||
return res.json({ err: "Error while inserting in DB" }); | ||
} | ||
} | ||
|
||
async function updateActivityBP(req, res) { | ||
const { id } = req.params; | ||
const { ...data } = req.body; | ||
try { | ||
await updateActivityBlueprintById(id, data); | ||
return res.json({ res: `updated activity with id ${id}` }); | ||
} catch (error) { | ||
logger.error("Error while updating", error); | ||
res.status(500); | ||
return res.json({ err: "Error while updating in DB" }); | ||
} | ||
} | ||
|
||
async function getActivityBP(req, res) { | ||
try { | ||
const filter = req.body; | ||
const { limit, page } = req.query; | ||
const activitylist = await activityBlueprintList(filter, limit, page); | ||
return res.json({ res: activitylist }); | ||
} catch (error) { | ||
logger.error("Error while fetching", error); | ||
res.status(500); | ||
return res.json({ err: "Error while fetching the data" }); | ||
} | ||
} | ||
|
||
async function deleteActivityBP(res, req) { | ||
const { id } = req.params; | ||
try { | ||
await deleteActivityBlueprintById(id); | ||
return res.json({ res: `Deleted activity with ID ${id}` }); | ||
} catch (error) { | ||
logger.error("Error while deleting", error); | ||
return res.status(500).json({ error: "Error while deleting from DB" }); | ||
} | ||
} | ||
|
||
export default { | ||
addActivityBP, | ||
deleteActivityBP, | ||
getActivityBP, | ||
updateActivityBP, | ||
}; |
Oops, something went wrong.