refactor: rename idp fields to provider naming

This commit is contained in:
Chris
2026-04-03 01:05:01 +08:00
parent 467f2b4867
commit ef27162903
35 changed files with 239 additions and 235 deletions

View File

@@ -19,7 +19,7 @@ class SystemsRepository:
count_stmt = select(func.count()).select_from(System)
if keyword:
pattern = f"%{keyword}%"
cond = or_(System.system_key.ilike(pattern), System.name.ilike(pattern), System.idp_client_id.ilike(pattern))
cond = or_(System.system_key.ilike(pattern), System.name.ilike(pattern), System.provider_client_id.ilike(pattern))
stmt = stmt.where(cond)
count_stmt = count_stmt.where(cond)
if status:
@@ -29,8 +29,8 @@ class SystemsRepository:
stmt = stmt.order_by(System.created_at.desc()).limit(limit).offset(offset)
return list(self.db.scalars(stmt).all()), int(self.db.scalar(count_stmt) or 0)
def create(self, *, system_key: str, name: str, idp_client_id: str, status: str = "active") -> System:
item = System(system_key=system_key, name=name, idp_client_id=idp_client_id, status=status)
def create(self, *, system_key: str, name: str, provider_client_id: str, status: str = "active") -> System:
item = System(system_key=system_key, name=name, provider_client_id=provider_client_id, status=status)
self.db.add(item)
self.db.commit()
self.db.refresh(item)
@@ -41,13 +41,13 @@ class SystemsRepository:
item: System,
*,
name: str | None = None,
idp_client_id: str | None = None,
provider_client_id: str | None = None,
status: str | None = None,
) -> System:
if name is not None:
item.name = name
if idp_client_id is not None:
item.idp_client_id = idp_client_id
if provider_client_id is not None:
item.provider_client_id = provider_client_id
if status is not None:
item.status = status
self.db.commit()