Add website static image slots with page grouping and bilingual captions.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
b991a60cbc
commit
1c7678ce67
@@ -0,0 +1,98 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
Patch,
|
||||
Post,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthUser } from '../auth/auth.types';
|
||||
import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
||||
import { RequireBusinessPermission } from '../auth/decorators/require-business-permission.decorator';
|
||||
import { BusinessPermissionGuard } from '../auth/guards/business-permission.guard';
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
||||
import {
|
||||
CreateWebsiteStaticImageSlotDto,
|
||||
ListWebsiteStaticImageSlotsDto,
|
||||
PublicWebsiteStaticImagesQueryDto,
|
||||
UpdateWebsiteStaticImageSlotDto,
|
||||
} from './dto/website-static-images.dto';
|
||||
import { WebsiteStaticImagesService } from './website-static-images.service';
|
||||
|
||||
@Controller('tenants/:host/website/static-images')
|
||||
export class PublicWebsiteStaticImagesController {
|
||||
constructor(private readonly service: WebsiteStaticImagesService) {}
|
||||
|
||||
@Get()
|
||||
list(
|
||||
@Param('host') host: string,
|
||||
@Query() query: PublicWebsiteStaticImagesQueryDto,
|
||||
) {
|
||||
return this.service.listPublic(host, query.pageKey);
|
||||
}
|
||||
|
||||
@Get(':key')
|
||||
getOne(@Param('host') host: string, @Param('key') key: string) {
|
||||
return this.service.getPublicByKey(host, key);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('businesses/:businessId/website/static-images')
|
||||
@UseGuards(JwtAuthGuard, BusinessPermissionGuard)
|
||||
export class WebsiteStaticImagesController {
|
||||
constructor(private readonly service: WebsiteStaticImagesService) {}
|
||||
|
||||
@Get()
|
||||
@RequireBusinessPermission('website.read')
|
||||
list(
|
||||
@Param('businessId') businessId: string,
|
||||
@Query() query: ListWebsiteStaticImageSlotsDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.list(businessId, query, user);
|
||||
}
|
||||
|
||||
@Get(':slotId')
|
||||
@RequireBusinessPermission('website.read')
|
||||
getOne(
|
||||
@Param('businessId') businessId: string,
|
||||
@Param('slotId') slotId: string,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.getOne(businessId, slotId, user);
|
||||
}
|
||||
|
||||
@Post()
|
||||
@RequireBusinessPermission('website.update')
|
||||
create(
|
||||
@Param('businessId') businessId: string,
|
||||
@Body() dto: CreateWebsiteStaticImageSlotDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.create(businessId, dto, user);
|
||||
}
|
||||
|
||||
@Patch(':slotId')
|
||||
@RequireBusinessPermission('website.update')
|
||||
update(
|
||||
@Param('businessId') businessId: string,
|
||||
@Param('slotId') slotId: string,
|
||||
@Body() dto: UpdateWebsiteStaticImageSlotDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.update(businessId, slotId, dto, user);
|
||||
}
|
||||
|
||||
@Delete(':slotId')
|
||||
@RequireBusinessPermission('website.update')
|
||||
remove(
|
||||
@Param('businessId') businessId: string,
|
||||
@Param('slotId') slotId: string,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.remove(businessId, slotId, user);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user