Compare commits
3
Commits
6419439a3d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55630e33b4 | ||
|
|
e057b29cc7 | ||
|
|
226a31b937 |
+2
-2
@@ -46,7 +46,7 @@ MULTER_SHOP_LOGO_MAX_FILE_BYTES=1048576 # 1MB
|
|||||||
MULTER_SHOP_FAVICON_ALLOWED_MIMES=image/png,image/x-icon,image/vnd.microsoft.icon
|
MULTER_SHOP_FAVICON_ALLOWED_MIMES=image/png,image/x-icon,image/vnd.microsoft.icon
|
||||||
MULTER_SHOP_FAVICON_MAX_FILE_BYTES=262144 # 256KB
|
MULTER_SHOP_FAVICON_MAX_FILE_BYTES=262144 # 256KB
|
||||||
|
|
||||||
MULTER_DIGITAL_STOCK_ATTACHMENT_ALLOWED_MIMES=application/pdf,application/zip,image/jpeg,image/png
|
MULTER_DIGITAL_STOCK_ATTACHMENT_ALLOWED_MIMES=application/pdf,application/zip,application/x-zip-compressed,image/jpeg,image/png
|
||||||
MULTER_DIGITAL_STOCK_ATTACHMENT_MAX_FILE_BYTES=5242880 # 5MB
|
MULTER_DIGITAL_STOCK_ATTACHMENT_MAX_FILE_BYTES=5242880 # 5MB
|
||||||
|
|
||||||
VALIDATION_PRODUCT_TITLE_MAX_LENGTH=100
|
VALIDATION_PRODUCT_TITLE_MAX_LENGTH=100
|
||||||
@@ -144,7 +144,7 @@ VITE_SHOP_LOGO_ALLOWED_MIMES=image/jpeg,image/png
|
|||||||
VITE_SHOP_LOGO_MAX_FILE_BYTES=1048576 # 1MB
|
VITE_SHOP_LOGO_MAX_FILE_BYTES=1048576 # 1MB
|
||||||
VITE_SHOP_FAVICON_ALLOWED_MIMES=image/png,image/x-icon,image/vnd.microsoft.icon
|
VITE_SHOP_FAVICON_ALLOWED_MIMES=image/png,image/x-icon,image/vnd.microsoft.icon
|
||||||
VITE_SHOP_FAVICON_MAX_FILE_BYTES=262144 # 256KB
|
VITE_SHOP_FAVICON_MAX_FILE_BYTES=262144 # 256KB
|
||||||
VITE_DIGITAL_STOCK_ATTACHMENT_ALLOWED_MIMES=application/pdf,application/zip,image/jpeg,image/png
|
VITE_DIGITAL_STOCK_ATTACHMENT_ALLOWED_MIMES=application/pdf,application/zip,application/x-zip-compressed,image/jpeg,image/png
|
||||||
VITE_DIGITAL_STOCK_ATTACHMENT_MAX_FILE_BYTES=5242880 # 5MB
|
VITE_DIGITAL_STOCK_ATTACHMENT_MAX_FILE_BYTES=5242880 # 5MB
|
||||||
VITE_VALIDATION_PRODUCT_TITLE_MAX_LENGTH=100
|
VITE_VALIDATION_PRODUCT_TITLE_MAX_LENGTH=100
|
||||||
VITE_VALIDATION_BLOG_POST_TITLE_MAX_LENGTH=200
|
VITE_VALIDATION_BLOG_POST_TITLE_MAX_LENGTH=200
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Body, Controller, Get, HttpStatus, Post, Req, Res, UseFilters } from '@nestjs/common';
|
import { BadRequestException, Body, Controller, Get, HttpStatus, Post, Req, Res, UseFilters } from '@nestjs/common';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { Throttle } from '@nestjs/throttler';
|
import { Throttle } from '@nestjs/throttler';
|
||||||
import type { Request, Response } from 'express';
|
import type { Request, Response } from 'express';
|
||||||
@@ -89,6 +89,10 @@ export class StorefrontCartController {
|
|||||||
@Res() res: Response,
|
@Res() res: Response,
|
||||||
@Body() { variantId, qty }: AddToCartDto
|
@Body() { variantId, qty }: AddToCartDto
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (this.checkoutSessionCookieService.getSessionId(req, res)) {
|
||||||
|
throw new BadRequestException('Finish or cancel checkout before changing your cart.');
|
||||||
|
}
|
||||||
|
|
||||||
const cart = this.cartCookieService.getCart(req, res);
|
const cart = this.cartCookieService.getCart(req, res);
|
||||||
|
|
||||||
const cartMutation = await this.cartService.addToCart(cart, variantId, qty);
|
const cartMutation = await this.cartService.addToCart(cart, variantId, qty);
|
||||||
@@ -109,6 +113,10 @@ export class StorefrontCartController {
|
|||||||
@Res() res: Response,
|
@Res() res: Response,
|
||||||
@Body() { variantId, qty }: UpdateCartQtyDto
|
@Body() { variantId, qty }: UpdateCartQtyDto
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (this.checkoutSessionCookieService.getSessionId(req, res)) {
|
||||||
|
throw new BadRequestException('Finish or cancel checkout before changing your cart.');
|
||||||
|
}
|
||||||
|
|
||||||
const cart = this.cartCookieService.getCart(req, res);
|
const cart = this.cartCookieService.getCart(req, res);
|
||||||
|
|
||||||
const cartMutation = await this.cartService.updateCartQty(cart, variantId, qty);
|
const cartMutation = await this.cartService.updateCartQty(cart, variantId, qty);
|
||||||
@@ -125,6 +133,10 @@ export class StorefrontCartController {
|
|||||||
|
|
||||||
@Post('shop/cart/product/remove')
|
@Post('shop/cart/product/remove')
|
||||||
removeFromCart(@Req() req: Request, @Res() res: Response, @Body() { variantId }: RemoveFromCartDto): void {
|
removeFromCart(@Req() req: Request, @Res() res: Response, @Body() { variantId }: RemoveFromCartDto): void {
|
||||||
|
if (this.checkoutSessionCookieService.getSessionId(req, res)) {
|
||||||
|
throw new BadRequestException('Finish or cancel checkout before changing your cart.');
|
||||||
|
}
|
||||||
|
|
||||||
const cart = this.cartCookieService.getCart(req, res);
|
const cart = this.cartCookieService.getCart(req, res);
|
||||||
|
|
||||||
const cartMutation = this.cartService.removeFromCart(cart, variantId);
|
const cartMutation = this.cartService.removeFromCart(cart, variantId);
|
||||||
@@ -143,6 +155,10 @@ export class StorefrontCartController {
|
|||||||
@Res() res: Response,
|
@Res() res: Response,
|
||||||
@Body() { code }: ApplyDiscountCodeDto
|
@Body() { code }: ApplyDiscountCodeDto
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (this.checkoutSessionCookieService.getSessionId(req, res)) {
|
||||||
|
throw new BadRequestException('Finish or cancel checkout before changing your cart.');
|
||||||
|
}
|
||||||
|
|
||||||
const cart = this.cartCookieService.getCart(req, res);
|
const cart = this.cartCookieService.getCart(req, res);
|
||||||
const discountCodes = this.discountCookieService.getDiscountCodes(req, res);
|
const discountCodes = this.discountCookieService.getDiscountCodes(req, res);
|
||||||
|
|
||||||
@@ -160,6 +176,10 @@ export class StorefrontCartController {
|
|||||||
|
|
||||||
@Post('shop/cart/discount/remove')
|
@Post('shop/cart/discount/remove')
|
||||||
removeDiscount(@Req() req: Request, @Res() res: Response, @Body() { code }: RemoveDiscountCodeDto): void {
|
removeDiscount(@Req() req: Request, @Res() res: Response, @Body() { code }: RemoveDiscountCodeDto): void {
|
||||||
|
if (this.checkoutSessionCookieService.getSessionId(req, res)) {
|
||||||
|
throw new BadRequestException('Finish or cancel checkout before changing your cart.');
|
||||||
|
}
|
||||||
|
|
||||||
const discountCodes = this.discountCookieService.getDiscountCodes(req, res);
|
const discountCodes = this.discountCookieService.getDiscountCodes(req, res);
|
||||||
const discountMutation = this.discountService.removeDiscountCode(discountCodes, code);
|
const discountMutation = this.discountService.removeDiscountCode(discountCodes, code);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const MIME_LABEL: Record<string, string> = {
|
|||||||
'application/json': 'JSON',
|
'application/json': 'JSON',
|
||||||
'application/pdf': 'PDF',
|
'application/pdf': 'PDF',
|
||||||
'application/zip': 'ZIP',
|
'application/zip': 'ZIP',
|
||||||
|
'application/x-zip-compressed': 'ZIP',
|
||||||
'image/gif': 'GIF',
|
'image/gif': 'GIF',
|
||||||
'image/jpeg': 'JPEG',
|
'image/jpeg': 'JPEG',
|
||||||
'image/jpg': 'JPEG',
|
'image/jpg': 'JPEG',
|
||||||
|
|||||||
Reference in New Issue
Block a user