-
Notifications
You must be signed in to change notification settings - Fork 14
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
040 Nov 5 Add Swagger for Vendors #206
Merged
MuhammadKhalilzadeh
merged 2 commits into
bluewave-labs:master
from
HarshP4585:040-nov-5-add-swagger-for-vendor
Nov 7, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -136,26 +136,22 @@ const insertQuery: TableList = [ | |
createString: `CREATE TABLE vendors( | ||
id SERIAL PRIMARY KEY, | ||
name varchar(255) NOT NULL, | ||
project_id integer, | ||
type varchar(100), | ||
description text, | ||
website varchar(255), | ||
contact_person varchar(100), | ||
assignee varchar(100), | ||
status varchar(100), | ||
review_result varchar(50), | ||
review_status varchar(50), | ||
reviewer_id integer, | ||
review_date timestamp, | ||
risk_status varchar(50), | ||
CONSTRAINT vendors_reviewer_id_fkey FOREIGN KEY (reviewer_id) | ||
REFERENCES users(id) | ||
ON DELETE SET NULL, | ||
CONSTRAINT vendors_project_id_fkey FOREIGN KEY (project_id) | ||
REFERENCES projects(id) | ||
ON DELETE SET NULL | ||
reviewer varchar(50), | ||
review_date varchar(50), | ||
risk_status varchar(50) | ||
Comment on lines
+139
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Schema design improvements needed for the vendors table. Consider the following improvements to the table structure:
Apply these changes to improve data integrity and query performance: - type varchar(100),
+ type varchar(100) NOT NULL,
description text,
website varchar(255),
contact_person varchar(100),
- assignee varchar(100),
+ assignee integer,
- status varchar(100),
+ status varchar(100) NOT NULL,
review_result varchar(50),
review_status varchar(50),
- reviewer varchar(50),
+ reviewer integer,
- review_date varchar(50),
+ review_date timestamp,
- risk_status varchar(50)
+ risk_status varchar(50),
+ CONSTRAINT fk_assignee FOREIGN KEY (assignee)
+ REFERENCES users(id)
+ ON DELETE SET NULL,
+ CONSTRAINT fk_reviewer FOREIGN KEY (reviewer)
+ REFERENCES users(id)
+ ON DELETE SET NULL
|
||
);`, | ||
insertString: | ||
"INSERT INTO vendors(name, project_id, description, website, contact_person, review_result, review_status, reviewer_id, review_date, risk_status) VALUES ", | ||
"INSERT INTO vendors(name, type, description, website, contact_person, assignee, status, review_result, review_status, reviewer, review_date, risk_status) VALUES ", | ||
generateValuesString: function (vendor: Vendor) { | ||
return `(${vendor.id}, '${vendor.name}', '${vendor.type}', '${vendor.description}', '${vendor.website}', '${vendor.contact_person}', '${vendor.assignee}', '${vendor.status}', '${vendor.review_result}', '${vendor.reviewer}', '${vendor.review_date}', '${vendor.review_status}', '${vendor.risk_status}')`; | ||
return `('${vendor.name}', '${vendor.type}', '${vendor.description}', '${vendor.website}', '${vendor.contact_person}', '${vendor.assignee}', '${vendor.status}', '${vendor.review_result}', '${vendor.review_status}', '${vendor.reviewer}', '${vendor.review_date}', '${vendor.risk_status}')`; | ||
}, | ||
}, | ||
{ | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Simplify variable access pattern.
The destructuring of request body fields is redundant since the values are later accessed directly via
req.body
. Either use the destructured variables consistently or remove the destructuring.📝 Committable suggestion