feat: TTLock — correct DLL flow with buildNo/floorNo per lock

Backend: room-locks now store/return build_no, floor_no (required by
CE_WriteCard). issue-card passes buildNo/floorNo to agent instead of
cardSectors/username/password. testApi route simplified (no OAuth).

Frontend: remove username/password fields (not needed), add buildNo/floorNo
fields to lock mapping form, show building/floor in lock list.

Migration 056: adds build_no, floor_no columns to room_lock_mappings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 11:59:38 +03:00
parent 8c215f2dcd
commit 1ad2a8057a
4 changed files with 88 additions and 85 deletions

View File

@@ -617,7 +617,7 @@ export const api = {
req<{ ok: boolean }>('POST', `/api/hotels/${slug}/ttlock/test`, { workstationId }),
testApi: (slug: string, workstationId: string) =>
req<{ ok: boolean; lockCount?: number }>('POST', `/api/hotels/${slug}/ttlock/test-api`, { workstation_id: workstationId }),
req<{ ok: boolean }>('POST', `/api/hotels/${slug}/ttlock/test-api`, { workstation_id: workstationId }),
findApiConfig: (slug: string, workstationId: string) =>
req<{ ok: boolean; appDir?: string; results?: { path: string; matches: string[] }[] }>('POST', `/api/hotels/${slug}/ttlock/find-api-config`, { workstation_id: workstationId }),
@@ -628,7 +628,7 @@ export const api = {
getRoomLocks: (slug: string) =>
req<RoomLockMapping[]>('GET', `/api/hotels/${slug}/ttlock/room-locks`),
mapRoom: (slug: string, data: { roomId?: string; lockMac: string; lockName?: string }) =>
mapRoom: (slug: string, data: { roomId?: string; lockMac: string; lockName?: string; buildNo?: number; floorNo?: number }) =>
req<{ ok: boolean }>('POST', `/api/hotels/${slug}/ttlock/room-locks`, data),
unmapRoom: (slug: string, roomId: string) =>
@@ -1094,21 +1094,18 @@ export interface Workstation {
}
export interface TTLockConfig {
isEnabled: boolean
clientId: string
cardSectors: string
apiServer: string
ttlockUsername: string
isEnabled: boolean
clientId: string
cardSectors: string
apiServer: string
}
export interface TTLockConfigUpdate {
isEnabled?: boolean
clientId?: string
clientSecret?: string
ttlock_username?: string
ttlock_password?: string
cardSectors?: string
apiServer?: string
isEnabled?: boolean
clientId?: string
clientSecret?: string
cardSectors?: string
apiServer?: string
}
export interface RoomLockMapping {
@@ -1117,6 +1114,8 @@ export interface RoomLockMapping {
roomNumber: string
lockMac: string
lockName: string | null
buildNo: number
floorNo: number
}
export interface CardIssuanceResult {