Esempio n. 1
0
class ProjectSchema(CamelCaseSchema):
    project_id = ma.Int(required=True)
    status = ma.Str(required=True)
    name = ma.Str(required=True)
    short_description = ma.Str(required=True)
    changeset_comment = ma.Str(required=True)
    author = ma.Str(required=True)
    url = ma.Url(required=True)
    created = ma.DateTime("%Y-%m-%dT%H:%M:%S.%fZ", required=True)
    external_source = ma.Nested(ExternalSourceSchema)
    users = ma.List(ma.Nested(UserSchema))
class PersonaSchema(ma.ModelSchema):
    roles = ma.Nested('PersonaRoleSchema', many=True)
    products = ma.Nested('ProductSchema',
                         many=True,
                         exclude=(
                             'personas',
                             'cust_id',
                         ))
    avatar = fields.Function(lambda obj: obj.persona_picture != None)

    class Meta:
        model = Persona
        sqla_session = db.session
Esempio n. 3
0
class ClientSchema(ma.Schema):
    convictions = ma.Nested(ConvictionSchema, many=True, exclude=('client', ))
    # exclude clients to avoid recursion issues lmao
    user = ma.Nested('UserSchema', exclude=('clients', ))

    class Meta:
        model = Client
        fields = ('id', 'full_name', 'phone', 'email', 'sex', 'race', 'dob',
                  'address_line_1', 'address_line_2', 'city', 'state',
                  'zip_code', 'license_number', 'full_license_issuing_state',
                  'license_expiration_date', 'status', 'active', 'user_id',
                  'notes', 'filing_court', 'judicial_circuit_number',
                  'county_of_prosecutor', 'judge_name', 'division_name',
                  'division_name', 'petitioner_name', 'division_number',
                  'city_name_here', 'county_name', 'arresting_county',
                  'arresting_municipality', 'other_agencies_name',
                  'cms_case_number', 'previous_expungements')
class ProductSchema(ma.ModelSchema):
    personas = ma.Nested('PersonaSchema',
                         many=True,
                         exclude=('products', 'persona_picture', 'cust_id'))

    class Meta:
        model = Product
        sqla_session = db.session
Esempio n. 5
0
class ConvictionSchema(ma.ModelSchema):
    # need to figure out good way to exclude convictions.charges.convictions.users, etc etc
    charges = ma.Nested(ChargeSchema, many=True, exclude=('convictions', ))
    client = ma.Nested('ClientSchema', exclude=('convictions', ))

    class Meta:
        model = Conviction
        fields = (
            'id',
            'client_id',
            'case_number',
            'agency',
            'court_name',
            'court_city_county',
            'judge',
            'record_name',
            'release_status',
            'release_date',
            'notes',
            'name',
            'arrest_date',
            'charges',
            'approximate_date_of_charge',
        )
Esempio n. 6
0
class ChargeSchema(ma.ModelSchema):
    conviction = ma.Nested('ConvictionSchema', exclude=(
        'charges',
        'client',
    ))

    class Meta:
        model = Charge
        fields = (
            'id',
            'conviction_id',
            'charge',
            'citation',
            'sentence',
            'eligible',
            'conviction_charge_type',
            'conviction_class_type',
            'eligible',
            'please_expunge',
            'notes',
            'conviction_description',
            'to_print',
            'convicted',
        )
Esempio n. 7
0
class ProjectListSchema(CamelCaseSchema):
    project = ma.List(ma.Nested(ProjectSchema), required=False)
Esempio n. 8
0
class OrganisationListSchema(CamelCaseSchema):
    organisation = ma.List(ma.Nested(OrganisationSchema))
Esempio n. 9
0
class UserSchema(ma.ModelSchema):
    clients = ma.Nested(ClientSchema, many=True, only=('id', 'full_name'))

    class Meta:
        model = User
        fields = ('id', 'username', 'clients')
Esempio n. 10
0
class DocumentSchema(CamelCaseSchema):
    project = ma.Nested(ProjectSchema)
    organisation = ma.Nested(OrganisationSchema)
    platform = ma.Nested(PlatformSchema)
Esempio n. 11
0
class OverviewPageSchema(CamelCaseSchema):
    organisation = ma.List(ma.Nested(OrganisationSchema))
    platform = ma.List(ma.Nested(PlatformSchema))
Esempio n. 12
0
class OrganisationPageSchema(CamelCaseSchema):
    project = ma.List(ma.Nested(ProjectSchema))
    organisation = ma.Nested(OrganisationSchema)
    platform = ma.List(ma.Nested(PlatformSchema))
Esempio n. 13
0
class UserSchema(ModelSchema):
    accounts = ma.Nested(AccountSchema)
    loan_applications = ma.Nested(LoanApplicationSchema)

    class Meta:
        fields = ('email', 'first_name', 'last_name', 'accounts', 'role', 'default_account', 'loan_applications')
class InsightCommentsSchema(ma.ModelSchema):
    user = ma.Nested('UserSchema', exclude=('password_hash', ))

    class Meta:
        model = InsightComments
        sqla_session = db.session