File tree Expand file tree Collapse file tree 2 files changed +5
-35
lines changed
services/web/server/src/simcore_service_webserver Expand file tree Collapse file tree 2 files changed +5
-35
lines changed Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
12from typing import Self
23
3- import aiopg .sa
44from aiohttp import web
5- from attr import dataclass
65from models_library .users import UserID
76from sqlalchemy .ext .asyncio import AsyncEngine
87
98from ..constants import RQT_USERID_KEY
10- from . import _aiopg , _asyncpg
11-
12-
13- class BaseRepository :
14- def __init__ (self , engine : aiopg .sa .Engine , user_id : UserID | None = None ):
15- self ._engine = engine
16- self ._user_id = user_id
17-
18- assert isinstance (self ._engine , aiopg .sa .Engine ) # nosec
19-
20- @classmethod
21- def create_from_request (cls , request : web .Request ):
22- return cls (
23- engine = _aiopg .get_database_engine (request .app ),
24- user_id = request .get (RQT_USERID_KEY ),
25- )
26-
27- @classmethod
28- def create_from_app (cls , app : web .Application ):
29- return cls (engine = _aiopg .get_database_engine (app ), user_id = None )
30-
31- @property
32- def engine (self ) -> aiopg .sa .Engine :
33- return self ._engine
34-
35- @property
36- def user_id (self ) -> int | None :
37- return self ._user_id
9+ from . import _asyncpg
3810
3911
4012@dataclass (frozen = True )
41- class BaseRepositoryV2 :
42- # NOTE: Will replace BaseRepository
43- # https://github.com/ITISFoundation/osparc-simcore/issues/4529
13+ class BaseRepository :
4414 engine : AsyncEngine
4515 user_id : UserID | None = None
4616
Original file line number Diff line number Diff line change 2626from sqlalchemy .ext .asyncio import AsyncConnection
2727
2828from ..constants import FRONTEND_APPS_AVAILABLE
29- from ..db .base_repository import BaseRepositoryV2
29+ from ..db .base_repository import BaseRepository
3030from ._models import PaymentFieldsTuple , Product
3131
3232_logger = logging .getLogger (__name__ )
@@ -93,7 +93,7 @@ async def _get_product_payment_fields(
9393 )
9494
9595
96- class ProductRepository (BaseRepositoryV2 ):
96+ class ProductRepository (BaseRepository ):
9797
9898 async def list_products (
9999 self ,
You can’t perform that action at this time.
0 commit comments