Skip to content

Documentation


Documentation / @kizami/db / findActiveLeaveGrantProposal

Function: findActiveLeaveGrantProposal()

findActiveLeaveGrantProposal(db, params): Promise<{ attendanceRate: string; createdAt: number; days: number; decidedAt: number | null; decidedBy: string | null; decisionNote: string | null; expiresOn: string; grantedOn: string; grantId: string | null; id: string; leaveType: string; proposedAt: number; status: string; tenantId: string; userId: string; } | null>

Defined in: packages/db/src/queries/leave.ts:331

(tenant, user, leaveType, grantedOn) について superseded 以外の予告があれば返す (= 「もう予告済み(あるいは決裁済み)なので作り直さない」の判定に使う)。

判断点: rejected も「作り直さない」側に数える。却下は「この基準日については付与しない」と いう管理者の意思決定であり、翌日のワーカー実行で同じ予告が復活すると却下の意味が無くなる (依頼「reject blocks re-proposal」)。却下後にやはり付与したくなった場合は手動の POST /leave/grants/auto(あるいは POST /leave/grants)を使う。

Parameters

db

Database | SQLiteTransaction<"async", ResultSet, schema, ExtractTablesWithRelations<schema>>

params

grantedOn

string

leaveType

string

tenantId

string

userId

string

Returns

Promise<{ attendanceRate: string; createdAt: number; days: number; decidedAt: number | null; decidedBy: string | null; decisionNote: string | null; expiresOn: string; grantedOn: string; grantId: string | null; id: string; leaveType: string; proposedAt: number; status: string; tenantId: string; userId: string; } | null>