class TalkingPointResource(Resource): class Meta: resource_name = "talking_points" model_class = TalkingPoint methods = ["GET", "POST", "PUT", "DELETE"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "user_id": ["eq", "in"], "topic__id": ["eq"] } related_methods = {} related_bulk_methods = {} with_relations = [] ordering = ["id", "rank"] #fields id = fields.IntegerField(primary_key=True) user_id = fields.EncodedField() topic_id = fields.EncodedField() rank = fields.IntegerField() point = fields.StringField() #related fields user = fields.EncodedForeignKey(UserResource, backref="talking_points+") topic = fields.EncodedForeignKey(TopicResource, backref="talking_points", model_name="topic", model_attname="topic_id") #objects objects = TalkingPointManager(db_session_factory) authenticator = SessionAuthenticator()
class ChatReelResource(Resource): class Meta: resource_name = "chat_reels" model_class = ChatReel methods = ["GET", "POST", "PUT", "DELETE"] bulk_methods = ["GET"] related_methods = { "user": ["GET"], "chat": ["GET"] } filtering = { "id": ["eq"], "user_id": ["eq"], "user__id": ["eq"], "chat__id": ["eq"] } with_relations = ["user", "chat__topic"] ordering = ["id", "rank"] limit = 20 id = fields.IntegerField(primary_key=True) user_id = fields.EncodedField() chat_id = fields.EncodedField() rank = fields.IntegerField() user = fields.EncodedForeignKey(UserResource, backref="chat_reels", model_name="user", model_attname="user_id") chat = fields.EncodedForeignKey(ChatResource, backref="chat_reels+", model_name="chat", model_attname="chat_id") objects = ChatReelManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = UserAuthorizer(['user', 'user_id'], ["GET"])
class CompanyProfileResource(Resource): class Meta: resource_name = "company_profiles" model_class = CompanyProfile methods = ["GET", "PUT"] bulk_methods = ["GET"] filtering = {"id": ["eq"], "tenant__id": ["eq"]} ordering = [] limit = 20 id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() size = EnumField(CompanySizeEnum, model_attname="size_id") name = fields.StringField(nullable=True) description = fields.StringField(nullable=True) location = fields.StringField(nullable=True) url = fields.StringField(nullable=True) tenant = fields.EncodedOneToOne(TenantResource, backref="company_profile", model_name="tenant", model_attname="tenant_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = TenantAuthorizer(['tenant', 'tenant_id'], ['GET'])
class ChatMessageResource(Resource): class Meta: resource_name = "chat_messages" model_class = Message methods = ["POST"] bulk_methods = ["GET"] limit = 100 #options as_of = Option(default=0, field=fields.FloatField()) chat_token = Option(field=fields.StringField()) #fields id = fields.StringField(primary_key=True, model_attname="header.id") header = fields.StructField(MessageHeaderStruct, MessageHeader) user_status_message = fields.StructField(UserStatusMessageStruct, UserStatusMessage, nullable=True, default=None, model_attname="userStatusMessage") chat_status_message = fields.StructField(ChatStatusMessageStruct, ChatStatusMessage, nullable=True, default=None, model_attname="chatStatusMessage") objects = ChatMessageManager(zk.zookeeper_client) authenticator = SessionAuthenticator() authorizer = ChatMessageAuthorizer()
class ApplicationVoteResource(Resource): class Meta: resource_name = "application_votes" model_class = JobApplicationVote methods = ["GET", "POST", "PUT"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "user_id": ["eq"], "tenant__id": ["eq"], "application_id": ["eq"], "application__id": ["eq"] } with_relations = [] id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() user_id = fields.EncodedField() application_id = fields.EncodedField() yes = fields.BooleanField(nullable=True) tenant = fields.EncodedForeignKey(TenantResource, backref="application_votes+") user = fields.EncodedForeignKey(UserResource, backref="application_votes+") application = fields.EncodedForeignKey(ApplicationResource, backref="application_votes") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = RequestMethodAuthorizer({ "GET": TenantAuthorizer(['tenant', 'tenant_id']), ("POST", "PUT", "DELETE"): TenantUserAuthorizer(['tenant', 'tenant_id'], ['user', 'user_id']) })
class TenantResource(Resource): class Meta: resource_name = "tenants" model_class = Tenant methods = ["GET"] related_methods = { "users": ["GET"], "applications": ["GET"], "requisitions": ["GET"], "job_notes": ["GET"], "job_offers": ["GET"], "interview_offers": ["GET"], "company_profile": ["GET"] } related_bulk_methods = { "users": ["GET"], "applications": ["GET"], "requisitions": ["GET"], "job_notes": ["GET"], "job_offers": ["GET"], "interview_offers": ["GET"] } filtering = {"id": ["eq"], "users__id": ["eq"]} with_relations = [r"^company_profile$"] ordering = [] limit = 20 id = fields.EncodedField(primary_key=True) name = fields.StringField() domain = fields.StringField(readonly=True) objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class TechnologySearchResource(Resource): class Meta: resource_name = "search" es_index = "technologies" es_doc = "technology" bulk_methods = ["GET"] filtering = {"q": ["eq"], "ac": ["eq"], "name": ["eq", "in"]} with_relations = ["^technology$"] ordering = [] limit = 20 #fields id = fields.IntegerField(primary_key=True) technology_id = fields.IntegerField(model_attname='id') name = fields.StringField() description = fields.StringField() type = fields.StringField() q = MultiMatchQueryField(es_fields=['name', 'description'], nullable=True) ac = MatchQueryField(es_field='name.autocomplete', nullable=True) #related fields technology = fields.ForeignKey(TechnologyResource, model_attname='id') #objects objects = ElasticSearchManager(es_client_pool) authenticator = SessionAuthenticator()
class LocationSearchResource(Resource): class Meta: resource_name = "search" es_index = "locations" es_doc = "location" bulk_methods = ["GET"] filtering = { "q": ["eq"], "ac": ["eq"], "region": ["eq", "in"] } with_relations = [ "^location$" ] ordering = [] limit = 20 #fields id = fields.IntegerField(primary_key=True) location_id = fields.IntegerField(model_attname='id') region = fields.StringField() q = MultiMatchQueryField(es_fields=['region'], nullable=True) ac = MatchQueryField(es_field='region.autocomplete', nullable=True) #related fields location = fields.ForeignKey(LocationResource, model_attname='id') #objects objects = ElasticSearchManager(es_client_pool) authenticator = SessionAuthenticator()
class PositionPreferenceResource(Resource): class Meta: resource_name = "position_prefs" model_class = JobPositionTypePref methods = ["GET", "POST", "PUT", "DELETE"] bulk_methods = ["GET"] related_methods = {"user": ["GET"]} filtering = {"id": ["eq"], "user__id": ["eq"]} with_relations = [] ordering = ["id"] limit = 20 id = fields.IntegerField(primary_key=True) user_id = fields.EncodedField() type = EnumField(PositionTypeEnum, model_attname="position_type_id") user = fields.EncodedForeignKey(UserResource, backref="position_prefs", model_name="user", model_attname="user_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = UserAuthorizer(['user_id'], ['GET'])
class ApplicationLogResource(Resource): class Meta: resource_name = "application_logs" model_class = JobApplicationLog methods = ["GET", "POST"] bulk_methods = ["GET"] filtering = {"id": ["eq"], "application__id": ["eq"]} with_relations = ["user"] ordering = ["created"] id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() user_id = fields.EncodedField() application_id = fields.EncodedField() note = fields.StringField(nullable=True) created = fields.DateTimeField(nullable=True, readonly=True) tenant = fields.EncodedForeignKey(TenantResource, backref="application_logs+") user = fields.EncodedForeignKey(UserResource, backref="application_logs+") application = fields.EncodedForeignKey(ApplicationResource, backref="application_logs") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = RequestMethodAuthorizer({ "GET": TenantAuthorizer(['tenant', 'tenant_id']), ("POST", "PUT", "DELETE"): TenantUserAuthorizer(['tenant', 'tenant_id'], ['user', 'user_id']) })
class TopicTagResource(Resource): class Meta: resource_name = "topic_tags" model_class = TopicTag methods = ["GET"] bulk_methods = ["GET"] related_methods = {"topic": ["GET"], "tag": ["GET"]} filtering = {"id": ["eq"]} with_relations = ["^topic$", "^tag$"] ordering = ["id"] limit = 20 id = fields.IntegerField(primary_key=True) topic_id = fields.EncodedField() tag_id = fields.IntegerField() topic = fields.EncodedForeignKey(TopicResource, backref="topic_tags", model_name="topic", model_attname="topic_id") tag = fields.EncodedForeignKey(TagResource, backref="topic_tags+", model_name="tag", model_attname="tag_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class ArchiveResource(Resource): class Meta: resource_name = "archives" model_class = ChatArchive methods = ["GET"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "public": ["eq"], "chat__id": ["eq"] } limit = 20 id = fields.IntegerField(primary_key=True, readonly=True) type = EnumField(ChatArchiveTypeEnum, model_attname="type_id", readonly=True) mime_type = EnumField(MimeTypeEnum, model_attname="mime_type_id", readonly=True) chat_id = fields.EncodedField(readonly=True) path = fields.StringField(readonly=True) url = CdnUrlField(cdn_url=CDN_URL, model_attname="path", readonly=True) ssl_url = CdnUrlField(cdn_url=CDN_SSL_URL, model_attname="path", readonly=True) streaming_url = CdnUrlField(cdn_url=CDN_STREAMING_URL, model_attname="path", readonly=True) public = fields.BooleanField(readonly=True) length = fields.IntegerField(nullable=True, readonly=True) offset = fields.IntegerField(nullable=True, readonly=True) waveform = fields.StringField(nullable=True, readonly=True) waveform_path = fields.StringField(nullable=True, readonly=True) waveform_url = CdnUrlField(cdn_url=CDN_URL, model_attname="waveform_path", nullable=True, readonly=True) chat = fields.EncodedForeignKey(ChatResource, backref="archives", model_name="chat", model_attname="chat_id") objects = ArchiveManager(db_session_factory) authenticator = SessionAuthenticator()
class SkillResource(Resource): class Meta: resource_name = "skills" model_class = Skill methods = ["GET", "POST", "PUT", "DELETE"] bulk_methods = ["GET"] related_methods = { "user": ["GET"], "technology": ["GET"] } filtering = { "id": ["eq"], "expertise": ["eq", "in"], "yrs_experience": ["eq", "lt", "lte", "gt", "gte", "ranges"], "user__id": ["eq"], "technology__id": ["eq"] } with_relations = ["user", "technology"] ordering = ["id"] limit = 20 id = fields.IntegerField(primary_key=True) yrs_experience = fields.IntegerField() user_id = fields.EncodedField() technology_id = fields.IntegerField() expertise = EnumField(ExpertiseTypeEnum, model_attname="expertise_type_id") user = fields.EncodedForeignKey(UserResource, backref="skills", model_name="user", model_attname="user_id") technology = fields.ForeignKey(TechnologyResource, backref="skills+", model_name="technology", model_attname="technology_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = UserAuthorizer(['user_id'], ['GET'])
class JobOfferResource(Resource): class Meta: resource_name = "job_offers" model_class = JobOffer methods = ["GET", "POST", "PUT"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "tenant__id": ["eq"], "candidate_id": ["eq"], "status": ["eq"] } with_relations = [] id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() candidate_id = fields.EncodedField() employee_id = fields.EncodedField() application_id = fields.EncodedField() status = EnumField(JobOfferStatusEnum, model_attname="status_id") salary = fields.IntegerField() tenant = fields.EncodedForeignKey(TenantResource, backref="job_offers") candidate = fields.EncodedForeignKey(UserResource, backref="job_offers") employee = fields.EncodedForeignKey(UserResource, backref="job_offers+") application = fields.ForeignKey(ApplicationResource, backref="job_offers") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = TenantAuthorizer(['tenant', 'tenant_id'])
class TechnologyPreferenceResource(Resource): class Meta: resource_name = "technology_prefs" model_class = JobTechnologyPref methods = ["GET", "PUT", "POST", "DELETE"] bulk_methods = ["GET"] filtering = {"id": ["eq"], "user__id": ["eq"]} with_relations = ['^technology$'] ordering = ["id"] limit = 20 id = fields.IntegerField(primary_key=True) user_id = fields.EncodedField() technology_id = fields.IntegerField() user = fields.EncodedForeignKey(UserResource, backref="technology_prefs", model_name="user", model_attname="user_id") technology = fields.ForeignKey(TechnologyResource, backref="technology_prefs+", model_name="technology", model_attname="technology_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = UserAuthorizer(['user_id'], ['GET'])
class ApplicationResource(Resource): class Meta: resource_name = "applications" model_class = JobApplication methods = ["GET", "POST", "PUT"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "tenant_id": ["eq"], "tenant__id": ["eq"], "user_id" : ["eq", "in"], "user__id": ["eq"], "created": ["eq", "range"], "status": ["eq", "in", "istartswith"], "requisition__status": ["eq", "in"], "requisition__title": ["eq", "in", "istartswith"] } related_methods = { "application_logs": ["GET"], "application_scores": ["GET"], "application_votes": ["GET"], "interview_offers": ["GET"] } related_bulk_methods = { "application_logs": ["GET"], "application_scores": ["GET"], "application_votes": ["GET"], "interview_offers": ["GET"] } with_relations = ['requisition'] ordering = [ "created", "status", "user_id", "requisition__status", "requisition__title", ] limit = 40 id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() user_id = fields.EncodedField() creator_id = fields.EncodedField() requisition_id = fields.EncodedField() created = fields.DateTimeField(nullable=True, readonly=True) type = EnumField(ApplicationTypeEnum, model_attname="type_id") status = EnumField(ApplicationStatusEnum, model_attname="status_id") created = fields.DateTimeField(nullable=True, readonly=True) tenant = fields.EncodedForeignKey(TenantResource, backref="applications") user = fields.EncodedForeignKey(UserResource, backref="applications") creator = fields.EncodedForeignKey(UserResource, backref="applications+") requisition = fields.EncodedForeignKey(RequisitionResource, backref="applications") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = DeveloperEmployerAuthorizer( developer_authorizer=ApplicationDeveloperAuthorizer(['user', 'user_id']), employer_authorizer=TenantAuthorizer(['tenant', 'tenant_id']))
class InterviewOfferResource(Resource): class Meta: resource_name = "interview_offers" model_class = JobInterviewOffer methods = ["GET", "PUT", "POST"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "tenant__id": ["eq"], "candidate_id": ["eq", "in"], "candidate__id": ["eq", "in"], "status": ["eq", "in"], "type": ["eq", "in"], "created": ["eq", "range"], "expires": ["eq", "range"], "application__id": ["eq"], "application__requisition__status": ["eq"], "application__requisition__title": ["eq", "in", "istartswith"] } with_relations = ['application', 'tenant'] ordering = [ "candidate_id", "created", "expires", "status", "type", "application__requisition__title" ] limit = 40 id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() candidate_id = fields.EncodedField() employee_id = fields.EncodedField() application_id = fields.EncodedField() type = EnumField(InterviewOfferTypeEnum, model_attname="type_id") status = EnumField(InterviewOfferStatusEnum, model_attname="status_id") expires = fields.DateTimeField() created = fields.DateTimeField(nullable=True, readonly=True) tenant = fields.EncodedForeignKey(TenantResource, backref="interview_offers") candidate = fields.EncodedForeignKey(UserResource, backref="interview_offers") employee = fields.EncodedForeignKey(UserResource, backref="interview_offers+") application = fields.EncodedForeignKey(ApplicationResource, backref="interview_offers") objects = InterviewOfferManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = DeveloperEmployerAuthorizer( developer_authorizer=InterviewOfferDeveloperAuthorizer( ['candidate', 'candidate_id']), employer_authorizer=TenantAuthorizer(['tenant', 'tenant_id']))
class TopicSearchResource(Resource): class Meta: resource_name = "search" es_index = "topics" es_doc = "topic" bulk_methods = ["GET"] filtering = { "q": ["eq"], "active": ["eq"], "duration": ["eq", "in", "range", "ranges"], "tags__name": ["eq", "in"] } with_relations = ["^topic$"] ordering = ["title"] limit = 20 #options f_tags_size = Option(default=10, field=fields.IntegerField()) #fields id = fields.EncodedField(primary_key=True) topic_id = fields.EncodedField(model_attname='id') type = fields.StringField() #type = EnumField(TopicTypeEnum, model_attname="type_id") title = fields.StringField(sort_ext=".raw") description = fields.StringField() tree = fields.ListField(field=fields.StructField(TopicStruct, dict)) tags = fields.ListField(field=fields.StructField(TagStruct, dict)) duration = fields.IntegerField() active = fields.BooleanField() q = MultiMatchQueryField(es_fields=[ 'title^6', 'description^3', 'tags.name^2', 'subtopic_summary^1' ], nullable=True) #related fields topic = fields.EncodedForeignKey(TopicResource, backref="searches+") #facets f_duration = RangeFacet(title="Duration", field="duration").\ add(0, 301, name="under 5 mins").\ add(302, 601, name="5 to 10 mins").\ add(602, 3600, name="10+ mins") f_tags = TermsFacet(title="Tags", field="tags__name", es_field="tags.name.raw", size_option="f_tags_size") #objects objects = TopicSearchManager(es_client_pool) authenticator = SessionAuthenticator()
class RequisitionResource(Resource): class Meta: resource_name = "requisitions" model_class = JobRequisition methods = ["GET", "POST", "PUT", "DELETE"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "tenant__id": ["eq"], "tenant_id": ["eq"], "status": ["eq"], "title": ["eq", "istartswith"], "deleted": ["eq"] } related_methods = {"requisition_technologies": ["GET"]} related_bulk_methods = {"requisition_technologies": ["GET"]} with_relations = [r"^requisition_technologies(__technology)?$"] ordering = [ "created", "employer_requisition_identifier", "title", "status" ] limit = 40 id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() user_id = fields.EncodedField() location = EnumField(LocationEnum, model_attname="location_id") created = fields.DateTimeField(nullable=True, readonly=True) status = EnumField(RequisitionStatusEnum, model_attname="status_id") position_type = EnumField(PositionTypeEnum, model_attname="position_type_id") title = fields.StringField() description = fields.StringField() salary = fields.StringField() telecommute = fields.BooleanField() relocation = fields.BooleanField() equity = fields.StringField(nullable=True) employer_requisition_identifier = fields.StringField(nullable=True) deleted = fields.BooleanField(hidden=True) tenant = fields.EncodedForeignKey(TenantResource, backref="requisitions") user = fields.EncodedForeignKey(UserResource, backref="requisitions") technologies = fields.ManyToMany(TechnologyResource, through=JobRequisitionTechnology, backref="requisitions+") objects = AlchemyResourceManager(db_session_factory) # TODO objects = RequisitionManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = TenantAuthorizer(['tenant', 'tenant_id'], ['GET'])
class TagResource(Resource): class Meta: resource_name = "tags" model_class = Tag methods = ["GET"] bulk_methods = ["GET"] filtering = {"id": ["eq"], r"topics\+__id": ["eq"]} ordering = ["id"] limit = 20 id = fields.IntegerField(primary_key=True) name = fields.StringField() objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class ChatResource(Resource): class Meta: resource_name = "chats" model_class = Chat methods = ["GET", "POST"] bulk_methods = ["GET"] related_methods = { "topic": ["GET"], "users": ["GET"], "chat_credential": ["POST"], "archives": ["GET"], "chat_participants": ["GET"], } related_bulk_methods = { "users": ["GET"], "chat_participants": ["GET"], "archives": ["GET"], } filtering = { "id": ["eq"], "start": ["eq", "lt", "lte", "gt", "gte"], "end": ["eq", "lt", "lte", "gt", "gte"], "users__id": ["eq"], "topic__id": ["eq"], "topic__title": ["eq", "in", "istartswith"], } with_relations = [ r"^archives$", r"^topic?(__tree)?$", r"^users$", r"^chat_participants$" ] ordering = ["id", "start"] id = fields.EncodedField(primary_key=True) topic_id = fields.EncodedField() start = fields.DateTimeField(nullable=True) end = fields.DateTimeField(nullable=True) max_duration = fields.IntegerField() max_participants = fields.IntegerField() no_participants = fields.IntegerField(nullable=True, readonly=True) topic = fields.EncodedForeignKey(TopicResource, backref="chats") users = fields.ManyToMany(UserResource, through=ChatParticipant, backref="chats") objects = ChatManager(db_session_factory) authenticator = SessionAuthenticator()
class TechnologyResource(Resource): class Meta: resource_name = "technologies" model_class = Technology methods = ["GET"] bulk_methods = ["GET"] related_methods = {"users": ["GET"]} related_bulk_methods = {"users": ["GET"]} filtering = {"id": ["eq"], "type": ["eq"], "users__id": ["eq"]} limit = 20 id = fields.IntegerField(primary_key=True) name = fields.StringField() description = fields.StringField() type = EnumField(TechnologyTypeEnum, attname='id', model_attname="type_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class SpeakingMarkerResource(Resource): class Meta: resource_name = "speaking_markers" model_class = ChatSpeakingMarker alchemy_query_options = [joinedload(ChatSpeakingMarker.chat_minute)] methods = ["GET"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "public": ["eq"], "chat_minute__id": ["eq"], "chat_session__id": ["eq"] } ordering = ["id", "start"] limit = 20 id = fields.IntegerField(primary_key=True) user_id = fields.EncodedField() chat_minute_id = fields.IntegerField() chat_session_id = fields.EncodedField( model_attname='chat_minute.chat_session_id', readonly=True) start = fields.DateTimeField() end = fields.DateTimeField() user = fields.ForeignKey(UserResource, backref="speaking_markers+", model_name="user", model_attname="user_id") chat_minute = fields.ForeignKey(ChatMinuteResource, backref="speaking_markers", model_name="chat_minute", model_attname="chat_minute_id") chat_session = fields.EncodedForeignKey( ChatSessionResource, through="chat_minute", backref="speaking_markers", model_name="chat_minute.chat_session", model_attname="chat_minute.chat_session_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class JobEventResource(Resource): class Meta: resource_name = "job_events" model_class = JobEvent methods = ["GET"] bulk_methods = ["GET"] filtering = {"id": ["eq"]} with_relations = [] id = fields.EncodedField(primary_key=True) start = fields.DateTimeField() end = fields.DateTimeField() description = fields.StringField() candidates = fields.ManyToMany(UserResource, through=JobEventCandidate, backref="job_events+") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class EmployerProfileResource(Resource): class Meta: resource_name = "employer_profiles" model_class = EmployerProfile methods = ["GET", "PUT"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "user__id": ["eq"] } ordering = [] limit = 20 id = fields.EncodedField(primary_key=True) user_id = fields.EncodedField() user = fields.EncodedOneToOne(UserResource, backref="employer_profile", model_name="user", model_attname="user_id") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = UserAuthorizer(['user', 'user_id'], ['GET'])
class JobNoteResource(Resource): class Meta: resource_name = "job_notes" model_class = JobNote methods = ["GET", "POST", "PUT"] bulk_methods = ["GET"] filtering = { "id": ["eq"], "tenant_id": ["eq"], "tenant__id": ["eq"], "employee_id": ["eq"], "employee__id": ["eq"], "candidate_id": ["eq"], "candidate__id": ["eq"] } related_methods = { } with_relations = ['candidate'] id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField() employee_id = fields.EncodedField() candidate_id = fields.EncodedField() note = fields.StringField() modified = fields.DateTimeField(nullable=True, readonly=True) tenant = fields.EncodedForeignKey(TenantResource, backref="job_notes") employee = fields.EncodedForeignKey(UserResource, backref="job_notes") candidate = fields.EncodedForeignKey(UserResource, backref="candidate_job_notes+") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = RequestMethodAuthorizer({ "GET": TenantAuthorizer(['tenant', 'tenant_id']), ("POST", "PUT", "DELETE"): TenantUserAuthorizer( ['tenant', 'tenant_id'], ['employee', 'employee_id']) })
class SpotlightChatResource(Resource): class Meta: resource_name = "spotlight_chats" model_class = SpotlightChat methods = ["GET"] bulk_methods = ["GET"] related_methods = {"chat": ["GET"]} filtering = {"id": ["eq"], "chat__id": ["eq"]} with_relations = ["chat__topic"] ordering = ["id", "rank"] limit = 20 id = fields.IntegerField(primary_key=True) chat_id = fields.EncodedField() rank = fields.IntegerField() chat = fields.EncodedForeignKey(ChatResource, backref="spotlight_chats+", model_name="chat", model_attname="chat_id") objects = SpotlightChatManager(db_session_factory) authenticator = SessionAuthenticator()
class RequisitionTechnologyResource(Resource): class Meta: resource_name = "requisition_technologies" model_class = JobRequisitionTechnology methods = ["GET", "POST", "PUT", "DELETE"] bulk_methods = ["GET"] related_methods = {"technology": ["GET"]} filtering = {"id": ["eq"], "requisition__id": ["eq"]} with_relations = [r"^technology$"] id = fields.IntegerField(primary_key=True) requisition_id = fields.EncodedField() technology_id = fields.IntegerField() yrs_experience = fields.IntegerField() expertise = EnumField(ExpertiseTypeEnum, model_attname="expertise_type_id") requisition = fields.EncodedForeignKey(RequisitionResource, backref="requisition_technologies") technology = fields.ForeignKey(TechnologyResource, backref="requisition_technologies+") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = TenantAuthorizer('requisition__tenant', ['GET'])
class LocationResource(Resource): class Meta: resource_name = "locations" model_class = Location methods = ["GET"] bulk_methods = ["GET"] filtering = { "id": ["eq"], r"users\+__id": ["eq"], "region": ["eq", "in"] } limit = 20 ordering = ["region"] id = fields.IntegerField(primary_key=True) region = fields.StringField() country = fields.StringField() state = fields.StringField() city = fields.StringField() county = fields.StringField() zip = fields.StringField() objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator()
class UserResource(Resource): class Meta: resource_name = "users" model_class = User methods = ["GET", "PUT"] bulk_methods = ["GET"] related_methods = { "tenant": ["GET"], "developer_profile": ["GET"], "employer_profile": ["GET"], "chats": ["GET"], "chat_reels": ["GET"], "skills": ["GET"], "locations": ["GET"], "location_prefs": ["GET"], "technologies": ["GET"], "technology_prefs": ["GET"], "position_prefs": ["GET"], "applications": ["GET"], "job_notes": ["GET"], "interview_offers": ["GET"] } related_bulk_methods = { "chats": ["GET"], "chat_reels": ["GET"], "skills": ["GET"], "locations": ["GET"], "location_prefs": ["GET"], "technologies": ["GET"], "technology_prefs": ["GET"], "position_prefs": ["GET"], "applications": ["GET"], "job_notes": ["GET"], "interview_offers": ["GET"] } filtering = { "id": ["eq", "in"], "tenant_id": ["eq"], "tenant__id": ["eq"], "technology_prefs__id": ["eq"], "chats__id": ["eq"], "position_prefs__id": ["eq"] } with_relations = [ r"^tenant$", r"^developer_profile$", r"^employer_profile$", r"^chats(__topic)?$", r"^chat_reels(__chat(__topic)?)?$", r"^locations$", r"^location_prefs(__location)?$", r"^skills(__technology)?$", r"^technologies$", r"^technology_prefs(__technology)?$", r"^position_prefs$" ] ordering = [] limit = 20 #fields id = fields.EncodedField(primary_key=True) tenant_id = fields.EncodedField(primary_key=True) first_name = fields.StringField() last_name = fields.StringField() email = fields.StringField(readonly=True) tenant = fields.EncodedForeignKey(TenantResource, backref="users") locations = fields.ManyToMany(LocationResource, through=JobLocationPref, backref="users+") technologies = fields.ManyToMany(TechnologyResource, through=JobTechnologyPref, backref="users") objects = AlchemyResourceManager(db_session_factory) authenticator = SessionAuthenticator() authorizer = UserAuthorizer(['id'], ['GET']) sanitizer = UserSanitizer()