Browse Source

refactor: respond with 404 if project not found

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1845/head
Pranav C 3 years ago
parent
commit
d207fd07d6
  1. 5
      packages/nocodb/src/lib/noco/meta/api/swagger/swaggerApis.ts

5
packages/nocodb/src/lib/noco/meta/api/swagger/swaggerApis.ts

@ -1,5 +1,5 @@
// @ts-ignore // @ts-ignore
import catchError from '../../helpers/catchError'; import catchError, { NcError } from '../../helpers/catchError';
import { Router } from 'express'; import { Router } from 'express';
import Model from '../../../../noco-models/Model'; import Model from '../../../../noco-models/Model';
import getSwaggerJSON from './helpers/getSwaggerJSON'; import getSwaggerJSON from './helpers/getSwaggerJSON';
@ -9,6 +9,9 @@ import redocHtml from './redocHtml';
async function swaggerJson(req, res) { async function swaggerJson(req, res) {
const project = await Project.get(req.params.projectId); const project = await Project.get(req.params.projectId);
if (!project) NcError.notFound();
const models = await Model.list({ const models = await Model.list({
project_id: req.params.project_id, project_id: req.params.project_id,
base_id: null base_id: null

Loading…
Cancel
Save