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 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 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 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 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 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 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 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 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 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 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()