Add credentials table, CRUD endpoints, and credential parameter (#1767)

Co-authored-by: Muhammed Salih Altun <muhammedsalihaltun@gmail.com>
This commit is contained in:
Shuchang Zheng
2025-02-14 00:00:19 +08:00
committed by GitHub
parent b411af56a6
commit 4407c19417
11 changed files with 394 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
from datetime import datetime
from enum import StrEnum
from pydantic import BaseModel, ConfigDict
class CredentialType(StrEnum):
PASSWORD = "password"
CREDIT_CARD = "credit_card"
class PasswordCredential(BaseModel):
password: str
username: str
class CreditCardCredential(BaseModel):
card_number: str
card_cvv: str
card_exp_month: str
card_exp_year: str
card_brand: str
card_holder_name: str
class UpdateCredentialRequest(BaseModel):
name: str | None = None
website_url: str | None = None
class CreateCredentialRequest(BaseModel):
name: str
website_url: str | None = None
credential_type: CredentialType
credential: PasswordCredential | CreditCardCredential
class Credential(BaseModel):
model_config = ConfigDict(from_attributes=True)
credential_id: str
organization_id: str
name: str
website_url: str | None = None
credential_type: CredentialType
created_at: datetime
modified_at: datetime
deleted_at: datetime | None = None