feat: address now is telegram
This commit is contained in:
		@@ -83,12 +83,14 @@ class DealService(BaseService):
 | 
			
		||||
    async def quick_create(self, request: DealQuickCreateRequest, user: User) -> DealQuickCreateResponse:
 | 
			
		||||
        client_service = ClientService(self.session)
 | 
			
		||||
        client = await client_service.get_by_name(request.client_name)
 | 
			
		||||
 | 
			
		||||
        if not client:
 | 
			
		||||
            client = await client_service.create_client_raw(
 | 
			
		||||
                user,
 | 
			
		||||
                request.client_name,
 | 
			
		||||
                ClientDetailsSchema(address=request.client_address))
 | 
			
		||||
        await client_service.update_details(user, client, ClientDetailsSchema(address=request.client_address))
 | 
			
		||||
                ClientDetailsSchema()
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        rank = await self._get_rank_for_deal(DealStatus.CREATED)
 | 
			
		||||
        deal = Deal(
 | 
			
		||||
            name=request.name,
 | 
			
		||||
@@ -221,8 +223,12 @@ class DealService(BaseService):
 | 
			
		||||
        is_first = request.index == 0
 | 
			
		||||
        stmt = (
 | 
			
		||||
            select(Deal)
 | 
			
		||||
            .where(Deal.current_status == request.status,
 | 
			
		||||
                   Deal.id != request.deal_id)
 | 
			
		||||
            .where(
 | 
			
		||||
                Deal.current_status == request.status,
 | 
			
		||||
                Deal.id != request.deal_id,
 | 
			
		||||
                Deal.is_deleted == False,
 | 
			
		||||
                Deal.is_completed == False
 | 
			
		||||
            )
 | 
			
		||||
            .order_by(Deal.lexorank)
 | 
			
		||||
            .offset(max([request.index - 2, 0]))
 | 
			
		||||
            .limit(2 if not is_first else 1)
 | 
			
		||||
@@ -232,10 +238,6 @@ class DealService(BaseService):
 | 
			
		||||
        boundaries = query.scalars().all()
 | 
			
		||||
        top_boundary: Union[Deal, None] = boundaries[0] if not is_first else None
 | 
			
		||||
        bottom_boundary: Union[Deal, None] = boundaries[1] if len(boundaries) == 2 else None
 | 
			
		||||
        if top_boundary:
 | 
			
		||||
            print(top_boundary.name)
 | 
			
		||||
        if bottom_boundary:
 | 
			
		||||
            print(bottom_boundary.name)
 | 
			
		||||
        # working when between two elements
 | 
			
		||||
        if top_boundary and bottom_boundary:
 | 
			
		||||
            top_lexorank = lexorank.parse(top_boundary.lexorank)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user