controller

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 26 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 CreateOrUpdateOnMatchHookRequestData added in v1.0.7

type CreateOrUpdateOnMatchHookRequestData struct {
	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 DataSendToHook added in v1.0.6

type DataSendToHook 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"`
}

DataSendToHook contains the content for processing a match

type ExplainDataSendToHook added in v1.0.6

type ExplainDataSendToHook struct {
	DataSendToHook DataSendToHook `json:"dataSendToHook"`
}

ExplainDataSendToHook tells what data is send to the hook

type GetStatusResponse

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

GetStatusResponse contains the response data for the getStatus route

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 {
	Debug           bool
	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 RouteScraperScanCVBody

type RouteScraperScanCVBody struct {
	CV    models.CV `json:"cv"`
	Debug bool      `json:"debug" jsonSchema:"hidden"`
}

RouteScraperScanCVBody is the request body of the routeScraperScanCV

type RouteScraperScanCVRes

type RouteScraperScanCVRes struct {
	Success    bool               `json:"success"`
	HasMatches bool               `json:"hasMatches"`
	Matches    []match.FoundMatch `json:"matches" jsonSchema:"hidden" description:"Only contains matches if the debug property is set to true"`
}

RouteScraperScanCVRes contains the response data of routeScraperScanCV

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"`

	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