[FEAT] (사용자 로직): 인증 서비스 로직 구현 중
v0.1.1 (2025-11-13) - 사용자 관련 인증 서비스 로직 구현 중
This commit is contained in:
31
src/repositories/base_repository.py
Normal file
31
src/repositories/base_repository.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
기본 레파지토리 추상 클래스
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import TypeVar, Generic, Optional, List, Type
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from extensions import db, custom_logger
|
||||
import settings
|
||||
|
||||
# Generic type for model entitles
|
||||
T = TypeVar('T')
|
||||
|
||||
logger = custom_logger(f"{settings.LOG_PREFIX}_repository")
|
||||
|
||||
class BaseRepository(ABC, Generic[T]):
|
||||
"""
|
||||
기본직인 CRUD 제공
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def model(self) -> Type[T]:
|
||||
"""레파지토리 반환"""
|
||||
pass
|
||||
|
||||
@property
|
||||
def session(self):
|
||||
"""현재 DB 세션 가져오기"""
|
||||
return db.session
|
||||
Reference in New Issue
Block a user