""" Options: Date: 2024-12-22 21:57:06 Version: 8.51 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://blazor-gallery.servicestack.net #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: UpdateBooking.* #ExcludeTypes: #DefaultImports: datetime,decimal,marshmallow.fields:*,servicestack:*,typing:*,dataclasses:dataclass/field,dataclasses_json:dataclass_json/LetterCase/Undefined/config,enum:Enum/IntEnum #DataClass: #DataClassJson: """ import datetime import decimal from marshmallow.fields import * from servicestack import * from typing import * from dataclasses import dataclass, field from dataclasses_json import dataclass_json, LetterCase, Undefined, config from enum import Enum, IntEnum class RoomType(str, Enum): SINGLE = 'Single' DOUBLE = 'Double' QUEEN = 'Queen' TWIN = 'Twin' SUITE = 'Suite' @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class Booking(AuditBase): """ Booking Details """ id: int = 0 name: Optional[str] = None room_type: Optional[RoomType] = None room_number: int = 0 booking_start_date: datetime.datetime = datetime.datetime(1, 1, 1) booking_end_date: Optional[datetime.datetime] = None cost: Decimal = decimal.Decimal(0) # @References(typeof(Coupon)) coupon_id: Optional[str] = None discount: Optional[Coupon] = None notes: Optional[str] = None cancelled: Optional[bool] = None # @Route("/booking/{Id}", "PATCH") # @ValidateRequest(Validator="HasRole(`Employee`)") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class UpdateBooking(IReturn[IdResponse], IPatchDb[Booking]): """ Update an existing Booking """ id: int = 0 name: Optional[str] = None room_type: Optional[RoomType] = None # @Validate(Validator="GreaterThan(0)") room_number: Optional[int] = None # @Validate(Validator="GreaterThan(0)") cost: Optional[Decimal] = None booking_start_date: Optional[datetime.datetime] = None booking_end_date: Optional[datetime.datetime] = None notes: Optional[str] = None coupon_id: Optional[str] = None cancelled: Optional[bool] = None