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 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 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 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 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 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'])