Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added names to accounts #55

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ userRouter.get('/:uid', async (req, res) => {

userRouter.post('/create', async (req, res) => {
try {
const { id, email, type, approved, approvedOn } = req.body;
const { id, email, type, approved, approvedOn, firstName, lastName } = req.body;
await db.query(
`INSERT INTO users (id, email, "type", approved, approved_on) VALUES ($1, $2, $3, $4, $5);`,
[id, email, type, approved, approvedOn],
`INSERT INTO users (id, email, "type", approved, approved_on, first_name, last_name) VALUES ($1, $2, $3, $4, $5, $6, $7);`,
[id, email, type, approved, approvedOn, firstName, lastName],
);
res.status(201).json({
id,
Expand Down
2 changes: 2 additions & 0 deletions server/schema/users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ CREATE TABLE users (
type account_type NOT NULL,
approved BOOLEAN NOT NULL,
approved_on DATE NOT NULL,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL
);
Loading