Example #1
0
class MessageHeaderStruct(Struct):
    id = fields.StringField(nullable=True)
    type = fields.EnumField(MessageType._NAMES_TO_VALUES)
    chat_token = fields.StringField(model_attname="chatToken")
    user_id = fields.EncodedField(model_attname="userId")
    timestamp = fields.TimestampField(nullable=True)
    skew = fields.TimestampField(readonly=True, nullable=True)
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()
Example #3
0
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'])
Example #4
0
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()
Example #5
0
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()
Example #6
0
class Skill(Struct):
    id = fields.IntegerField()
    technology_id = fields.IntegerField()
    expertise_type_id = fields.IntegerField()
    name = fields.StringField(filter_ext=".raw")
    expertise_type = fields.StringField()
    yrs_experience = fields.IntegerField()
Example #7
0
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()
Example #8
0
class TopicStruct(Struct):
    id = fields.IntegerField()
    type_id = fields.IntegerField()
    type = fields.StringField()
    duration = fields.IntegerField()
    title = fields.StringField()
    description = fields.StringField()
    recommended_participants = fields.IntegerField()
    rank = fields.IntegerField()
    public = fields.BooleanField()
    active = fields.BooleanField()
    level = fields.IntegerField()
Example #9
0
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()
Example #10
0
class TopicResource(Resource):
    class Meta:
        resource_name = "topics"
        model_class = Topic
        methods = ["GET"]
        bulk_methods = ["GET"]
        related_methods = {
            "children": ["GET"],
            "talking_points": ["GET"],
            "tags": ["GET"],
        }
        related_bulk_methods = {
            "talking_points": ["GET"],
            "chats": ["GET"],
            "tags": ["GET"],
        }
        filtering = {
            "id": ["eq"],
            "parent_id": ["eq"],
            "children": ["eq"],
            "parent": ["eq"],
            "title": ["eq", "istartswith"],
        }
        with_relations = [
            r"^tree$", r"^children$", r"^talking_points$", r"^tags$"
        ]
        ordering = ["id"]
        limit = 20

    id = fields.EncodedField(primary_key=True)
    parent_id = fields.EncodedField(nullable=True)
    type = EnumField(TopicTypeEnum, model_attname="type_id")
    title = fields.StringField()
    description = fields.StringField()
    duration = fields.IntegerField()
    tree = TopicTreeField("self")
    rank = fields.IntegerField()
    level = fields.IntegerField(nullable=True)
    user_id = fields.EncodedField()
    public = fields.BooleanField()
    recommended_participants = fields.IntegerField()

    parent = fields.EncodedForeignKey("self",
                                      backref="children",
                                      nullable=True)
    user = fields.EncodedForeignKey(UserResource, backref="topics+")
    tags = fields.ManyToMany(TagResource, through=TopicTag, backref="topics+")

    objects = TopicManager(db_session_factory)
    authorizer = UserAuthorizer(['user', 'user_id'], ["GET"])
Example #11
0
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'])
Example #12
0
class ChatCredentialResource(Resource):
    class Meta:
        resource_name = "chat_credentials"
        model_class = dict
        methods = ["POST"]
        filtering = {"id": ["eq"]}

    id = fields.StringField(primary_key=True)
    chat_id = fields.EncodedField()
    token = fields.StringField(readonly=True, nullable=True)
    twilio_capability = fields.StringField(readonly=True, nullable=True)

    chat = fields.EncodedForeignKey(ChatResource, backref="chat_credentials")

    objects = ChatCredentialManager(db_session_factory)
    authorizer = ChatCredentialAuthorizer(db_session_factory)
Example #13
0
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()
Example #14
0
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()
Example #15
0
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'])
    })
Example #16
0
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()
Example #17
0
class ChatTokenResource(Resource):
    class Meta:
        resource_name = "chat_tokens"
        methods = ["GET"]
        filtering = {"id": ["eq"]}

    id = fields.EncodedField(primary_key=True)
    token = fields.StringField()

    objects = ChatTokenManager(db_session_factory)
    authorizer = ChatTokenAuthorizer(db_session_factory)
Example #18
0
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()
Example #19
0
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()
Example #20
0
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'])
    })
Example #21
0
class DeveloperProfileResource(Resource):
    class Meta:
        resource_name = "developer_profiles"
        model_class = DeveloperProfile
        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()
    location = fields.StringField(nullable=True)
    actively_seeking = fields.BooleanField()

    user = fields.EncodedOneToOne(UserResource,
                                  backref="developer_profile",
                                  model_name="user",
                                  model_attname="user_id")

    objects = AlchemyResourceManager(db_session_factory)
    authenticator = SessionAuthenticator()
    authorizer = UserAuthorizer(['user', 'user_id'], ['GET'])
Example #22
0
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()
Example #23
0
class TagStruct(Struct):
    id = fields.IntegerField()
    name = fields.StringField(filter_ext=".raw")
Example #24
0
class LocationPref(Struct):
    id = fields.IntegerField()
    location_id = fields.IntegerField()
    region = fields.StringField(filter_ext=".raw")
Example #25
0
class PositionPref(Struct):
    id = fields.IntegerField()
    type_id = fields.IntegerField()
    type = fields.StringField(filter_ext=".raw")
    salary_start = fields.IntegerField(nullable=True)
    salary_end = fields.IntegerField(nullable=True)
Example #26
0
class TechnologyPref(Struct):
    id = fields.IntegerField()
    technology_id = fields.IntegerField()
    name = fields.StringField(filter_ext=".raw")
Example #27
0
class Chat(Struct):
    id = fields.EncodedField()
    topic_id = fields.IntegerField()
    topic_title = fields.StringField(filter_ext=".raw")
Example #28
0
class UserSearchResource(Resource):
    class Meta:
        resource_name = "search"
        es_index = "users"
        es_doc = "user"
        bulk_methods = ["GET"]
        filtering = {
            "q": ["eq"],
            "yrs_experience": ["eq", "in", "range", "ranges"],
            "joined": ["eq", "in", "range", "ranges"],
            "skills__name": ["eq", "in"],
            "chats__topic_title": ["eq", "in"],
            "location_prefs__region": ["eq", "in"],
            "position_prefs__type": ["eq", "in"],
            "technology_prefs__name": ["eq", "in"],
            "demo": ["eq"]
        }
        with_relations = ["^user(__skills)?$"]
        ordering = []
        limit = 20

    #options
    f_skills_size = Option(default=10, field=fields.IntegerField())
    f_chats_size = Option(default=10, field=fields.IntegerField())
    f_location_prefs_size = Option(default=10, field=fields.IntegerField())
    f_position_prefs_size = Option(default=10, field=fields.IntegerField())
    f_technology_prefs_size = Option(default=10, field=fields.IntegerField())

    #fields
    id = fields.EncodedField(primary_key=True)
    user_id = fields.EncodedField(model_attname="id")
    yrs_experience = fields.IntegerField()
    joined = fields.DateTimeField()
    location = fields.StringField(nullable=True)
    actively_seeking = fields.BooleanField()
    skills = fields.ListField(field=fields.StructField(Skill, dict))
    location_prefs = fields.ListField(
        field=fields.StructField(LocationPref, dict))
    position_prefs = fields.ListField(
        field=fields.StructField(PositionPref, dict))
    technology_prefs = fields.ListField(
        field=fields.StructField(TechnologyPref, dict))
    chats = fields.ListField(field=fields.StructField(Chat, dict))
    q = CustomScoreMultiMatchQueryField(
        es_score_field='score',
        es_fields=['skills.name', 'location_prefs.region'],
        nullable=True)
    demo = fields.BooleanField()

    #related fields
    user = fields.EncodedForeignKey(UserResource, backref="searches+")

    #facets
    f_skills = TermsFacet(title="Skills",
                          field="skills__name",
                          es_field="skills.name.raw",
                          size_option="f_skills_size")
    f_chats = TermsFacet(title="Chats",
                         field="chats__topic_title",
                         es_field="chats.topic_title.raw",
                         size_option="f_chats_size")
    f_location_prefs = TermsFacet(title="Location Preferences",
                                  field="location_prefs__region",
                                  es_field="location_prefs.region.raw",
                                  size_option="f_location_prefs_size")
    f_position_prefs = TermsFacet(title="Position Preferences",
                                  field="position_prefs__type",
                                  es_field="position_prefs.type.raw",
                                  size_option="f_position_prefs_size")
    f_technology_prefs = TermsFacet(title="Technology Preferences",
                                    field="technology_prefs__name",
                                    es_field="technology_prefs.name.raw",
                                    size_option="f_technology_prefs_size")
    f_yrs_experience = RangeFacet(title="Years Experience",
            field="yrs_experience")\
            .add(0,2).add(3,5).add(6, 10).add(11, 100, name="10+")
    f_joined = DateRangeFacet(title="Joined", field="joined")\
            .add("now-7d", "now", name="Last 7 days")\
            .add("now-30d", "now", name="Last 30 days")\
            .add("now-3M", "now", name="Last 3 months")\
            .add("now-12M", "now", name="Last year")

    #objects
    objects = UserSearchManager(es_client_pool)
    authenticator = SessionAuthenticator()
Example #29
0
class UserStatusMessageStruct(Struct):
    user_id = fields.EncodedField(model_attname="userId")
    status = fields.EnumField(UserStatus._NAMES_TO_VALUES)
    first_name = fields.StringField(nullable=True, model_attname="firstName")
    participant = fields.IntegerField(nullable=True)
Example #30
0
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()