Skip to content

Commit

Permalink
REFACTOR: Minor Fixes
Browse files Browse the repository at this point in the history
- Better API Naming
- Fixed Update API
  • Loading branch information
ishaan812 committed Aug 8, 2023
1 parent d3f200a commit 8bb09ec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ app.get('/search', async (_req, _res) => {
_res.send(results);
});

app.post('/database', async (_req, _res) => {
//openapi2db
app.post('/openapi', async (_req, _res) => {
const Repository = _req.query.repo as string;
const Organisation = _req.query.org as string;
const User = _req.query.user as string;
Expand All @@ -61,7 +62,7 @@ app.post('/database', async (_req, _res) => {
_res.send(results);
});

app.put('/database', async (_req, _res) => {
app.put('/openapi', async (_req, _res) => {
const results = await UpdateOpenAPIFiles();
_res.send(results);
});
Expand Down
2 changes: 1 addition & 1 deletion src/searchtools/searchutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function queryBuilder(
let query;
if (rootquery != undefined) {
if (rootquery === 'openapi') {
query = '"openapi:3"'
query = 'openapi: 3'
} else if (rootquery === 'swagger') {
query = '"swagger: \\"2"'
}
Expand Down
2 changes: 1 addition & 1 deletion src/updatetools/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export async function UpdateOpenAPIFiles(): Promise<string> {
for await (const hit of scrollSearch(params)) {
await UpdateDocument(hit);
}
return 'Updated All OpenAPI Files';
return "Updated All OpenAPI Files";
}
3 changes: 2 additions & 1 deletion src/updatetools/updateutils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import OASNormalize from "oas-normalize"
import { octokit, esClient } from "../app.js"
import { DeleteDocumentWithId, CreateDocument } from "../DB/dbutils.js"
import { url } from "inspector";


async function ETAGRequestBuilder(document: any): Promise<any> {
Expand All @@ -19,7 +20,7 @@ async function ETAGRequestBuilder(document: any): Promise<any> {
'If-None-Match': document._source.ETAG,
}
};
return
return request;
}

export async function * scrollSearch (params) {
Expand Down

0 comments on commit 8bb09ec

Please sign in to comment.