init
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Patch,
|
||||
Post,
|
||||
UploadedFile,
|
||||
UseGuards,
|
||||
UseInterceptors
|
||||
} from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { JwtGuard } from '../../../guards/JwtGuard';
|
||||
import { shopFaviconFilePipe, shopFaviconUploadOptions } from '../config/shopFaviconUpload';
|
||||
import { shopLogoFilePipe, shopLogoUploadOptions } from '../config/shopLogoUpload';
|
||||
import { ConnectSimplexNotificationsDto } from '../dto/ConnectSimplexNotificationsDto';
|
||||
import { UpdateNotificationsDto } from '../dto/UpdateNotificationsDto';
|
||||
import { UpdateShippingNoteDto } from '../dto/UpdateShippingNoteDto';
|
||||
import { UpdateSimplexLinkDto } from '../dto/UpdateSimplexLinkDto';
|
||||
import { ShopSettingsService } from '../services/ShopSettingsService';
|
||||
|
||||
@Controller('shop-settings')
|
||||
@UseGuards(JwtGuard)
|
||||
export class ShopSettingsController {
|
||||
constructor(private readonly shopSettingsService: ShopSettingsService) {}
|
||||
|
||||
@Get('/')
|
||||
get() {
|
||||
return this.shopSettingsService.getView();
|
||||
}
|
||||
|
||||
@Patch('/simplex-link')
|
||||
updateSimplexLink(@Body() dto: UpdateSimplexLinkDto) {
|
||||
return this.shopSettingsService.updateSimplexLink(dto);
|
||||
}
|
||||
|
||||
@Patch('/shipping-note')
|
||||
updateShippingNote(@Body() dto: UpdateShippingNoteDto) {
|
||||
return this.shopSettingsService.updateShippingNote(dto);
|
||||
}
|
||||
|
||||
@Patch('/notifications')
|
||||
updateNotifications(@Body() dto: UpdateNotificationsDto) {
|
||||
return this.shopSettingsService.updateNotifications(dto);
|
||||
}
|
||||
|
||||
@Post('/simplex-connect')
|
||||
connectSimplexNotifications(@Body() dto: ConnectSimplexNotificationsDto) {
|
||||
return this.shopSettingsService.connectSimplexNotifications(dto.simplexNotificationLink);
|
||||
}
|
||||
|
||||
@Post('/logo')
|
||||
@UseInterceptors(FileInterceptor('file', shopLogoUploadOptions))
|
||||
uploadLogo(@UploadedFile(shopLogoFilePipe) file: Express.Multer.File) {
|
||||
return this.shopSettingsService.uploadLogo(file.filename);
|
||||
}
|
||||
|
||||
@Post('/favicon')
|
||||
@UseInterceptors(FileInterceptor('file', shopFaviconUploadOptions))
|
||||
uploadFavicon(@UploadedFile(shopFaviconFilePipe) file: Express.Multer.File) {
|
||||
return this.shopSettingsService.uploadFavicon(file.filename);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user