Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentoti committed Sep 9, 2022
1 parent 1f13a79 commit 3ba8524
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 41 deletions.
10 changes: 5 additions & 5 deletions api/users/user.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const { checkToken } = require('../../auth/token_validation');


//Now we have to define the route for all the controllers
router.post('/visitor/createVisitors', checkToken, createVisitors); //we are passing the request to 'creatUser' in the user.controller
router.get('/visitor/getVisitors', checkToken, getVisitors);
router.post('/visitor/createVisitors', createVisitors); //we are passing the request to 'creatUser' in the user.controller
router.get('/visitor/getVisitors', getVisitors);
//router.get('/visitor/getVisitors', checkToken, getVisitors);
router.get('/visitor/getAllVisitors', getAllVisitors);
router.get('/visitor/getAllVisitors', getAllVisitors);
router.get('/visitor/getVisitorsByVisitorId', getVisitorsByVisitorId);
router.patch('/visitor/updateVisitors', checkToken, updateVisitors);
router.delete('/visitor/deleteVisitors', checkToken, deleteVisitors);
Expand All @@ -40,8 +40,8 @@ router.get('/user/getUsers', getUsers);
router.post('/user/createUsers', createUsers);
router.get('/visitor/getVisitorPurpose', getVisitorPurpose);
router.get('/visitor/getVisitorByFullname', getVisitorByFullname);
router.get('/visitor/getVisitorsNumber', checkToken, getVisitorsNumber);
router.get('/visitor/getVisitorsSignOutNumber', checkToken, getVisitorsSignOutNumber);
router.get('/visitor/getVisitorsNumber', getVisitorsNumber);
router.get('/visitor/getVisitorsSignOutNumber', getVisitorsSignOutNumber);
router.patch('/visitor/updateVisitorClockout', updateVisitorClockout);
router.get('/visitor/getVisitorByFullname', getVisitorByFullname);
router.get('/visitor/signedInVisitors', signedInVisitors);
Expand Down
52 changes: 16 additions & 36 deletions database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ USE vms;
DROP TABLE IF EXISTS user_type;
CREATE TABLE user_type(
id int not null primary key auto_increment,
`type` varchar
(16) not null
`type` varchar(16) not null
);

INSERT INTO user_type
Expand All @@ -27,8 +26,7 @@ VALUES('Visitor');
DROP TABLE IF EXISTS department;
CREATE TABLE department(
id int not null primary key auto_increment,
department varchar
(16) not null
department varchar(16) not null
);

INSERT INTO department
Expand Down Expand Up @@ -62,8 +60,7 @@ VALUES('Product Unit');
DROP TABLE IF EXISTS gender;
CREATE TABLE gender(
id int not null primary key auto_increment,
gender varchar
(16) not null
gender varchar(16) not null
);

INSERT INTO gender
Expand All @@ -79,8 +76,7 @@ VALUES('F');
DROP TABLE IF EXISTS purpose;
CREATE TABLE purpose(
id int not null primary key auto_increment,
purpose varchar
(16) not null
purpose varchar(16) not null
);

INSERT INTO purpose
Expand All @@ -104,26 +100,16 @@ VALUES('Work');
DROP TABLE IF EXISTS users;
CREATE TABLE users(
id int not null primary key auto_increment,
username varchar
(16) not null,
email varchar
(32) not null,
first_name varchar
(32) not null,
last_name varchar
(32) not null,
phone_number varchar
(16),
username varchar(16) not null,
email varchar(32) not null,
first_name varchar(32) not null,
last_name varchar(32) not null,
phone_number varchar(16),
gender_id int not null,
department_id int not null,
password varchar
(255) not null,
CONSTRAINT FK_DEPARTMENT FOREIGN KEY
(department_id) REFERENCES department
(id),
CONSTRAINT FK_GENDER FOREIGN KEY
(gender_id) REFERENCES gender
(id)
password varchar(255) not null,
CONSTRAINT FK_DEPARTMENT FOREIGN KEY(department_id) REFERENCES department(id),
CONSTRAINT FK_GENDER FOREIGN KEY(gender_id) REFERENCES gender(id)
);

INSERT INTO users
Expand All @@ -150,20 +136,14 @@ VALUES('zach', '[email protected]', 'CIVIR-TER', 'ZACH-UKOH', '08130402087', 1
DROP TABLE IF EXISTS visitors;
CREATE TABLE visitors(
id int(11) not null primary key auto_increment,
fullname varchar
(64) not null,
fullname varchar(64) not null,
user_id int null,
purpose_id int null,
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
address text,
phone_number varchar
(16),
CONSTRAINT FK_WHOM_TO_SEE FOREIGN KEY
(user_id) references users
(id),
CONSTRAINT FK_PURPOSE FOREIGN KEY
(purpose_id) references purpose
(id)
phone_number varchar(16),
CONSTRAINT FK_WHOM_TO_SEE FOREIGN KEY(user_id) references users(id),
CONSTRAINT FK_PURPOSE FOREIGN KEY(purpose_id) references purpose(id)
);

INSERT INTO visitors
Expand Down

0 comments on commit 3ba8524

Please sign in to comment.