Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corps-directory
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fhurtado14
corps-directory
Commits
e4e55ca9
Commit
e4e55ca9
authored
5 months ago
by
Federico Hurtado
Browse files
Options
Downloads
Patches
Plain Diff
contact and degree repository to save data to db.
parent
88668598
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
able to bypass cas in localhost
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/repository/contactRepository.js
+36
-0
36 additions, 0 deletions
backend/repository/contactRepository.js
backend/repository/degreeRepository.js
+1
-1
1 addition, 1 deletion
backend/repository/degreeRepository.js
with
37 additions
and
1 deletion
backend/repository/contactRepository.js
+
36
−
0
View file @
e4e55ca9
const
{
pool
}
=
require
(
"
../config/database/database.config
"
);
// contacts: [
// {
// contactNumber: string --> i guess this can be a phone nunber, email, etc.
// contactType: string --> need to define list: phone, email, ....
// preferredContact: boolean
// },
async
function
addContact
(
contact
,
peopleId
)
{
// extract the parts of the contact
let
{
contactNumber
,
contactType
,
preferredContact
}
=
contact
;
console
.
log
(
"
adding contact....
"
);
try
{
// query for adding the contact
const
query
=
`
INSERT INTO peopleContact (peopleId, contactNumber, contactType, preferredContact)
VALUES (?,?,?,?)
`
;
// insert data into db
const
[
results
]
=
await
pool
.
query
(
query
,
[
peopleId
,
contactNumber
,
contactType
,
preferredContact
,
]);
return
results
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
module
.
exports
=
{
addContact
};
This diff is collapsed.
Click to expand it.
backend/repository/degreeRepository.js
+
1
−
1
View file @
e4e55ca9
...
@@ -14,7 +14,7 @@ async function addDegree(degree, peopleId) {
...
@@ -14,7 +14,7 @@ async function addDegree(degree, peopleId) {
try
{
try
{
// Use the helper function to determine the degreeTypeId
// Use the helper function to determine the degreeTypeId
degreeTypeId
=
await
_lookupDegreeTypeId
(
degreeType
);
let
degreeTypeId
=
await
_lookupDegreeTypeId
(
degreeType
);
const
query
=
`
const
query
=
`
INSERT INTO peopleDegree (peopleId, degreeTypeId, degreeDepartment, degreeCollege, degreeYear, degreeDescription)
INSERT INTO peopleDegree (peopleId, degreeTypeId, degreeDepartment, degreeCollege, degreeYear, degreeDescription)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment