Compare commits
11
Commits
ba0af1afd9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2933734ee | ||
|
|
1d512bf582 | ||
|
|
9e33aab9f9 | ||
|
|
32b3a83cd6 | ||
|
|
1e7edda6f2 | ||
|
|
8b56a9a5a9 | ||
|
|
e0e06eefa4 | ||
|
|
cccc8596e6 | ||
|
|
35feda1278 | ||
|
|
a6e60408d6 | ||
|
|
6ebb8161b9 |
+1
-1
@@ -114,7 +114,7 @@ BITCOIN_MIN_INCOMING_ATOMIC=7 # 0.00000007 BTC (~half a USD cent at that moment)
|
|||||||
|
|
||||||
ELECTRUM_VERSION=4.8.1
|
ELECTRUM_VERSION=4.8.1
|
||||||
ELECTRUM_NETWORK=testnet4
|
ELECTRUM_NETWORK=testnet4
|
||||||
ELECTRUM_SERVER=testnet4-electrumx.wakiyamap.dev:51002:s
|
ELECTRUM_SERVER=blackie.c3-soft.com:57010:s
|
||||||
ELECTRUM_DAEMON_HOST=electrum-daemon
|
ELECTRUM_DAEMON_HOST=electrum-daemon
|
||||||
ELECTRUM_DAEMON_PORT=7777
|
ELECTRUM_DAEMON_PORT=7777
|
||||||
ELECTRUM_DAEMON_RPC_USER=electrum
|
ELECTRUM_DAEMON_RPC_USER=electrum
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import 'reflect-metadata';
|
||||||
|
import { validate } from './validate';
|
||||||
|
|
||||||
|
const validConfig = (overrides: Record<string, unknown> = {}): Record<string, unknown> => ({
|
||||||
|
NODE_ENV: 'development',
|
||||||
|
BACKEND_PORT: 3000,
|
||||||
|
POSTGRES_USER: 'postgres',
|
||||||
|
POSTGRES_PASSWORD: 'postgres',
|
||||||
|
POSTGRES_DB: 'nullcart',
|
||||||
|
POSTGRES_HOST: 'postgres',
|
||||||
|
POSTGRES_PORT: 5432,
|
||||||
|
POSTGRES_MIGRATIONS_RUN: 'false',
|
||||||
|
CORS_ORIGINS: 'http://localhost:5173',
|
||||||
|
JWT_SECRET: 'secret',
|
||||||
|
JWT_EXPIRES_IN_MS: 604800000,
|
||||||
|
CMS_PASSWORD: 'change-me',
|
||||||
|
SHOP_NAME: 'NullCart',
|
||||||
|
SHOP_FIAT_CURRENCY: 'USD',
|
||||||
|
MULTER_PRODUCT_THUMB_ALLOWED_MIMES: 'image/jpeg',
|
||||||
|
MULTER_PRODUCT_THUMB_MAX_FILE_BYTES: 1048576,
|
||||||
|
MULTER_BLOG_IMAGE_ALLOWED_MIMES: 'image/jpeg',
|
||||||
|
MULTER_BLOG_IMAGE_MAX_FILE_BYTES: 1048576,
|
||||||
|
MULTER_SHOP_LOGO_ALLOWED_MIMES: 'image/jpeg',
|
||||||
|
MULTER_SHOP_LOGO_MAX_FILE_BYTES: 1048576,
|
||||||
|
MULTER_SHOP_FAVICON_ALLOWED_MIMES: 'image/png',
|
||||||
|
MULTER_SHOP_FAVICON_MAX_FILE_BYTES: 262144,
|
||||||
|
VALIDATION_PRODUCT_TITLE_MAX_LENGTH: 100,
|
||||||
|
VALIDATION_BLOG_POST_TITLE_MAX_LENGTH: 200,
|
||||||
|
VALIDATION_CATEGORY_NAME_MAX_LENGTH: 50,
|
||||||
|
VALIDATION_DISCOUNT_CODE_MAX_LENGTH: 32,
|
||||||
|
VALIDATION_VARIANT_IMAGES_MAX: 10,
|
||||||
|
MULTER_DIGITAL_STOCK_ATTACHMENT_ALLOWED_MIMES: 'application/pdf',
|
||||||
|
MULTER_DIGITAL_STOCK_ATTACHMENT_MAX_FILE_BYTES: 5242880,
|
||||||
|
VALIDATION_DIGITAL_STOCK_ATTACHMENTS_MAX: 5,
|
||||||
|
VALIDATION_SHIPPING_NOTE_MIN_LENGTH: 20,
|
||||||
|
VALIDATION_SHIPPING_NOTE_MAX_LENGTH: 4000,
|
||||||
|
VALIDATION_ORDER_MESSAGE_MAX_LENGTH: 2000,
|
||||||
|
VALIDATION_BITCOIN_WITHDRAW_MAX_FEE_RATE_SAT_VBYTE: 500,
|
||||||
|
CAPTCHA_LENGTH: 5,
|
||||||
|
THROTTLE_TTL_MS: 60000,
|
||||||
|
THROTTLE_LIMIT: 120,
|
||||||
|
SIGNED_COOKIE_JWT_SECRET: 'secret',
|
||||||
|
SIGNED_COOKIE_FEEDBACK_NAME: 'storefront_feedback',
|
||||||
|
SIGNED_COOKIE_FEEDBACK_EXPIRES_IN_MS: 120000,
|
||||||
|
SIGNED_COOKIE_CART_NAME: 'storefront_cart',
|
||||||
|
SIGNED_COOKIE_CART_EXPIRES_IN_MS: 2592000000,
|
||||||
|
SIGNED_COOKIE_CAPTCHA_NAME: 'storefront_captcha',
|
||||||
|
SIGNED_COOKIE_CAPTCHA_EXPIRES_IN_MS: 300000,
|
||||||
|
SIGNED_COOKIE_DISCOUNT_NAME: 'storefront_discount',
|
||||||
|
SIGNED_COOKIE_DISCOUNT_EXPIRES_IN_MS: 2592000000,
|
||||||
|
SIGNED_COOKIE_ERROR_NAME: 'storefront_error',
|
||||||
|
SIGNED_COOKIE_ERROR_EXPIRES_IN_MS: 120000,
|
||||||
|
SIGNED_COOKIE_CHECKOUT_SESSION_NAME: 'storefront_checkout_session',
|
||||||
|
SIGNED_COOKIE_ORDER_AUTH_NAME: 'storefront_order_auth',
|
||||||
|
SIGNED_COOKIE_ORDER_AUTH_EXPIRES_IN_MS: 604800000,
|
||||||
|
SIGNED_COOKIE_THEME_NAME: 'storefront_theme',
|
||||||
|
SIGNED_COOKIE_THEME_EXPIRES_IN_MS: 31536000000,
|
||||||
|
COINGECKO_API_BASE_URL: 'https://api.coingecko.com/api/v3',
|
||||||
|
COINPAPRIKA_API_BASE_URL: 'https://api.coinpaprika.com/v1',
|
||||||
|
COINPAPRIKA_RATE_FETCH_TIMEOUT_MS: 5000,
|
||||||
|
COINGECKO_RATE_FETCH_TIMEOUT_MS: 5000,
|
||||||
|
BASE64_ENCRYPTION_KEY: 'nyRya1KpYSQ+drpO132mkOEMUR+uq6K7tWvpMfppIME=',
|
||||||
|
MONERO_CONFIRMATION_TIERS:
|
||||||
|
'[{"upToTotalFiat":"30","minConfirmations":1},{"upToTotalFiat":"100","minConfirmations":3},{"minConfirmations":10}]',
|
||||||
|
BITCOIN_CONFIRMATION_TIERS:
|
||||||
|
'[{"upToTotalFiat":"200","minConfirmations":1},{"upToTotalFiat":"1000","minConfirmations":2},{"minConfirmations":6}]',
|
||||||
|
PAYMENT_METHODS_ENABLED: 'xmr,btc',
|
||||||
|
ORDER_CHECKOUT_VALIDITY_MS: 3600000,
|
||||||
|
ORDER_CHECKOUT_STATUS_REFRESH_SEC: 15,
|
||||||
|
ORDER_SHIPPING_PAYMENT_VALIDITY_MS: 259200000,
|
||||||
|
ORDER_DATA_RETENTION_DAYS: 30,
|
||||||
|
MONERO_MIN_INCOMING_ATOMIC: 10000000,
|
||||||
|
BITCOIN_MIN_INCOMING_ATOMIC: 7,
|
||||||
|
MONERO_DAEMON_ADDRESS: 'xmr-lux.boldsuck.org:38081',
|
||||||
|
MONERO_NETWORK: 'stagenet',
|
||||||
|
MONERO_WALLET_RPC_HOST: 'monero-wallet-rpc',
|
||||||
|
MONERO_WALLET_RPC_PORT: 18083,
|
||||||
|
MONERO_WALLET_RPC_USERNAME: 'monero',
|
||||||
|
MONERO_WALLET_RPC_PASSWORD: 'monero',
|
||||||
|
MONERO_WALLET_RPC_TIMEOUT_MS: 10000,
|
||||||
|
ELECTRUM_NETWORK: 'testnet4',
|
||||||
|
ELECTRUM_SERVER: 'blackie.c3-soft.com:57010:s',
|
||||||
|
ELECTRUM_DAEMON_HOST: 'electrum-daemon',
|
||||||
|
ELECTRUM_DAEMON_PORT: 7777,
|
||||||
|
ELECTRUM_DAEMON_RPC_USER: 'electrum',
|
||||||
|
ELECTRUM_DAEMON_RPC_PASSWORD: 'change-me',
|
||||||
|
ELECTRUM_DAEMON_RPC_TIMEOUT_MS: 10000,
|
||||||
|
ELECTRUM_WALLET_PASSWORD: 'change-me',
|
||||||
|
SIMPLEX_WS_URL: 'ws://simplex-cli:5225',
|
||||||
|
SIMPLEX_BOT_DISPLAY_NAME: 'NullCartBot',
|
||||||
|
...overrides
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('validate', () => {
|
||||||
|
it('accepts true and false for POSTGRES_MIGRATIONS_RUN', () => {
|
||||||
|
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: 'true' }))).not.toThrow();
|
||||||
|
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: 'false' }))).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects non-literal boolean env values', () => {
|
||||||
|
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: 'yes' }))).toThrow();
|
||||||
|
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: '1' }))).toThrow();
|
||||||
|
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: '' }))).toThrow();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,6 +1,18 @@
|
|||||||
import { plainToClass } from 'class-transformer';
|
import { plainToClass } from 'class-transformer';
|
||||||
import { IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsString, Max, Min, validateSync } from 'class-validator';
|
import {
|
||||||
|
IsEnum,
|
||||||
|
IsIn,
|
||||||
|
IsNotEmpty,
|
||||||
|
IsNumber,
|
||||||
|
IsString,
|
||||||
|
Max,
|
||||||
|
Min,
|
||||||
|
ValidateIf,
|
||||||
|
validateSync
|
||||||
|
} from 'class-validator';
|
||||||
|
import { BOOLEAN_STRING_VALUES } from '../consts/booleanStringValues';
|
||||||
import { NodeEnv } from '../types/NodeEnv';
|
import { NodeEnv } from '../types/NodeEnv';
|
||||||
|
import type { BooleanStringValue } from '../types/BooleanStringValue';
|
||||||
import { ShopFiatCurrency } from '../types/ShopFiatCurrency';
|
import { ShopFiatCurrency } from '../types/ShopFiatCurrency';
|
||||||
import { IsBase64 } from '../validation/decorators/isBase64';
|
import { IsBase64 } from '../validation/decorators/isBase64';
|
||||||
import { IsConfirmationTiers } from '../validation/decorators/isConfirmationTiers';
|
import { IsConfirmationTiers } from '../validation/decorators/isConfirmationTiers';
|
||||||
@@ -38,9 +50,10 @@ class EnvironmentVariables {
|
|||||||
POSTGRES_PORT: number;
|
POSTGRES_PORT: number;
|
||||||
|
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsBoolean()
|
@IsIn(BOOLEAN_STRING_VALUES)
|
||||||
POSTGRES_MIGRATIONS_RUN: boolean;
|
POSTGRES_MIGRATIONS_RUN: BooleanStringValue;
|
||||||
|
|
||||||
|
@ValidateIf((config: EnvironmentVariables) => config.NODE_ENV === NodeEnv.Development)
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
CORS_ORIGINS: string;
|
CORS_ORIGINS: string;
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export const BOOLEAN_STRING_VALUES = ['true', 'false'] as const;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class AddProductSortOrder1785000000000 implements MigrationInterface {
|
||||||
|
name = 'AddProductSortOrder1785000000000';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "products" ADD "sortOrder" integer NOT NULL DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "products" DROP COLUMN "sortOrder"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -106,10 +106,12 @@ async function bootstrap() {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (nodeEnv === NodeEnv.Development) {
|
||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: corsOrigins,
|
origin: corsOrigins,
|
||||||
credentials: true
|
credentials: true
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
await app.listen(port);
|
await app.listen(port);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IsArray, IsBoolean, IsNotEmpty, IsString, IsUUID, MaxLength } from 'class-validator';
|
import { IsArray, IsBoolean, IsInt, IsNotEmpty, IsString, IsUUID, MaxLength, Min } from 'class-validator';
|
||||||
|
|
||||||
import { getAppConfig } from '../../../config';
|
import { getAppConfig } from '../../../config';
|
||||||
|
|
||||||
@@ -22,4 +22,9 @@ export class UpdateProductDto {
|
|||||||
@IsArray()
|
@IsArray()
|
||||||
@IsUUID('4', { each: true })
|
@IsUUID('4', { each: true })
|
||||||
categoryIds: string[];
|
categoryIds: string[];
|
||||||
|
|
||||||
|
@IsNotEmpty()
|
||||||
|
@IsInt()
|
||||||
|
@Min(0)
|
||||||
|
sortOrder: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ export class Product {
|
|||||||
@Column({ type: 'text', default: '' })
|
@Column({ type: 'text', default: '' })
|
||||||
descriptionHtml: string;
|
descriptionHtml: string;
|
||||||
|
|
||||||
|
@Column({ type: 'integer', default: 0 })
|
||||||
|
sortOrder: number;
|
||||||
|
|
||||||
@OneToMany(() => ProductVariant, variant => variant.product)
|
@OneToMany(() => ProductVariant, variant => variant.product)
|
||||||
variants: ProductVariant[];
|
variants: ProductVariant[];
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
const [products, total] = await this.productRepo.findAndCount({
|
const [products, total] = await this.productRepo.findAndCount({
|
||||||
where: trimmedSearch ? { title: ILike(`%${trimmedSearch}%`) } : {},
|
where: trimmedSearch ? { title: ILike(`%${trimmedSearch}%`) } : {},
|
||||||
order: { createdAt: 'DESC' },
|
order: { sortOrder: 'ASC', createdAt: 'DESC' },
|
||||||
skip: (page - 1) * limit,
|
skip: (page - 1) * limit,
|
||||||
take: limit
|
take: limit
|
||||||
});
|
});
|
||||||
@@ -56,6 +56,7 @@ export class ProductsService {
|
|||||||
where: { id: In(productIds) },
|
where: { id: In(productIds) },
|
||||||
relations: ['categories', 'variants'],
|
relations: ['categories', 'variants'],
|
||||||
order: {
|
order: {
|
||||||
|
sortOrder: 'ASC',
|
||||||
createdAt: 'DESC',
|
createdAt: 'DESC',
|
||||||
variants: { sortOrder: 'ASC', createdAt: 'ASC' }
|
variants: { sortOrder: 'ASC', createdAt: 'ASC' }
|
||||||
}
|
}
|
||||||
@@ -125,6 +126,7 @@ export class ProductsService {
|
|||||||
where: { id: In(uniqueIds) },
|
where: { id: In(uniqueIds) },
|
||||||
relations: ['variants'],
|
relations: ['variants'],
|
||||||
order: {
|
order: {
|
||||||
|
sortOrder: 'ASC',
|
||||||
createdAt: 'DESC',
|
createdAt: 'DESC',
|
||||||
variants: { sortOrder: 'ASC', createdAt: 'ASC' }
|
variants: { sortOrder: 'ASC', createdAt: 'ASC' }
|
||||||
}
|
}
|
||||||
@@ -164,7 +166,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
async update(
|
async update(
|
||||||
id: string,
|
id: string,
|
||||||
{ title, descriptionHtml, isDraft, categoryIds }: UpdateProductDto
|
{ title, descriptionHtml, isDraft, categoryIds, sortOrder }: UpdateProductDto
|
||||||
): Promise<ProductWithVariantsExtended> {
|
): Promise<ProductWithVariantsExtended> {
|
||||||
const existing = await this.productRepo.findOne({
|
const existing = await this.productRepo.findOne({
|
||||||
where: { id }
|
where: { id }
|
||||||
@@ -177,6 +179,7 @@ export class ProductsService {
|
|||||||
existing.title = title.trim();
|
existing.title = title.trim();
|
||||||
existing.isDraft = isDraft;
|
existing.isDraft = isDraft;
|
||||||
existing.descriptionHtml = descriptionHtml;
|
existing.descriptionHtml = descriptionHtml;
|
||||||
|
existing.sortOrder = sortOrder;
|
||||||
existing.categories = await this.categoriesService.findByIds(categoryIds);
|
existing.categories = await this.categoriesService.findByIds(categoryIds);
|
||||||
|
|
||||||
await this.productRepo.save(existing);
|
await this.productRepo.save(existing);
|
||||||
|
|||||||
@@ -531,6 +531,14 @@ a:hover {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sf-user-text {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
.sf-info-box p + p,
|
.sf-info-box p + p,
|
||||||
.sf-info-box p + .sf-info-box__title {
|
.sf-info-box p + .sf-info-box__title {
|
||||||
margin-top: var(--sf-space-3);
|
margin-top: var(--sf-space-3);
|
||||||
@@ -1237,6 +1245,11 @@ a:hover {
|
|||||||
margin: 0 0 var(--sf-space-3);
|
margin: 0 0 var(--sf-space-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sf-prose p:empty {
|
||||||
|
min-height: 1lh;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.sf-payment-status {
|
.sf-payment-status {
|
||||||
margin: 0 0 var(--sf-space-3);
|
margin: 0 0 var(--sf-space-3);
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
@@ -1448,8 +1461,11 @@ a:hover {
|
|||||||
|
|
||||||
.sf-delivery-item__content {
|
.sf-delivery-item__content {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
}
|
}
|
||||||
@@ -1510,6 +1526,8 @@ a:hover {
|
|||||||
|
|
||||||
.sf-chat-bubble {
|
.sf-chat-bubble {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
border-radius: 0.875rem;
|
border-radius: 0.875rem;
|
||||||
padding: var(--sf-space-3);
|
padding: var(--sf-space-3);
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
@@ -1525,7 +1543,11 @@ a:hover {
|
|||||||
|
|
||||||
.sf-chat-bubble p {
|
.sf-chat-bubble p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sf-chat-meta {
|
.sf-chat-meta {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</p>
|
</p>
|
||||||
{{#if shippingNote}}
|
{{#if shippingNote}}
|
||||||
<p class='sf-info-box__title'>Typical shipping costs</p>
|
<p class='sf-info-box__title'>Typical shipping costs</p>
|
||||||
<p>{{shippingNote}}</p>
|
<p class='sf-user-text'>{{shippingNote}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@@ -42,6 +42,19 @@ describe('StorefrontProductsService', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('orders storefront products by sortOrder then createdAt desc', async () => {
|
||||||
|
await service.listStorefrontProducts(new Map(), undefined);
|
||||||
|
|
||||||
|
expect(productRepo.find).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
order: expect.objectContaining({
|
||||||
|
sortOrder: 'ASC',
|
||||||
|
createdAt: 'DESC'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns an empty map when no variant ids are requested', async () => {
|
it('returns an empty map when no variant ids are requested', async () => {
|
||||||
await expect(service.getStorefrontVariantsByIds([], new Map())).resolves.toEqual(new Map());
|
await expect(service.getStorefrontVariantsByIds([], new Map())).resolves.toEqual(new Map());
|
||||||
expect(variantRepo.find).not.toHaveBeenCalled();
|
expect(variantRepo.find).not.toHaveBeenCalled();
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export class StorefrontProductsService {
|
|||||||
where: categoryId ? { isDraft: false, categories: { id: categoryId } } : { isDraft: false },
|
where: categoryId ? { isDraft: false, categories: { id: categoryId } } : { isDraft: false },
|
||||||
relations: ['variants', 'variants.images'],
|
relations: ['variants', 'variants.images'],
|
||||||
order: {
|
order: {
|
||||||
|
sortOrder: 'ASC',
|
||||||
createdAt: 'DESC',
|
createdAt: 'DESC',
|
||||||
variants: {
|
variants: {
|
||||||
sortOrder: 'ASC',
|
sortOrder: 'ASC',
|
||||||
@@ -87,7 +88,6 @@ export class StorefrontProductsService {
|
|||||||
where: { id, isDraft: false },
|
where: { id, isDraft: false },
|
||||||
relations: ['variants', 'variants.images'],
|
relations: ['variants', 'variants.images'],
|
||||||
order: {
|
order: {
|
||||||
createdAt: 'DESC',
|
|
||||||
variants: {
|
variants: {
|
||||||
sortOrder: 'ASC',
|
sortOrder: 'ASC',
|
||||||
createdAt: 'ASC',
|
createdAt: 'ASC',
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { BOOLEAN_STRING_VALUES } from '../consts/booleanStringValues';
|
||||||
|
|
||||||
|
export type BooleanStringValue = (typeof BOOLEAN_STRING_VALUES)[number];
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>cms</title>
|
<title>cms</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 9.3 KiB |
@@ -224,6 +224,7 @@ const scrollToBottom = async (): Promise<void> => {
|
|||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
max-width: min(100%, 560px);
|
max-width: min(100%, 560px);
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-chat-message--buyer .order-chat-bubble {
|
.order-chat-message--buyer .order-chat-bubble {
|
||||||
@@ -237,7 +238,11 @@ const scrollToBottom = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.order-chat-body {
|
.order-chat-body {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-chat-delete {
|
.order-chat-delete {
|
||||||
|
|||||||
@@ -145,9 +145,11 @@ const downloadAttachment = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
.auto-delivery-item__content {
|
.auto-delivery-item__content {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
font-size: var(--el-font-size-small);
|
font-size: var(--el-font-size-small);
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: anywhere;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
.rich-text-editor-body :deep(.ProseMirror p) {
|
.rich-text-editor-body :deep(.ProseMirror p) {
|
||||||
margin: 0.35em 0;
|
margin: 0.35em 0;
|
||||||
|
min-height: 1lh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rich-text-editor-body :deep(.ProseMirror h2) {
|
.rich-text-editor-body :deep(.ProseMirror h2) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export interface Product {
|
|||||||
title: string;
|
title: string;
|
||||||
deliveryMode: DeliveryMode;
|
deliveryMode: DeliveryMode;
|
||||||
isDraft: boolean;
|
isDraft: boolean;
|
||||||
|
sortOrder: number;
|
||||||
descriptionHtml: string;
|
descriptionHtml: string;
|
||||||
variants?: ProductVariantExtended[];
|
variants?: ProductVariantExtended[];
|
||||||
categories?: Category[];
|
categories?: Category[];
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export interface UpdateProductPayload {
|
export interface UpdateProductPayload {
|
||||||
title: string;
|
title: string;
|
||||||
isDraft: boolean;
|
isDraft: boolean;
|
||||||
|
sortOrder: number;
|
||||||
descriptionHtml: string;
|
descriptionHtml: string;
|
||||||
categoryIds: string[];
|
categoryIds: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,15 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="Sort order" prop="sortOrder">
|
||||||
|
<el-input-number
|
||||||
|
v-model="productForm.sortOrder"
|
||||||
|
:min="0"
|
||||||
|
:step="1"
|
||||||
|
@update:model-value="productFormRef?.clearValidate('sortOrder')"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="Categories">
|
<el-form-item label="Categories">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="selectedCategoryIds"
|
v-model="selectedCategoryIds"
|
||||||
@@ -161,7 +170,8 @@ const productFormRef = ref<FormInstance>();
|
|||||||
const productForm = reactive({
|
const productForm = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
descriptionHtml: '',
|
descriptionHtml: '',
|
||||||
isDraft: true
|
isDraft: true,
|
||||||
|
sortOrder: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
const productSaving = ref(false);
|
const productSaving = ref(false);
|
||||||
@@ -175,6 +185,10 @@ const productRules: FormRules = {
|
|||||||
message: `At most ${validationProductTitleMaxLength} characters`,
|
message: `At most ${validationProductTitleMaxLength} characters`,
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
sortOrder: [
|
||||||
|
{ required: true, message: 'Sort order is required', trigger: 'change' },
|
||||||
|
{ type: 'integer', message: 'Sort order must be a whole number', trigger: 'change' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -200,6 +214,7 @@ onBeforeMount(async () => {
|
|||||||
productForm.title = currentProduct.value.title;
|
productForm.title = currentProduct.value.title;
|
||||||
productForm.descriptionHtml = currentProduct.value.descriptionHtml;
|
productForm.descriptionHtml = currentProduct.value.descriptionHtml;
|
||||||
productForm.isDraft = currentProduct.value.isDraft;
|
productForm.isDraft = currentProduct.value.isDraft;
|
||||||
|
productForm.sortOrder = currentProduct.value.sortOrder;
|
||||||
selectedCategoryIds.value = (currentProduct.value.categories ?? []).map(c => c.id);
|
selectedCategoryIds.value = (currentProduct.value.categories ?? []).map(c => c.id);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -236,6 +251,7 @@ const submitProduct = async (): Promise<void> => {
|
|||||||
title: productForm.title.trim(),
|
title: productForm.title.trim(),
|
||||||
descriptionHtml: productForm.descriptionHtml,
|
descriptionHtml: productForm.descriptionHtml,
|
||||||
isDraft: productForm.isDraft,
|
isDraft: productForm.isDraft,
|
||||||
|
sortOrder: productForm.sortOrder,
|
||||||
categoryIds: selectedCategoryIds.value
|
categoryIds: selectedCategoryIds.value
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="sortOrder" label="Order" width="80" />
|
||||||
|
|
||||||
<el-table-column label="Categories" min-width="160" show-overflow-tooltip>
|
<el-table-column label="Categories" min-width="160" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ formatProductCategories(row.categories) }}
|
{{ formatProductCategories(row.categories) }}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ Edit `.env.prod`. Mandatory configuration:
|
|||||||
| `POSTGRES_MIGRATIONS_RUN` | `true` |
|
| `POSTGRES_MIGRATIONS_RUN` | `true` |
|
||||||
| `PGADMIN_DEFAULT_PASSWORD` | strong random password |
|
| `PGADMIN_DEFAULT_PASSWORD` | strong random password |
|
||||||
| `NODE_ENV` | `production` |
|
| `NODE_ENV` | `production` |
|
||||||
| `CORS_ORIGINS` | `https://your-domain.com` |
|
|
||||||
| `CLEARNET_DOMAIN` | `your-domain.com` |
|
| `CLEARNET_DOMAIN` | `your-domain.com` |
|
||||||
| `JWT_SECRET` | strong random secret |
|
| `JWT_SECRET` | strong random secret |
|
||||||
| `CMS_PASSWORD` | strong admin password |
|
| `CMS_PASSWORD` | strong admin password |
|
||||||
@@ -56,8 +55,8 @@ Edit `.env.prod`. Mandatory configuration:
|
|||||||
| `MONERO_WALLET_PASSWORD` | strong wallet password |
|
| `MONERO_WALLET_PASSWORD` | strong wallet password |
|
||||||
| `ELECTRUM_NETWORK` | `mainnet` |
|
| `ELECTRUM_NETWORK` | `mainnet` |
|
||||||
| `ELECTRUM_SERVER` | Electrum peer as `host:port:s` (SSL) or `host:port:t` (TCP), e.g. `electrum.blockstream.info:50002:s` |
|
| `ELECTRUM_SERVER` | Electrum peer as `host:port:s` (SSL) or `host:port:t` (TCP), e.g. `electrum.blockstream.info:50002:s` |
|
||||||
| `ELECTRUM_WALLET_PASSWORD` | strong wallet password |
|
|
||||||
| `ELECTRUM_DAEMON_RPC_PASSWORD` | strong random password |
|
| `ELECTRUM_DAEMON_RPC_PASSWORD` | strong random password |
|
||||||
|
| `ELECTRUM_WALLET_PASSWORD` | strong wallet password |
|
||||||
| `VITE_API_BASE_URL` | `/api` |
|
| `VITE_API_BASE_URL` | `/api` |
|
||||||
| `VITE_SHOP_FIAT_CURRENCY` | same as `SHOP_FIAT_CURRENCY` |
|
| `VITE_SHOP_FIAT_CURRENCY` | same as `SHOP_FIAT_CURRENCY` |
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16
|
image: postgres:16.16
|
||||||
container_name: ${COMPOSE_PROJECT_NAME}_postgres
|
container_name: ${COMPOSE_PROJECT_NAME}_postgres
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
@@ -16,7 +16,7 @@ services:
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
pgadmin:
|
pgadmin:
|
||||||
image: dpage/pgadmin4
|
image: dpage/pgadmin4:9.19.0
|
||||||
container_name: ${COMPOSE_PROJECT_NAME}_pgadmin
|
container_name: ${COMPOSE_PROJECT_NAME}_pgadmin
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16
|
image: postgres:16.16
|
||||||
container_name: ${COMPOSE_PROJECT_NAME}_postgres
|
container_name: ${COMPOSE_PROJECT_NAME}_postgres
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
@@ -16,7 +16,7 @@ services:
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
pgadmin:
|
pgadmin:
|
||||||
image: dpage/pgadmin4
|
image: dpage/pgadmin4:9.19.0
|
||||||
container_name: ${COMPOSE_PROJECT_NAME}_pgadmin
|
container_name: ${COMPOSE_PROJECT_NAME}_pgadmin
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -57,12 +57,13 @@ ENV VITE_API_BASE_URL=$VITE_API_BASE_URL \
|
|||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:1.30.8-alpine3.24
|
||||||
|
|
||||||
RUN apk add --no-cache gettext
|
RUN apk add --no-cache gettext
|
||||||
|
|
||||||
COPY --from=cms-builder /cms/dist /usr/share/nginx/html/cms
|
COPY --from=cms-builder /cms/dist /usr/share/nginx/html/cms
|
||||||
|
|
||||||
|
COPY nginx/logging.conf /etc/nginx/conf.d/logging.conf
|
||||||
COPY nginx/conf.d/ /etc/nginx/templates/conf.d/
|
COPY nginx/conf.d/ /etc/nginx/templates/conf.d/
|
||||||
COPY nginx/snippets/ /etc/nginx/templates/snippets/
|
COPY nginx/snippets/ /etc/nginx/templates/snippets/
|
||||||
COPY nginx/docker-entrypoint.sh /docker-entrypoint.sh
|
COPY nginx/docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
access_log off;
|
||||||
|
error_log /dev/null;
|
||||||
@@ -31,13 +31,9 @@ location /api {
|
|||||||
proxy_pass http://backend:${BACKEND_PORT};
|
proxy_pass http://backend:${BACKEND_PORT};
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /cms {
|
location /cms {
|
||||||
return 301 /cms/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /cms/ {
|
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
try_files $uri $uri/ /cms/index.html;
|
try_files $uri /cms/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /pgadmin {
|
location /pgadmin {
|
||||||
|
|||||||
Reference in New Issue
Block a user