fix: presentation expiresAt — skip empty date, convert YYYY-MM-DD to end-of-day UTC
Empty string sent to Appwrite datetime column was being interpreted as creation timestamp, making every no-expiry sunum immediately expired. Fix: - Only include expiresAt in payload when user actually set a date - Convert date-only string (YYYY-MM-DD) to YYYY-MM-DDT23:59:59.000Z so the sunum stays valid for the entire chosen day across all time zones - Strip empty customerId/notes to avoid empty-string writes
This commit is contained in:
@@ -191,11 +191,6 @@ export function LoginForm1({
|
|||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Alt logo — sadece geniş ekranda gizli olan mobil için */}
|
|
||||||
<p className="mt-10 text-xs text-muted-foreground lg:hidden">
|
|
||||||
Emlak CRM · Kovak Yazılım
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ export async function createPresentationAction(
|
|||||||
const data = parsed.data;
|
const data = parsed.data;
|
||||||
const id = ID.unique();
|
const id = ID.unique();
|
||||||
const shareToken = crypto.randomBytes(16).toString("hex");
|
const shareToken = crypto.randomBytes(16).toString("hex");
|
||||||
|
// Convert "YYYY-MM-DD" → end-of-day UTC so the sunum is valid the full chosen day.
|
||||||
|
const expiresAt = data.expiresAt ? `${data.expiresAt}T23:59:59.000Z` : undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await tablesDB.createRow(
|
await tablesDB.createRow(
|
||||||
@@ -39,12 +41,12 @@ export async function createPresentationAction(
|
|||||||
{
|
{
|
||||||
tenantId: ctx.tenantId,
|
tenantId: ctx.tenantId,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
customerId: data.customerId,
|
customerId: data.customerId || undefined,
|
||||||
propertyIds: data.propertyIds,
|
propertyIds: data.propertyIds,
|
||||||
shareToken,
|
shareToken,
|
||||||
expiresAt: data.expiresAt,
|
...(expiresAt ? { expiresAt } : {}),
|
||||||
viewCount: 0,
|
viewCount: 0,
|
||||||
notes: data.notes,
|
notes: data.notes || undefined,
|
||||||
createdBy: ctx.user.id,
|
createdBy: ctx.user.id,
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
@@ -81,13 +83,15 @@ export async function updatePresentationAction(
|
|||||||
const { tablesDB } = createAdminClient();
|
const { tablesDB } = createAdminClient();
|
||||||
const data = parsed.data;
|
const data = parsed.data;
|
||||||
|
|
||||||
|
const expiresAt = data.expiresAt ? `${data.expiresAt}T23:59:59.000Z` : undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await tablesDB.updateRow(DATABASE_ID, TABLES.presentations, id, {
|
await tablesDB.updateRow(DATABASE_ID, TABLES.presentations, id, {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
customerId: data.customerId,
|
customerId: data.customerId || undefined,
|
||||||
propertyIds: data.propertyIds,
|
propertyIds: data.propertyIds,
|
||||||
expiresAt: data.expiresAt,
|
...(expiresAt ? { expiresAt } : {}),
|
||||||
notes: data.notes,
|
notes: data.notes || undefined,
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
return { ok: false, error: "Sunum güncellenemedi." };
|
return { ok: false, error: "Sunum güncellenemedi." };
|
||||||
|
|||||||
Reference in New Issue
Block a user