last_used in register_card
Check flake syntax / flake-check (push) Successful in 33s
Test python action / test (push) Successful in 41s

This commit is contained in:
2026-11-09 15:35:56 +01:00
parent 2a44e3a1a6
commit ee91b03198
+10
View File
@@ -3,6 +3,7 @@ import logging
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.exc import NoResultFound
from sqlmodel import Session, select
from datetime import datetime, UTC
from app.model.models import Card, CardCreate, CardUpdate, GroupDB
from app.services.auth import auth_is_admin
@@ -27,6 +28,7 @@ def register_card(cardInput: CardCreate):
name=cardInput.name,
card_serial=uid,
enabled=cardInput.enabled,
last_used=datetime.now(tz=UTC)
)
return card
@@ -116,3 +118,11 @@ def update_card(
) from err
db_card.sqlmodel_update(card_data)
return add_and_refresh(db, db_card)
@card_router.get("/inactive")
def inactive_card_search(enabled: bool = False, uses: bool = False, ended: bool = False, db: Session = Depends(get_session), admin: bool = Depends(auth_is_admin)):
results = []
if not enabled and not uses and not ended:
return {"message": "No results. Please activate at least one filter rule"}
if enabled:
return {"message": "Results with disabled cards heres"}