def create_stock( beginning_datetime: Optional[datetime] = None, booking_limit_datetime: Optional[datetime] = None, date_created: datetime = datetime.utcnow(), date_modified: datetime = datetime.utcnow(), date_modified_at_last_provider: Optional[datetime] = None, idx: Optional[int] = None, id_at_providers: Optional[str] = None, is_soft_deleted: bool = False, last_provider_id: Optional[int] = None, offer: Optional[Offer] = None, price: float = 10, quantity: Optional[int] = None, ) -> Stock: stock = Stock() stock.quantity = quantity stock.beginningDatetime = beginning_datetime stock.bookingLimitDatetime = booking_limit_datetime stock.dateCreated = date_created stock.dateModified = date_modified stock.dateModifiedAtLastProvider = date_modified_at_last_provider if idx: stock.id = idx stock.idAtProviders = id_at_providers stock.isSoftDeleted = is_soft_deleted stock.lastProviderId = last_provider_id stock.offer = offer stock.price = price return stock
def create_stock_from_offer( offer: Offer, price: float = 9.90, quantity: Optional[int] = 10, soft_deleted: bool = False, booking_limit_datetime: datetime = None, beginning_datetime: datetime = None, idx: int = None, date_modified: datetime = datetime.utcnow(), ) -> Stock: stock = Stock() stock.id = idx stock.offer = offer stock.price = price stock.quantity = quantity stock.isSoftDeleted = soft_deleted stock.bookingLimitDatetime = booking_limit_datetime stock.beginningDatetime = beginning_datetime stock.dateModified = date_modified return stock