1
from typing import Any, Optional
3
from app.basic.partner.models import Partner
4
from app.basic.partner.schemas import PartnerCreateScheme, PartnerUpdateScheme, PartnerFilter
5
from core.permissions import permit
6
from core.service.base import BaseService, UpdateSchemaType, ModelType, FilterSchemaType, CreateSchemaType
9
class PartnerService(BaseService[Partner, PartnerCreateScheme, PartnerUpdateScheme, PartnerFilter]):
10
def __init__(self, request=None, db_session=None):
11
super(PartnerService, self).__init__(request, Partner, PartnerCreateScheme, PartnerUpdateScheme, db_session)
13
@permit('partner_edit')
14
async def update(self, id: Any, obj: UpdateSchemaType) -> Optional[ModelType]:
15
return await super(PartnerService, self).update(id, obj)
17
@permit('partner_list')
18
async def list(self, _filter: FilterSchemaType, size: int):
19
return await super(PartnerService, self).list(_filter, size)
21
@permit('partner_create')
22
async def create(self, obj: CreateSchemaType) -> ModelType:
23
return await super(PartnerService, self).create(obj)
25
@permit('partner_delete')
26
async def delete(self, id: Any) -> None:
27
return await super(PartnerService, self).delete(id)