This commit is contained in:
admin
2026-01-17 11:08:57 +09:00
parent d8ec60629e
commit 6661c7ac89
10 changed files with 610 additions and 47 deletions

View File

@@ -423,7 +423,7 @@ def update_journal_entry(journal_id: int, req: JournalEntryUpdateRequest):
UPDATE journal_entries
SET description = %s,
version = version + 1,
updated_at = NOW(),
updated_at = CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Tokyo',
updated_reason = %s
WHERE journal_id = %s
""", (
@@ -472,7 +472,7 @@ def delete_journal_entry(journal_id: int, req: JournalEntryDeleteRequest):
cur.execute("""
UPDATE journal_entries
SET is_deleted = true,
updated_at = NOW()
updated_at = CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Tokyo'
WHERE journal_entry_id = %s
AND is_deleted = false
RETURNING journal_entry_id

View File

@@ -14,7 +14,7 @@ def get_month_locks():
fiscal_year,
month,
is_locked,
locked_at,
(locked_at AT TIME ZONE 'UTC') AT TIME ZONE 'Asia/Tokyo' as locked_at,
locked_by
FROM month_locks
ORDER BY fiscal_year, month
@@ -39,11 +39,11 @@ def lock_month(fiscal_year: int, month: int):
locked_at,
locked_by
)
VALUES (%s, %s, true, NOW(), %s)
VALUES (%s, %s, true, CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Tokyo', %s)
ON CONFLICT (fiscal_year, month)
DO UPDATE
SET is_locked = true,
locked_at = NOW(),
locked_at = CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Tokyo',
locked_by = EXCLUDED.locked_by
""", (
fiscal_year,

View File

@@ -8,7 +8,9 @@ router = APIRouter(prefix="/year-locks", tags=["年度锁定"])
def get_year_locks():
with get_connection() as conn, conn.cursor() as cur:
cur.execute("""
SELECT fiscal_year, is_locked, locked_at, locked_by
SELECT fiscal_year, is_locked,
(locked_at AT TIME ZONE 'UTC') AT TIME ZONE 'Asia/Tokyo' as locked_at,
locked_by
FROM year_locks
ORDER BY fiscal_year
""")
@@ -20,11 +22,11 @@ def lock_year(fiscal_year: int):
with get_connection() as conn, conn.cursor() as cur:
cur.execute("""
INSERT INTO year_locks (fiscal_year, is_locked, locked_at, locked_by)
VALUES (%s, true, NOW(), %s)
VALUES (%s, true, CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Tokyo', %s)
ON CONFLICT (fiscal_year)
DO UPDATE
SET is_locked = true,
locked_at = NOW(),
locked_at = CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Tokyo',
locked_by = EXCLUDED.locked_by
""", (fiscal_year, "system"))
conn.commit()