controller

package
v1.0.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MatchesProcess = &MatchesProcessor{
	list:    []ProcessMatches{},
	c:       sync.NewCond(&sync.Mutex{}),
	started: false,
}

MatchesProcess holts the process matches that should be processed in the background

Functions

func ErrorRes

func ErrorRes(c *fiber.Ctx, status int, err error) error

ErrorRes returns the error response

func FiberErrorHandler

func FiberErrorHandler(c *fiber.Ctx, err error) error

FiberErrorHandler handles errors in fiber In our case that means we change the errors from text to json

func InsertData

func InsertData(dbConn db.Connection) fiber.Handler

InsertData adds the profiles to every route

func Routes

func Routes(app *fiber.App, appVersion string, testing bool)

Routes defines the routes used

Types

type CVListsHookData added in v1.0.19

type CVListsHookData struct {
	CVs              map[string]models.CV            `json:"cvs" description:"The CVs that where matched with a profile. The key is the reference number of the cv"`
	ProfilesMatchCVs map[primitive.ObjectID][]string `` /* 139-byte string literal not displayed */
	KeyID            primitive.ObjectID              `json:"keyId" description:"The ID of the API key that was used to upload this CV"`
	KeyName          string                          `json:"keyName" description:"The Name of the API key that was used to upload this CV"`
	IsTest           bool                            `json:"isTest" description:"True if this hook call was manually triggered"`
}

CVListsHookData contains the data that is passed to the hook

type CreateOrUpdateOnMatchHookRequestData added in v1.0.7

type CreateOrUpdateOnMatchHookRequestData struct {
	Disabled   *bool           `json:"disabled"`
	Method     *string         `json:"method"`
	URL        *string         `json:"url"`
	AddHeaders []models.Header `json:"addHeaders"`
}

CreateOrUpdateOnMatchHookRequestData contains the post data for creating and modifiying a OnMatchHook

type GetStatusResponse

type GetStatusResponse struct {
	Status     bool   `json:"status"`
	AppVersion string `json:"appVersion"`
}

GetStatusResponse contains the response data for the getStatus route

type HookMatchedCVData added in v1.0.19

type HookMatchedCVData struct {
	MatchedProfiles []match.FoundMatch `json:"matchedProfiles"`
	CV              models.CV          `json:"cv"`
	KeyID           primitive.ObjectID `json:"keyId" description:"The ID of the API key that was used to upload this CV"`
	KeyName         string             `json:"keyName" description:"The Name of the API key that was used to upload this CV"`
	IsTest          bool               `json:"isTest" description:"True if this hook call was manually triggered"`
}

HookMatchedCVData contains the content for processing a match

type IMap

type IMap map[string]any

IMap is a wrapper around map[string]any that's faster to use

type MatchesProcessor

type MatchesProcessor struct {
	// contains filtered or unexported fields
}

MatchesProcessor is a struct that contains a list of matches to be processed in the background

To register a match to be processed call (*MatchesProcessor).AppendMatchesToProcess After calling the above (*MatchesProcessor).processMatches should automatically pick up the match and handle it

func (*MatchesProcessor) AppendMatchesToProcess

func (p *MatchesProcessor) AppendMatchesToProcess(args ProcessMatches)

AppendMatchesToProcess adds a list of matches to be processed by (*MatchesProcessor).processMatches

type PatchScraperUserBody added in v1.0.17

type PatchScraperUserBody struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

PatchScraperUserBody is the body of the routePatchScraperUser route

type ProcessMatches

type ProcessMatches struct {
	MatchedProfiles []match.FoundMatch
	CV              models.CV
	Logger          log.Entry
	DBConn          db.Connection
	KeyID           primitive.ObjectID
	KeyName         string
}

ProcessMatches contains the content for processing a match

func (ProcessMatches) Process

func (args ProcessMatches) Process()

Process processes the matches made to a CV - notify the dashboard /events page about the new match - safe the matches of this reference number for analytics and for detecting duplicates - send emails with the matches or send http requests

type RouteDeleteMatcherBranchResult added in v1.0.11

type RouteDeleteMatcherBranchResult struct {
	UpdatedParents  int `json:"updatedParent"`
	DeletedBranches int `json:"deletedBranches"`
}

RouteDeleteMatcherBranchResult gives some information about the removal process

type RouteDeleteScraperUserBody added in v1.0.13

type RouteDeleteScraperUserBody struct {
	Username string `json:"username"`
}

RouteDeleteScraperUserBody is the body of the routeDeleteScraperUser

type RouteGetProfilesCountRes

type RouteGetProfilesCountRes struct {
	// Total is the total number of profiles
	Total uint64 `json:"total"`
	// Usable is the number of profiles that can be used for matching
	Usable uint64 `json:"usable"`
}

RouteGetProfilesCountRes is the response for routeGetProfilesCount

type RouteScraperListCVsReq added in v1.0.19

type RouteScraperListCVsReq struct {
	CVs []models.CV `json:"cvs"`
}

RouteScraperListCVsReq contains the request data of routeScraperListCVs

type RouteScraperListCVsResp added in v1.0.19

type RouteScraperListCVsResp struct{}

RouteScraperListCVsResp is the response of routeScraperListCVs

type RouteScraperScanCVBody

type RouteScraperScanCVBody struct {
	CV models.CV `json:"cv"`
}

RouteScraperScanCVBody is the request body of the routeScraperScanCV

type RouteScraperScanCVRes

type RouteScraperScanCVRes struct {
	Success    bool `json:"success"`
	HasMatches bool `json:"hasMatches"`
}

RouteScraperScanCVRes contains the response data of routeScraperScanCV

type RouteTestOnListHookExplainSendToHook added in v1.0.19

type RouteTestOnListHookExplainSendToHook struct {
	DataSendToHook    CVListsHookData `json:"dataSendToHook"`
	HeadersSendToHook http.Header     `json:"headers"`
}

RouteTestOnListHookExplainSendToHook explains what is send to the hook

type RouteTestOnMatchHookExplainSendToHook added in v1.0.19

type RouteTestOnMatchHookExplainSendToHook struct {
	DataSendToHook    HookMatchedCVData `json:"dataSendToHook"`
	HeadersSendToHook http.Header       `json:"headers"`
}

RouteTestOnMatchHookExplainSendToHook explains what is send to the hook

type SetPublicKeyForScraperUsersBody added in v1.0.17

type SetPublicKeyForScraperUsersBody struct {
	PublicKey string `json:"publicKey"`
}

SetPublicKeyForScraperUsersBody is the request body for routeSetPublicKeyForScraperUsers

type UpdateProfileReq

type UpdateProfileReq struct {
	Name            *string  `json:"name"`
	Active          *bool    `json:"active"`
	AllowedScrapers []string `` /* 183-byte string literal not displayed */

	MustDesiredProfession *bool                      `json:"mustDesiredProfession"`
	DesiredProfessions    []models.ProfileProfession `json:"desiredProfessions"`

	YearsSinceWork *int `json:"yearsSinceWork"`

	MustExpProfession     *bool                      `json:"mustExpProfession"`
	ProfessionExperienced []models.ProfileProfession `json:"professionExperienced"`

	MustDriversLicense *bool                          `json:"mustDriversLicense"`
	DriversLicenses    []models.ProfileDriversLicense `json:"driversLicenses"`

	MustEducationFinished *bool                     `json:"mustEducationFinished"`
	MustEducation         *bool                     `json:"mustEducation"`
	YearsSinceEducation   *int                      `json:"yearsSinceEducation"`
	Educations            []models.ProfileEducation `json:"educations"`

	Zipcodes []models.ProfileDutchZipcode `json:"zipCodes"`

	ListsAllowed *bool `json:"listsAllowed"`

	Lables map[string]any `` /* 152-byte string literal not displayed */

	OnMatch *models.ProfileOnMatch `json:"onMatch"`
}

UpdateProfileReq are all the fields that can be updated in a profile All the top level fields are optional and if null should not be updated

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL