Skip to content

Commit

Permalink
Scaffolded addScansFromPages
Browse files Browse the repository at this point in the history
  • Loading branch information
azdak committed Nov 22, 2024
1 parent 0681886 commit b73ae1b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/routes/addPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ import {
db,
isStaging,
} from "#src/utils";
import {ScanResponse, ScanResponseJob} from "#src/utils/interfaces";

interface ScanResponseJob {
jobId: string;
url: string;
}

interface ScanResponse {
jobs: Array<ScanResponseJob>;
messages: Array<string>;
}

export const addPages = async ({ request, reply }) => {
// check input for errors
Expand Down Expand Up @@ -107,7 +100,7 @@ export const addPages = async ({ request, reply }) => {
text: `INSERT INTO "urls" ("user_id", "url", "property_id") VALUES ($1, $2, $3) RETURNING "id"`,
values: [jwtClaims.sub, url, propertyToAddTo],
}) :
await db.query({
await db.query({ // otherwise skip property field
text: `INSERT INTO "urls" ("user_id", "url") VALUES ($1, $2) RETURNING "id"`,
values: [jwtClaims.sub, url],
})
Expand Down
21 changes: 21 additions & 0 deletions src/routes/addScansFromPages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ScanResponse, ScanResponseJob } from "#src/utils/interfaces";
import {
formatId,
validateDiscovery,
validateDiscoveryOptions,
validateUrl,
db,
isStaging,
} from "#src/utils";
import { jwtClaims } from "#src/app";

export const addScansFromPages = async ({ request, reply }) => {

// check request

// send request IDs to scan

// save response in scan table


};
9 changes: 9 additions & 0 deletions src/utils/interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface ScanResponseJob {
jobId: string;
url: string;
}

export interface ScanResponse {
jobs: Array<ScanResponseJob>;
messages: Array<string>;
}

0 comments on commit b73ae1b

Please sign in to comment.