Skip to content

Commit

Permalink
Merge pull request #206 from HarshP4585/040-nov-5-add-swagger-for-vendor
Browse files Browse the repository at this point in the history
040 Nov 5 Add Swagger for Vendors
  • Loading branch information
MuhammadKhalilzadeh authored Nov 7, 2024
2 parents 6c45e6a + 120f43e commit 9b3f56c
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 16 deletions.
15 changes: 14 additions & 1 deletion Servers/controllers/vendor.ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,20 @@ export async function getVendorById(req: Request, res: Response): Promise<any> {

export async function createVendor(req: Request, res: Response): Promise<any> {
try {
const { name, description } = req.body;
const {
name,
type,
description,
website,
contact_person,
assignee,
status,
review_result,
reviewer,
review_date,
review_status,
risk_status
} = req.body;

if (!name || !description) {
return res
Expand Down
20 changes: 8 additions & 12 deletions Servers/driver/autoDriver.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);`,
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}')`;
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions Servers/mocks/vendorRisks/vendorRisks.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const vendorRisks = [
},
{
id: 4,
vendor_id: 4,
vendor_id: 2,
risk_description: "Healthcare solution data handling does not meet compliance.",
impact_description: "Non-compliance could lead to legal issues and fines.",
project_id: 4,
Expand All @@ -57,7 +57,7 @@ export const vendorRisks = [
},
{
id: 5,
vendor_id: 5,
vendor_id: 1,
risk_description: "Aerospace components may not meet performance standards.",
impact_description: "Failure could lead to product malfunctions and safety concerns.",
project_id: 5,
Expand Down
Loading

0 comments on commit 9b3f56c

Please sign in to comment.