fix(core): resolve local client url redirects and stabilize dev environment

- enforce localhost:5174 for wheel campaign client URL in local development
- lock vite dev server ports using strictPort on admin (5173) and client (5174)
- sanitize .env.example and remove hardcoded staging domain
- configure root dev orchestration and docker multi-stage build context
This commit is contained in:
s.esmaeili
2026-09-13 02:02:46 +03:30
parent efb0051ab9
commit afde44ab8a
67 changed files with 5229 additions and 558 deletions
@@ -62,13 +62,27 @@ export class CampaignService {
];
}
const [data, total] = await Promise.all([
const [campaigns, total] = await Promise.all([
this.prisma.campaign.findMany({
where,
skip,
take: pageSize,
orderBy: { createdAt: 'desc' },
include: {
prizes: {
select: {
id: true,
title: true,
type: true,
stockType: true,
initialStock: true,
remainingStock: true,
weight: true,
segmentColor: true,
sortOrder: true,
},
orderBy: { sortOrder: 'asc' },
},
_count: {
select: {
prizes: true,
@@ -81,6 +95,32 @@ export class CampaignService {
this.prisma.campaign.count({ where }),
]);
const formatFarsiDateTime = (d?: Date | null) => {
if (!d) return null;
try {
return new Intl.DateTimeFormat('fa-IR', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(d));
} catch {
return null;
}
};
const data = campaigns.map((campaign) => {
const prizeTypes = Array.from(new Set(campaign.prizes?.map((p) => p.type) || []));
return {
...campaign,
prizeTypes,
startAtFormatted: formatFarsiDateTime(campaign.startAt),
endAtFormatted: formatFarsiDateTime(campaign.endAt),
createdAtFormatted: formatFarsiDateTime(campaign.createdAt),
};
});
return {
data,
meta: {
+46 -2
View File
@@ -56,8 +56,31 @@ export class WinnerService {
this.prisma.userPrize.count({ where }),
]);
const formatFarsiDateTime = (d?: Date | null) => {
if (!d) return null;
try {
return new Intl.DateTimeFormat('fa-IR', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(d));
} catch {
return null;
}
};
const enrichedData = data.map((item) => ({
...item,
createdAt: item.wonAt,
wonAtFormatted: formatFarsiDateTime(item.wonAt),
redeemedAtFormatted: formatFarsiDateTime(item.redeemedAt),
prizeType: item.prize?.type,
}));
return {
data,
data: enrichedData,
meta: {
page,
pageSize,
@@ -200,8 +223,29 @@ export class WinnerService {
this.prisma.spin.count({ where }),
]);
const formatFarsiDateTime = (d?: Date | null) => {
if (!d) return null;
try {
return new Intl.DateTimeFormat('fa-IR', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(d));
} catch {
return null;
}
};
const enrichedData = data.map((item) => ({
...item,
createdAtFormatted: formatFarsiDateTime(item.createdAt),
prizeType: item.prize?.type,
}));
return {
data,
data: enrichedData,
meta: {
page,
pageSize,