|
|
@ -1,19 +1,8 @@ |
|
|
|
import { |
|
|
|
import { Body, Controller, Get, HttpCode, Param, Patch, Post, Req, UseGuards } from '@nestjs/common'; |
|
|
|
Body, |
|
|
|
|
|
|
|
Controller, |
|
|
|
|
|
|
|
Get, |
|
|
|
|
|
|
|
HttpCode, |
|
|
|
|
|
|
|
Param, |
|
|
|
|
|
|
|
Patch, |
|
|
|
|
|
|
|
Post, |
|
|
|
|
|
|
|
Req, |
|
|
|
|
|
|
|
UseGuards, |
|
|
|
|
|
|
|
} from '@nestjs/common'; |
|
|
|
|
|
|
|
import { Request } from 'express'; |
|
|
|
import { Request } from 'express'; |
|
|
|
import { ViewCreateReqType } from 'nocodb-sdk'; |
|
|
|
import { ViewCreateReqType } from 'nocodb-sdk'; |
|
|
|
import { GlobalGuard } from '~/guards/global/global.guard'; |
|
|
|
import { GlobalGuard } from '~/guards/global/global.guard'; |
|
|
|
import { CalendarsService } from '~/services/calendars.service'; |
|
|
|
import { CalendarsService } from '~/services/calendars.service'; |
|
|
|
import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware'; |
|
|
|
|
|
|
|
import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard'; |
|
|
|
import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard'; |
|
|
|
|
|
|
|
|
|
|
|
@Controller() |
|
|
|
@Controller() |
|
|
@ -25,7 +14,7 @@ export class CalendarsController { |
|
|
|
'/api/v1/db/meta/calendars/:calendarViewId', |
|
|
|
'/api/v1/db/meta/calendars/:calendarViewId', |
|
|
|
'/api/v2/meta/calendars/:calendarViewId', |
|
|
|
'/api/v2/meta/calendars/:calendarViewId', |
|
|
|
]) |
|
|
|
]) |
|
|
|
@Acl('calendarViewGet') |
|
|
|
// @Acl('calendarViewGet')
|
|
|
|
async calendarViewGet(@Param('calendarViewId') calendarViewId: string) { |
|
|
|
async calendarViewGet(@Param('calendarViewId') calendarViewId: string) { |
|
|
|
return await this.calendarsService.calendarViewGet({ |
|
|
|
return await this.calendarsService.calendarViewGet({ |
|
|
|
calendarViewId, |
|
|
|
calendarViewId, |
|
|
@ -37,7 +26,7 @@ export class CalendarsController { |
|
|
|
'/api/v2/meta/tables/:tableId/calendars', |
|
|
|
'/api/v2/meta/tables/:tableId/calendars', |
|
|
|
]) |
|
|
|
]) |
|
|
|
@HttpCode(200) |
|
|
|
@HttpCode(200) |
|
|
|
@Acl('calendarViewCreate') |
|
|
|
// @Acl('calendarViewCreate')
|
|
|
|
async calendarViewCreate( |
|
|
|
async calendarViewCreate( |
|
|
|
@Param('tableId') tableId: string, |
|
|
|
@Param('tableId') tableId: string, |
|
|
|
@Body() body: ViewCreateReqType, |
|
|
|
@Body() body: ViewCreateReqType, |
|
|
@ -60,7 +49,6 @@ export class CalendarsController { |
|
|
|
async calendarViewUpdate( |
|
|
|
async calendarViewUpdate( |
|
|
|
@Param('calendarViewId') calendarViewId: string, |
|
|
|
@Param('calendarViewId') calendarViewId: string, |
|
|
|
@Body() body, |
|
|
|
@Body() body, |
|
|
|
|
|
|
|
|
|
|
|
@Req() req: Request, |
|
|
|
@Req() req: Request, |
|
|
|
) { |
|
|
|
) { |
|
|
|
return await this.calendarsService.calendarViewUpdate({ |
|
|
|
return await this.calendarsService.calendarViewUpdate({ |
|
|
@ -69,4 +57,13 @@ export class CalendarsController { |
|
|
|
req, |
|
|
|
req, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Get('/api/v1/db/data/calendars/:calendarViewId/count') |
|
|
|
|
|
|
|
async calendarRecordCountGet(@Param('calendarViewId') calendarViewId: string, @Req() req: Request) { |
|
|
|
|
|
|
|
return await this.calendarsService.calendarRecordCountGet({ |
|
|
|
|
|
|
|
calendarViewId, |
|
|
|
|
|
|
|
req |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|