Compare commits

...
Author SHA1 Message Date
devops 2a58e0c731 fix(revalidation): load runtime secret from env file
Deploy Canina / deploy (push) Successful in 37s
2026-10-14 21:20:38 +00:00
devops 1cbd210be1 fix(ci): preserve support chat runtime configuration
Deploy Canina / deploy (push) Successful in 49s
2026-10-14 20:57:07 +00:00
devops 8f8f0c36d5 ci: keep deploy workflow only
Deploy Canina / deploy (push) Successful in 38s
2026-10-14 20:08:41 +00:00
devops ed20f6d089 merge: prioritize available products
Deploy Canina / deploy (push) Has been cancelled
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
Torob regression / torob-regression (push) Failing after 38s
2026-10-14 20:06:40 +00:00
devops 12861288f2 feat(shop): show available products first 2026-10-14 20:04:50 +00:00
devops 73bfe0d893 merge: promote develop to main
Deploy Canina / deploy (push) Successful in 2m18s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
Torob regression / torob-regression (push) Failing after 34s
2026-10-14 19:58:50 +00:00
devops a289c40503 merge: admin smart-chat settings
Deploy Canina / deploy (push) Successful in 4m32s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s
Torob regression / torob-regression (push) Failing after 40s
2026-10-14 19:44:40 +00:00
devops f6736cd43f fix(stage): deploy Torob backend without schema writes [skip ci] 2026-10-14 19:38:57 +00:00
8 changed files with 103 additions and 107 deletions

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ jobs:
- name: Run deploy.sh from within the scripts folder
env:
BRANCH: ${{ github.ref_name }}
SUPPORT_CHAT_KEY: ${{ secrets.SUPPORT_CHAT_KEY }}
run: |
# 1. رفع مشکل DNS و غیرفعال کردن پروکسی برای دامنه محلی
echo "87.248.133.138 git.parsaaghayi.ir" >> /etc/hosts
-45
View File
@@ -1,45 +0,0 @@
name: E2E Playwright Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test-e2e:
name: Run Full E2E & Security Suites
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install Monorepo Dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run E2E Test Suite
run: npx playwright test --project=chromium-desktop --project=admin-chromium
env:
CI: true
NODE_ENV: test
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 14
-32
View File
@@ -1,32 +0,0 @@
name: Torob regression
on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]
jobs:
torob-regression:
runs-on: ubuntu-latest
services:
torob-test-db:
image: postgres:16-alpine
env:
POSTGRES_USER: torob
POSTGRES_PASSWORD: disposable-fixture-only
POSTGRES_DB: torob_test
options: >-
--health-cmd "pg_isready -U torob -d torob_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
container: node:20
env:
DATABASE_URL: postgresql://torob:disposable-fixture-only@torob-test-db:5432/torob_test
steps:
- uses: actions/checkout@v4
- name: Install and generate isolated client
run: cd backend && npm ci && npx prisma generate
- name: Unit regressions
run: cd backend && npm test -- --runInBand src/products/torob.controller.spec.ts
- name: Disposable PostgreSQL integration
run: cd backend && npx prisma db push --skip-generate && npx jest --config test/jest-torob.json --runInBand
+49 -29
View File
@@ -76,6 +76,12 @@ const CATEGORY_MAP: Record<string, { category?: string; query?: string; symptoms
"شستشوی چشم": { category: "special-care", query: "چشم" },
};
export const orderProductsByAvailability = (products: Product[]): Product[] => {
const available = products.filter(product => !isProductOutOfStock(product));
const unavailable = products.filter(product => isProductOutOfStock(product));
return [...available, ...unavailable];
};
export const ArchiveProductCard: React.FC<{ product: Product }> = ({ product }) => {
const { addItem } = useCartStore();
const cartItem = useCartStore((s) => s.items.find(i => i.product.id === product.id));
@@ -572,7 +578,7 @@ export default function ArchivePage({
result = result.filter(p => p.symptoms && p.symptoms.some(s => activeSymptoms.includes(s)));
}
setFilteredProducts(result);
setFilteredProducts(orderProductsByAvailability(result));
} catch (error) {
console.error("Failed to fetch products:", error);
toast.error("خطا در دریافت لیست محصولات از سرور. لطفاً صفحه را رفرش کنید.");
@@ -1087,35 +1093,49 @@ export default function ArchivePage({
)
) : filteredProducts.length > 0 ? (
<>
{/* Mobile List View vs Card View (Desktop is always responsive multi-column grid) */}
<div
key={viewMode}
className={
viewMode === "list"
? "flex flex-col gap-3 lg:grid lg:grid-cols-2 xl:grid-cols-4 lg:gap-6"
: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-6"
}
>
<AnimatePresence mode="popLayout">
{filteredProducts.map((p: Product) => (
<React.Fragment key={p.id}>
{/* In list mode on mobile, render ArchiveProductListItem; on desktop (lg+), render standard card */}
{viewMode === "list" ? (
<>
<div className="block lg:hidden w-full">
<ArchiveProductListItem product={p} />
</div>
<div className="hidden lg:block h-full">
{/* Keep API sort order inside each availability section. */}
{([{
key: "available",
title: "محصولات موجود",
products: filteredProducts.filter(product => !isProductOutOfStock(product)),
}, {
key: "unavailable",
title: "محصولات ناموجود",
products: filteredProducts.filter(product => isProductOutOfStock(product)),
}] as const).map(section => section.products.length > 0 && (
<section key={section.key} data-testid={`products-${section.key}`} className="mb-10 last:mb-0">
<h2 className="mb-5 text-xl font-black text-medical-gray-900">{section.title}</h2>
{/* Mobile List View vs Card View (Desktop is always responsive multi-column grid) */}
<div
key={viewMode}
className={
viewMode === "list"
? "flex flex-col gap-3 lg:grid lg:grid-cols-2 xl:grid-cols-4 lg:gap-6"
: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-6"
}
>
<AnimatePresence mode="popLayout">
{section.products.map((p: Product) => (
<React.Fragment key={p.id}>
{/* In list mode on mobile, render ArchiveProductListItem; on desktop (lg+), render standard card */}
{viewMode === "list" ? (
<>
<div className="block lg:hidden w-full">
<ArchiveProductListItem product={p} />
</div>
<div className="hidden lg:block h-full">
<ArchiveProductCard product={p} />
</div>
</>
) : (
<ArchiveProductCard product={p} />
</div>
</>
) : (
<ArchiveProductCard product={p} />
)}
</React.Fragment>
))}
</AnimatePresence>
</div>
)}
</React.Fragment>
))}
</AnimatePresence>
</div>
</section>
))}
{/* SEO Category Rich Description Section (Rendered below products to maintain primary UX while boosting category SEO) */}
{selectedCategory !== "all" && (
@@ -2,7 +2,7 @@
import React from "react";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import ArchivePage from "../ArchivePage";
import ArchivePage, { orderProductsByAvailability } from "../ArchivePage";
import { productService } from "../../lib/services/productService";
import { useCartStore } from "../../lib/store/cartStore";
import { usePetStore } from "../../lib/store/usePetStore";
@@ -117,6 +117,32 @@ const mockProducts = [
},
];
it("puts available products first while preserving descending-price sort order within groups", () => {
const sortedByPriceDesc = [
{ id: "out-high", stock: 0 },
{ id: "in-mid", stock: 5 },
{ id: "in-low", stock: 2 },
{ id: "out-low", stock: 0 },
] as any;
expect(orderProductsByAvailability(sortedByPriceDesc).map(product => product.id)).toEqual([
"in-mid", "in-low", "out-high", "out-low",
]);
});
it("puts available products first while preserving ascending-price sort order and groups status fields", () => {
const sortedByPriceAsc = [
{ id: "in-low", stockStatus: "IN_STOCK" },
{ id: "out-mid", stockStatus: "OUT_OF_STOCK" },
{ id: "in-high", stockStatus: "IN_STOCK" },
{ id: "out-discontinued", stockStatus: "DISCONTINUED" },
] as any;
expect(orderProductsByAvailability(sortedByPriceAsc).map(product => product.id)).toEqual([
"in-low", "in-high", "out-mid", "out-discontinued",
]);
});
describe("ArchivePage Component", () => {
beforeEach(() => {
vi.clearAllMocks();
+8
View File
@@ -27,6 +27,11 @@ services:
NPM_REGISTRY: ${NPM_REGISTRY:-}
container_name: canino_backend_prod
restart: always
env_file:
- path: .support-chat.env
required: false
- path: .revalidation.env
required: false
environment:
- NODE_ENV=production
- ENABLE_SWAGGER=false
@@ -59,6 +64,9 @@ services:
VITE_API_URL: "https://api.canina.ir"
container_name: canino_frontend_prod
restart: always
env_file:
- path: .revalidation.env
required: false
labels:
- "traefik.enable=true"
- "traefik.http.routers.canina-prod.rule=Host(`canina.ir`) || Host(`www.canina.ir`) || Host(`admin.canina.ir`)"
+5
View File
@@ -30,6 +30,8 @@ services:
env_file:
- path: .support-chat.env
required: false
- path: .revalidation.env
required: false
dns:
- 217.218.127.127
- 217.218.155.155
@@ -67,6 +69,9 @@ services:
VITE_API_URL: "https://stageapi.canina.ir"
container_name: canino_frontend_stage
restart: always
env_file:
- path: .revalidation.env
required: false
dns:
- 217.218.127.127
- 217.218.155.155
+13
View File
@@ -66,6 +66,19 @@ fi
cd "$TARGET_DIR"
# Inject support-chat runtime configuration from CI/CD without committing secrets.
if [ "${SUPPORT_CHAT_KEY+x}" = x ]; then
touch .support-chat.env
grep -v '^SUPPORT_CHAT_KEY=' .support-chat.env > .support-chat.env.tmp || true
printf "SUPPORT_CHAT_KEY=%s\n" "$SUPPORT_CHAT_KEY" >> .support-chat.env.tmp
mv .support-chat.env.tmp .support-chat.env
chmod 600 .support-chat.env
fi
if [ ! -s .support-chat.env ]; then
echo "ERROR: missing .support-chat.env / SUPPORT_CHAT_KEY; refusing deployment" >&2
exit 1
fi
# ✅ فایل‌های کانفیگ را از پوشه‌ی scripts مخزن به TARGET_DIR کپی می‌کنیم
echo "Copying configuration files in $TARGET_DIR..."
cp "scripts/$COMPOSE_FILE" "docker-compose.yml"