|
|
@ -9,6 +9,7 @@ import { AppHooksService } from '~/services/app-hooks/app-hooks.service'; |
|
|
|
import { validatePayload } from '~/helpers'; |
|
|
|
import { validatePayload } from '~/helpers'; |
|
|
|
import { NcError } from '~/helpers/catchError'; |
|
|
|
import { NcError } from '~/helpers/catchError'; |
|
|
|
import { Model, ModelRoleVisibility, View } from '~/models'; |
|
|
|
import { Model, ModelRoleVisibility, View } from '~/models'; |
|
|
|
|
|
|
|
import {NcRequest} from "~/interface/config"; |
|
|
|
|
|
|
|
|
|
|
|
// todo: move
|
|
|
|
// todo: move
|
|
|
|
async function xcVisibilityMetaGet(param: { |
|
|
|
async function xcVisibilityMetaGet(param: { |
|
|
@ -69,8 +70,8 @@ export class ViewsService { |
|
|
|
async viewList(param: { |
|
|
|
async viewList(param: { |
|
|
|
tableId: string; |
|
|
|
tableId: string; |
|
|
|
user: { |
|
|
|
user: { |
|
|
|
roles: Record<string, boolean>; |
|
|
|
roles?: Record<string, boolean> | string, |
|
|
|
base_roles: Record<string, boolean>; |
|
|
|
base_roles?: Record<string, boolean>; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const model = await Model.get(param.tableId); |
|
|
|
const model = await Model.get(param.tableId); |
|
|
@ -91,7 +92,7 @@ export class ViewsService { |
|
|
|
return filteredViewList; |
|
|
|
return filteredViewList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async shareView(param: { viewId: string; user: UserType; req: any }) { |
|
|
|
async shareView(param: { viewId: string; user: UserType; req: NcRequest }) { |
|
|
|
const res = await View.share(param.viewId); |
|
|
|
const res = await View.share(param.viewId); |
|
|
|
|
|
|
|
|
|
|
|
const view = await View.get(param.viewId); |
|
|
|
const view = await View.get(param.viewId); |
|
|
@ -113,7 +114,7 @@ export class ViewsService { |
|
|
|
viewId: string; |
|
|
|
viewId: string; |
|
|
|
view: ViewUpdateReqType; |
|
|
|
view: ViewUpdateReqType; |
|
|
|
user: UserType; |
|
|
|
user: UserType; |
|
|
|
req: any; |
|
|
|
req: NcRequest; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
validatePayload( |
|
|
|
validatePayload( |
|
|
|
'swagger.json#/components/schemas/ViewUpdateReq', |
|
|
|
'swagger.json#/components/schemas/ViewUpdateReq', |
|
|
@ -140,7 +141,7 @@ export class ViewsService { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async viewDelete(param: { viewId: string; user: UserType; req: any }) { |
|
|
|
async viewDelete(param: { viewId: string; user: UserType; req: NcRequest }) { |
|
|
|
const view = await View.get(param.viewId); |
|
|
|
const view = await View.get(param.viewId); |
|
|
|
|
|
|
|
|
|
|
|
if (!view) { |
|
|
|
if (!view) { |
|
|
@ -162,7 +163,7 @@ export class ViewsService { |
|
|
|
viewId: string; |
|
|
|
viewId: string; |
|
|
|
sharedView: SharedViewReqType; |
|
|
|
sharedView: SharedViewReqType; |
|
|
|
user: UserType; |
|
|
|
user: UserType; |
|
|
|
req: any; |
|
|
|
req: NcRequest; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
validatePayload( |
|
|
|
validatePayload( |
|
|
|
'swagger.json#/components/schemas/SharedViewReq', |
|
|
|
'swagger.json#/components/schemas/SharedViewReq', |
|
|
@ -186,7 +187,7 @@ export class ViewsService { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async shareViewDelete(param: { viewId: string; user: UserType; req: any }) { |
|
|
|
async shareViewDelete(param: { viewId: string; user: UserType; req: NcRequest }) { |
|
|
|
const view = await View.get(param.viewId); |
|
|
|
const view = await View.get(param.viewId); |
|
|
|
|
|
|
|
|
|
|
|
if (!view) { |
|
|
|
if (!view) { |
|
|
|