Esempio n. 1
0
class Booking(typesystem.Schema):
    start_date = typesystem.Date()
    end_date = typesystem.Date()
    room = typesystem.Choice(choices=[
        ("double", "Double room"),
        ("twin", "Twin room"),
        ("single", "Single room"),
    ])
    include_breakfast = typesystem.Boolean(title="Include breakfast",
                                           default=False)
Esempio n. 2
0
class UserSchema(typesystem.Schema):
    name = typesystem.String(title="Name")
    email = typesystem.String(title="E-mail")
    email_verified = typesystem.Boolean(title="E-mail verified?",
                                        default=False)
    given_name = typesystem.String(title="Given name", allow_null=True)
    middle_name = typesystem.String(title="Middle name", allow_null=True)
    family_name = typesystem.String(title="Family name", allow_null=True)
    nickname = typesystem.String(title="Nick name", allow_null=True)
    preferred_username = typesystem.String(title="Preferred user name",
                                           allow_null=True)
    profile = typesystem.String(title="Profile", allow_null=True)
    website = typesystem.String(title="Website", allow_null=True)
    gender = typesystem.String(title="Gender", allow_null=True)
    birthdate = typesystem.Date(title="Birthdate", allow_null=True)
    zoneinfo = typesystem.String(title="Zone info", allow_null=True)
    locale = typesystem.String(title="Locale", allow_null=True)
    phone_number = typesystem.String(title="Phone number",
                                     format="tel",
                                     allow_null=True)
    phone_number_verified = typesystem.Boolean(title="Phone number verified?",
                                               allow_null=True)
    address = typesystem.String(title="Address", allow_null=True)
    cognito_mfa_enabled = typesystem.Boolean(title="MFA enabled?",
                                             default=True)
Esempio n. 3
0
class BookingSchema(typesystem.Schema):
    start_date = typesystem.Date(title="Start date")
    end_date = typesystem.Date(title="End date")
    room = typesystem.Choice(
        title="Room type",
        choices=[
            ("double", "Double room"),
            ("twin", "Twin room"),
            ("single", "Single room"),
        ],
    )
    include_breakfast = typesystem.Boolean(title="Include breakfast",
                                           default=False)

    def __str__(self):
        breakfast = ("(with breakfast)"
                     if self.include_breakfast else "(without breakfast)")
        return f"Booking for {self.room} from {self.start_date} to {self.end_date}"
Esempio n. 4
0
 class Album(typesystem.Schema, definitions=definitions):
     title = typesystem.String(max_length=100)
     release_date = typesystem.Date()
     artist = typesystem.Reference("Artist")
Esempio n. 5
0
 class Album(typesystem.Schema):
     title = typesystem.String(max_length=100)
     release_date = typesystem.Date()
     artist = typesystem.Reference(Artist)
Esempio n. 6
0
 class Example(typesystem.Schema):
     created = typesystem.Date(default=datetime.date.today)
Esempio n. 7
0
 class BlogPost(typesystem.Schema):
     text = typesystem.String()
     created = typesystem.Date()
Esempio n. 8
0
 class BlogPost(typesystem.Schema):
     text = typesystem.String()
     created = typesystem.Date()
     modified = typesystem.Date(allow_null=True)
Esempio n. 9
0
 class BlogPost(typesystem.Schema):
     text = typesystem.String()
     modified = typesystem.Array(typesystem.Date())
Esempio n. 10
0
 def get_validator(self, **kwargs) -> typesystem.Field:
     return typesystem.Date(**kwargs)