class ThrivResourceSchema(ModelSchema): class Meta: model = ThrivResource fields = ('id', 'name', 'description', 'last_updated', 'owner', 'website', 'cost', 'institution_id', 'type_id', 'type', 'segment_id', 'segment', 'institution', 'availabilities', 'approved', 'files', 'contact_email', 'contact_phone', 'contact_notes', 'private', '_links', 'favorites', 'favorite_count', 'resource_categories', 'owners', 'user_may_view', 'user_may_edit', 'location', 'starts', 'ends') id = fields.Integer(required=False, allow_none=True) last_updated = fields.Date(required=False, allow_none=True) owner = fields.String(required=False, allow_none=True) contact_email = fields.String(required=False, allow_none=True) contact_phone = fields.String(required=False, allow_none=True) contact_notes = fields.String(required=False, allow_none=True) website = fields.String(required=False, allow_none=True) institution_id = fields.Integer(required=False, allow_none=True) type_id = fields.Integer(required=False, allow_none=True) segment_id = fields.Integer(required=False, allow_none=True) approved = fields.String(required=False, allow_none=True) favorite_count = fields.Integer(required=False, allow_none=True) private = fields.Boolean(required=False, allow_none=True) location = fields.String(required=False, allow_none=True) starts = fields.DateTime(required=False, allow_none=True) ends = fields.DateTime(required=False, allow_none=True) type = fields.Nested(ThrivTypeSchema(), dump_only=True) segment = fields.Nested(ThrivSegmentSchema(), dump_only=True) institution = fields.Nested(ThrivInstitutionSchema(), dump_only=True, allow_none=True) availabilities = fields.Nested(AvailabilitySchema(), many=True, dump_only=True) favorites = fields.Nested(FavoriteSchema(), many=True, dump_only=True) resource_categories = fields.Nested(CategoriesOnResourceSchema(), many=True, dump_only=True) files = fields.Nested(FileSchema(), many=True, dump_only=True) user_may_view = fields.Boolean(allow_none=True) user_may_edit = fields.Boolean(allow_none=True) _links = ma.Hyperlinks( { 'self': ma.URLFor('api.resourceendpoint', id='<id>'), 'collection': ma.URLFor('api.resourcelistendpoint'), 'institution': ma.UrlFor('api.institutionendpoint', id='<institution_id>'), 'type': ma.UrlFor('api.typeendpoint', id='<type_id>'), 'categories': ma.UrlFor('api.categorybyresourceendpoint', resource_id='<id>'), 'availability': ma.UrlFor('api.resourceavailabilityendpoint', resource_id='<id>') }, dump_only=True)
class ResourceSchema(ModelSchema): class Meta: model = Resource fields = ('id', 'type', 'title', 'last_updated', 'description', 'organization_id', 'phone', 'website', 'organization', 'resource_categories', 'ages', '_links') organization_id = fields.Integer(required=False, allow_none=True) organization = fields.Nested(OrganizationSchema(), dump_only=True, allow_none=True) resource_categories = fields.Nested(CategoriesOnResourceSchema(), many=True, dump_only=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.resourceendpoint', id='<id>'), 'collection': ma.URLFor('api.resourcelistendpoint'), 'organization': ma.UrlFor('api.organizationendpoint', id='<organization_id>'), 'categories': ma.UrlFor('api.categorybyresourceendpoint', resource_id='<id>') })
class UserSchema(ModelSchema): class Meta: model = User fields = ('id', '_links', 'eppn', 'display_name', 'email', 'role', 'institution_id', 'institution', 'password', 'institutional_role', 'division') password = fields.String(load_only=True) id = fields.Integer(required=False, allow_none=True) institution_id = fields.Integer(required=False, allow_none=True) institution = fields.Nested(ThrivInstitutionSchema(), dump_only=True, allow_none=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.userendpoint', id='<id>'), 'favorites': ma.UrlFor('api.userfavoriteendpoint'), 'resources': ma.UrlFor('api.userresourceendpoint'), })
class EventSchema(ModelSchema): class Meta: model = Event fields = ('id', 'type', 'title', 'last_updated', 'description', 'date', 'time', 'ticket_cost', 'organization_id', 'primary_contact', 'location_name', 'street_address1', 'street_address2', 'city', 'state', 'zip', 'phone', 'website', 'organization', 'resource_categories', 'latitude', 'longitude', 'ages', '_links') id = fields.Integer(required=False, allow_none=True) organization_id = fields.Integer(required=False, allow_none=True) organization = fields.Nested(OrganizationSchema(), dump_only=True, allow_none=True) resource_categories = fields.Nested(CategoriesOnEventSchema(), many=True, dump_only=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.eventendpoint', id='<id>'), 'collection': ma.URLFor('api.eventlistendpoint'), 'organization': ma.UrlFor('api.organizationendpoint', id='<organization_id>'), 'categories': ma.UrlFor('api.categorybyeventendpoint', event_id='<id>') })
class StudySchema(ModelSchema): class Meta: model = Study fields = ('id', 'title', 'short_title', 'short_description', 'image_url', 'last_updated', 'description', 'participant_description', 'benefit_description', 'coordinator_email', 'organization_id', 'organization', 'location', 'status', 'study_categories', 'study_investigators', 'study_users', 'eligibility_url', 'ages', '_links') organization_id = fields.Integer(required=False, allow_none=True) organization = fields.Nested(OrganizationSchema(), dump_only=True, allow_none=True) status = EnumField(Status) study_categories = fields.Nested(CategoriesOnStudySchema(), many=True, dump_only=True) study_investigators = fields.Nested(InvestigatorsOnStudySchema(), many=True, dump_only=True) study_users = fields.Nested(UsersOnStudySchema(), many=True, dump_only=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.studyendpoint', id='<id>'), 'collection': ma.URLFor('api.studylistendpoint'), 'organization': ma.UrlFor('api.organizationendpoint', id='<organization_id>'), 'categories': ma.UrlFor('api.categorybystudyendpoint', study_id='<id>') })
class ResourceSchema(ModelSchema): class Meta: model = Resource fields = ('id', 'type', 'title', 'last_updated', 'description', 'organization_name', 'phone', 'website', 'contact_email', 'video_code', 'is_uva_education_content', 'resource_categories', 'is_draft', 'ages', 'insurance', 'phone_extension', 'languages', 'covid19_categories', '_links') resource_categories = fields.Nested(CategoriesOnResourceSchema(), many=True, dump_only=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.resourceendpoint', id='<id>'), 'collection': ma.URLFor('api.resourcelistendpoint'), 'categories': ma.UrlFor('api.categorybyresourceendpoint', resource_id='<id>') })
class InvestigatorSchema(ModelSchema): class Meta: model = Investigator fields = ('id', 'last_updated', 'name', 'title', 'organization_id', 'organization', 'bio_link', '_links') organization_id = fields.Integer(required=False, allow_none=True) organization = fields.Nested(OrganizationSchema(), dump_only=True, allow_none=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.investigatorendpoint', id='<id>'), 'collection': ma.URLFor('api.investigatorlistendpoint'), 'organization': ma.UrlFor('api.organizationendpoint', id='<organization_id>') })
class StudySchema(ModelSchema): class Meta(ModelSchema.Meta): model = Study fields = ('id', 'title', 'short_title', 'short_description', 'image_url', 'last_updated', 'description', 'participant_description', 'benefit_description', 'coordinator_email', 'organization_name', 'location', 'status', 'study_categories', 'study_investigators', 'eligibility_url', 'survey_url', 'results_url', 'ages', 'languages', 'num_visits', '_links') status = EnumField(Status) study_categories = ma.Nested(CategoriesOnStudySchema(), many=True, dump_only=True) study_investigators = ma.Nested(InvestigatorsOnStudySchema(), many=True, dump_only=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.studyendpoint', id='<id>'), 'collection': ma.URLFor('api.studylistendpoint'), 'categories': ma.UrlFor('api.categorybystudyendpoint', study_id='<id>') })
class EventSchema(ModelSchema): class Meta(ModelSchema.Meta): model = Event fields = ('id', 'type', 'title', 'last_updated', 'description', 'date', 'time', 'ticket_cost', 'primary_contact', 'location_name', 'street_address1', 'street_address2', 'city', 'state', 'zip', 'phone', 'website', 'contact_email', 'video_code', 'is_uva_education_content', 'is_draft', 'organization_name', 'resource_categories', 'latitude', 'longitude', 'ages', 'insurance', 'phone_extension', 'languages', 'covid19_categories', 'includes_registration', 'webinar_link', 'post_survey_link', 'max_users', 'registered_users', 'image_url', 'registration_url', 'should_hide_related_resources', 'post_event_description', '_links') id = fields.Integer(required=False, allow_none=True) resource_categories = fields.Nested(CategoriesOnEventSchema(), many=True, dump_only=True) registered_users = fields.Nested(EventUserSchema(), many=True, dump_only=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('api.eventendpoint', id='<id>'), 'collection': ma.URLFor('api.eventlistendpoint'), 'categories': ma.UrlFor('api.categorybyeventendpoint', event_id='<id>') })