feat(vacation): 상세 — 승인은 취소처리, 미승인(작성중/제출/반려)은 삭제(hard)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -351,6 +351,23 @@ class VacationDBStore:
|
||||
).fetchone()
|
||||
return self._req_serialize(row)
|
||||
|
||||
def hard_delete(self, *, request_id: str, user_email: str, is_admin: bool) -> None:
|
||||
"""완전 삭제. 승인 전(작성중/제출/반려)만 허용. owner 또는 admin."""
|
||||
user_email = user_email.lower().strip()
|
||||
current = self.get_request(request_id=request_id)
|
||||
if not current:
|
||||
raise KeyError(request_id)
|
||||
if not is_admin and current["owner"] != user_email:
|
||||
raise PermissionError("본인 신청만 삭제할 수 있습니다.")
|
||||
if current["status"] == "승인":
|
||||
raise ValueError("승인된 휴가는 삭제할 수 없습니다. 취소 처리하세요.")
|
||||
with self._pool.connection() as conn:
|
||||
cur = conn.execute(
|
||||
"DELETE FROM vacation_requests WHERE id = %s", (request_id,)
|
||||
)
|
||||
if cur.rowcount == 0:
|
||||
raise KeyError(request_id)
|
||||
|
||||
def list_pending(self) -> list[dict[str, Any]]:
|
||||
with self._pool.connection() as conn:
|
||||
rows = conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user