Exemple #1
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()
Exemple #2
0
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"])
Exemple #3
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()
Exemple #4
0
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'])
Exemple #5
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()
Exemple #6
0
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()
Exemple #7
0
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'])
Exemple #8
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()
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()
Exemple #10
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()
Exemple #11
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"])
Exemple #12
0
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'])
Exemple #13
0
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'])
Exemple #14
0
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()
Exemple #15
0
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()
Exemple #16
0
class ApplicationScoreResource(Resource):
    class Meta:
        resource_name = "application_scores"
        model_class = JobApplicationScore
        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()
    technical_score = fields.IntegerField()
    communication_score = fields.IntegerField()
    cultural_fit_score = fields.IntegerField()

    tenant = fields.EncodedForeignKey(TenantResource,
                                      backref="application_scores+")
    user = fields.EncodedForeignKey(UserResource,
                                    backref="application_scores+")
    application = fields.EncodedForeignKey(ApplicationResource,
                                           backref="application_scores")

    objects = AlchemyResourceManager(db_session_factory)
    authenticator = SessionAuthenticator()
    authorizer = RequestMethodAuthorizer({
        "GET":
        TenantAuthorizer(['tenant', 'tenant_id']),
        ("POST", "PUT", "DELETE"):
        TenantUserAuthorizer(['tenant', 'tenant_id'], ['user', 'user_id'])
    })
Exemple #17
0
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()
Exemple #18
0
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'])
Exemple #19
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()
Exemple #20
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()
Exemple #21
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()
Exemple #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()
Exemple #23
0
class LocationPref(Struct):
    id = fields.IntegerField()
    location_id = fields.IntegerField()
    region = fields.StringField(filter_ext=".raw")
Exemple #24
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)
Exemple #25
0
class TechnologyPref(Struct):
    id = fields.IntegerField()
    technology_id = fields.IntegerField()
    name = fields.StringField(filter_ext=".raw")
Exemple #26
0
class TagStruct(Struct):
    id = fields.IntegerField()
    name = fields.StringField(filter_ext=".raw")
Exemple #27
0
class Chat(Struct):
    id = fields.EncodedField()
    topic_id = fields.IntegerField()
    topic_title = fields.StringField(filter_ext=".raw")
Exemple #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()
Exemple #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)
Exemple #30
0
class Error(Struct):
    code = fields.IntegerField()
    message = fields.StringField()
    developerMessage = fields.StringField(nullable=True)