mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
16 lines
510 B
Python
16 lines
510 B
Python
# -*- coding: utf-8 -*-
|
|
from typing import Optional
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.labeler import Labeler
|
|
from app.schemas.labeler import LabelerCreate, LabelerUpdate
|
|
from sqlmodel import Session
|
|
|
|
|
|
class CRUDLabeler(CRUDBase[Labeler, LabelerCreate, LabelerUpdate]):
|
|
def get_by_discord_username(self, db: Session, discord_username: str) -> Optional[Labeler]:
|
|
return db.query(Labeler).filter(Labeler.discord_username == discord_username).first()
|
|
|
|
|
|
labeler = CRUDLabeler(Labeler)
|