Browse Source

refactor(nocodb): move PagedResponseImpl logic to ctl and remove await from validatePayload

pull/5269/head
Wing-Kam Wong 2 years ago
parent
commit
9ebdfa875d
  1. 16
      packages/nocodb/src/lib/services/audit.svc.ts

16
packages/nocodb/src/lib/services/audit.svc.ts

@ -3,7 +3,6 @@ import DOMPurify from 'isomorphic-dompurify';
import { validatePayload } from '../meta/api/helpers';
import Audit from '../models/Audit';
import Model from '../models/Model';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { AuditRowUpdateReqType } from 'nocodb-sdk';
export async function commentRow(param: {
@ -11,10 +10,7 @@ export async function commentRow(param: {
body: AuditRowUpdateReqType;
user: any;
}) {
await validatePayload(
'swagger.json#/components/schemas/CommentReq',
param.body
);
validatePayload('swagger.json#/components/schemas/CommentReq', param.body);
return await Audit.insert({
...param.body,
@ -27,7 +23,7 @@ export async function auditRowUpdate(param: {
rowId: string;
body: AuditRowUpdateReqType;
}) {
await validatePayload(
validatePayload(
'swagger.json#/components/schemas/AuditRowUpdateReq',
param.body
);
@ -54,13 +50,7 @@ export async function commentList(param: { query: any }) {
}
export async function auditList(param: { query: any; projectId: string }) {
return new PagedResponseImpl(
await Audit.projectAuditList(param.projectId, param.query),
{
count: await Audit.projectAuditCount(param.projectId),
...param.query,
}
);
return await Audit.projectAuditList(param.projectId, param.query);
}
export async function commentsCount(param: {

Loading…
Cancel
Save