""" Options: Date: 2024-12-04 18:56:29 Version: 8.12 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://vue-vite-api.jamstacks.net #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: CreateBooking.* #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) notes: Optional[str] = None cancelled: Optional[bool] = None created_date: datetime.datetime = datetime.datetime(1, 1, 1) # @Required() created_by: Optional[str] = None modified_date: datetime.datetime = datetime.datetime(1, 1, 1) # @Required() modified_by: Optional[str] = None deleted_date: Optional[datetime.datetime] = None deleted_by: Optional[str] = None # @Route("/bookings", "POST") # @ValidateRequest(Validator="HasRole(`Employee`)") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBooking(IReturn[IdResponse], ICreateDb[Booking]): """ Create a new Booking """ # @Validate(Validator="NotEmpty") name: Optional[str] = None """ Name this Booking is for """ room_type: Optional[RoomType] = None # @Validate(Validator="GreaterThan(0)") room_number: int = 0 # @Validate(Validator="GreaterThan(0)") cost: Decimal = decimal.Decimal(0) booking_start_date: datetime.datetime = datetime.datetime(1, 1, 1) booking_end_date: Optional[datetime.datetime] = None notes: Optional[str] = None