Documentation ¶
Index ¶
- Variables
- func CheckAPIKeysExists(conn db.Connection, apiKeys []primitive.ObjectID) error
- func CheckDashboardKeyExists(conn db.Connection)
- func GetActualMatchActiveProfilesCount(conn db.Connection) (uint64, error)
- func GetProfilesCount(conn db.Connection) (uint64, error)
- func LastBackupTime(dbConn db.Connection) (time.Time, error)
- func NeedToCreateBackup(dbConn db.Connection) (bool, error)
- func SetLastBackupToNow(dbConn db.Connection) error
- type APIKey
- type APIKeyInfo
- type APIKeyRole
- type APIRole
- type Backup
- type CV
- type Competence
- type DataKind
- type Education
- type Educations
- type GetOnMatchHooksProps
- type Header
- type Interest
- type Language
- type LanguageLevel
- type Match
- type OnMatchHook
- func (h *OnMatchHook) Call(body io.Reader, dataKind DataKind, reqID string) (http.Header, error)
- func (h *OnMatchHook) CallAndLogResult(body io.Reader, dataKind DataKind, logger *log.Entry)
- func (h *OnMatchHook) CallWithRetry(body io.Reader, dataKind DataKind) (http.Header, error)
- func (*OnMatchHook) CollectionName() string
- type PersonalDetails
- type Profile
- type ProfileDriversLicense
- type ProfileDutchZipcode
- type ProfileEducation
- type ProfileOnMatch
- type ProfileProfession
- type ProfileSendEmailData
- type ScraperLoginUser
- type ScraperLoginUsers
- type StatusCodeError
- type WorkExperience
- type WorkExperiences
Constants ¶
This section is empty.
Variables ¶
var ( // APIKeyRoleAll contains all of the above roles and thus can access everything APIKeyRoleAll = APIKeyRoleScraper | APIKeyRoleInformationObtainer | APIKeyRoleController | APIKeyRoleDashboard | APIKeyRoleAdmin // APIKeyRoleAllArray is an array of all roles APIKeyRoleAllArray = []APIKeyRole{ APIKeyRoleScraper, APIKeyRoleInformationObtainer, APIKeyRoleController, APIKeyRoleDashboard, APIKeyRoleAdmin, } )
var ErrScraperNoPublicKey = errors.New("this scraper has no public key yet, add a public key to the scraper to store passwords")
ErrScraperNoPublicKey is used when you want to add a user to a scraper but the scraper has no public key yet used to encrypt the password
Functions ¶
func CheckAPIKeysExists ¶
func CheckAPIKeysExists(conn db.Connection, apiKeys []primitive.ObjectID) error
CheckAPIKeysExists checks if apiKeys are valid IDs of existing keys
func CheckDashboardKeyExists ¶
func CheckDashboardKeyExists(conn db.Connection)
CheckDashboardKeyExists checks weather the required system keys are available and if not creates them
func GetActualMatchActiveProfilesCount ¶ added in v1.0.23
func GetActualMatchActiveProfilesCount(conn db.Connection) (uint64, error)
GetActualMatchActiveProfilesCount does the same as GetActualMatchActiveProfiles but only returns the number of found profiles
func GetProfilesCount ¶
func GetProfilesCount(conn db.Connection) (uint64, error)
GetProfilesCount returns the amount of profiles in the database
func LastBackupTime ¶
func LastBackupTime(dbConn db.Connection) (time.Time, error)
LastBackupTime returns the last time of a created backup a zero time is returned when there is no backup found a zero time can be detected using the (time.Time).IsZero() method
func NeedToCreateBackup ¶
func NeedToCreateBackup(dbConn db.Connection) (bool, error)
NeedToCreateBackup returns whether a backup is needed
func SetLastBackupToNow ¶
func SetLastBackupToNow(dbConn db.Connection) error
SetLastBackupToNow sets the last backup time to now
Types ¶
type APIKey ¶
type APIKey struct { db.M `bson:",inline"` Name string `json:"name"` Enabled bool `json:"enabled"` Domains []string `json:"domains"` Key string `json:"key"` Roles APIKeyRole `json:"roles" description:"What are the actions this key can do, every truthy bit of this number represends a role"` // System indicates if this is a key required by the system // These are keys whereof at least one needs to exists otherwise RT-CV would not work System bool `json:"system" description:"True when the key is generated (& required) by RT-CV to function"` }
APIKey contains a registered API key
func GetAPIKeys ¶
func GetAPIKeys(conn db.Connection) ([]APIKey, error)
GetAPIKeys returns all the keys registered in the database
func GetScraperAPIKeys ¶
func GetScraperAPIKeys(conn db.Connection) ([]APIKey, error)
GetScraperAPIKeys returns all the keys with scraper roles registered in the database
func (*APIKey) CollectionName ¶
CollectionName returns the collection name of the ApiKey
func (*APIKey) DefaultFindFilters ¶
DefaultFindFilters sets the default filters for the db connection find
func (*APIKey) Info ¶
func (a *APIKey) Info() APIKeyInfo
Info converts the APIKey into APIKeyInfo This key can be send to someone safely without exposing the key
type APIKeyInfo ¶
type APIKeyInfo struct { ID primitive.ObjectID `json:"id"` Name string `json:"name"` Domains []string `json:"domains"` Roles []APIRole `json:"roles"` System bool `json:"system"` }
APIKeyInfo contains information about an API key This key can be send to someone safely without exposing the key To generate this object use the (*APIKey).Info method
type APIKeyRole ¶
type APIKeyRole uint64
APIKeyRole is a role that tells what someone can and can't do Roles can be combined together using bit sifting For example:
APIKeyRoleScraper | APIKeyRoleInformationObtainer // Is a valid APIKeyRole that represends 2 rules
const ( // APIKeyRoleScraper can insert scraped data // = 1 APIKeyRoleScraper APIKeyRole = 1 << iota // APIKeyRoleInformationObtainer can obtain information the server has // = 2 APIKeyRoleInformationObtainer // APIKeyRoleController can control the server // = 4 APIKeyRoleController // APIKeyRoleDashboard can access the dashboard and modify server state // = 8 APIKeyRoleDashboard // APIKeyRoleAdmin Currently unused // = 16 APIKeyRoleAdmin )
func (APIKeyRole) ContainsAll ¶
func (a APIKeyRole) ContainsAll(other APIKeyRole) bool
ContainsAll check if a contains all of other
func (APIKeyRole) ContainsSome ¶
func (a APIKeyRole) ContainsSome(other APIKeyRole) bool
ContainsSome check if a contains some of other
func (APIKeyRole) ConvertToAPIRoles ¶
func (a APIKeyRole) ConvertToAPIRoles() []APIRole
ConvertToAPIRoles convers the unreadable role number into an array of APIRole
func (APIKeyRole) Description ¶
func (a APIKeyRole) Description() (description, slug string, ok bool)
Description returns a description of the role Only works on single roles
func (APIKeyRole) Valid ¶
func (a APIKeyRole) Valid() bool
Valid returns if the role is valid role Empty roles are also invalid
type APIRole ¶
type APIRole struct { Role APIKeyRole `json:"role"` Slug string `json:"slug"` Description string `json:"description"` }
APIRole contains information about a APIKeyRole
type Backup ¶
Backup tells when a backup was created
func (*Backup) CollectionName ¶
CollectionName returns the collection name of the Backup
type CV ¶
type CV struct { Title string `json:"-"` // Not supported yet ReferenceNumber string `` /* 142-byte string literal not displayed */ Link *string `json:"link" description:"A link to the page on the site where this cv was found"` CreatedAt *jsonHelpers.RFC3339Nano `json:"createdAt,omitempty"` LastChanged *jsonHelpers.RFC3339Nano `json:"lastChanged,omitempty"` Educations Educations `json:"educations,omitempty"` WorkExperiences WorkExperiences `json:"workExperiences,omitempty"` PreferredJobs []string `json:"preferredJobs,omitempty"` Languages []Language `json:"languages,omitempty"` Competences []Competence `json:"-"` // Not supported yet Interests []Interest `json:"-"` // Not supported yet PersonalDetails PersonalDetails `json:"personalDetails" jsonSchema:"notRequired"` Presentation string `json:"presentation" description:"How this person would present him/her self"` DriversLicenses []jsonHelpers.DriversLicense `json:"driversLicenses,omitempty"` }
CV contains all information that belongs to a curriculum vitae TODO check the json removed fields if we actually should use them
func (*CV) GetEmailHTML ¶
GetEmailHTML generates a HTML document that is used as email body
type Competence ¶
Competence is an activity a user is "good" at
type DataKind ¶ added in v1.0.19
type DataKind uint8
DataKind deinfes the kind of data that is being sent to the hook
type Education ¶
type Education struct { Is uint8 `json:"is" description:"What kind of education is this?: 0: Unknown, 1: Education, 2: Course"` Name string `json:"name"` Description string `json:"description"` Institute string `json:"institute"` // TODO find difference between isCompleted and hasdiploma IsCompleted bool `json:"isCompleted"` HasDiploma bool `json:"hasDiploma"` StartDate *jsonHelpers.RFC3339Nano `json:"startDate"` EndDate *jsonHelpers.RFC3339Nano `json:"endDate"` }
Education is something a user has followed
func (*Education) Date ¶ added in v1.0.11
func (e *Education) Date() *jsonHelpers.RFC3339Nano
Date returns the EndDate if it is set, otherwise the StartDate If both are not set it returns nil
type Educations ¶ added in v1.0.11
type Educations []Education
Educations conatins a list of educations and makes it sortable
func (Educations) Len ¶ added in v1.0.11
func (l Educations) Len() int
func (Educations) Less ¶ added in v1.0.11
func (l Educations) Less(i, j int) bool
func (Educations) Swap ¶ added in v1.0.11
func (l Educations) Swap(i, j int)
type GetOnMatchHooksProps ¶ added in v1.0.30
GetOnMatchHooksProps contains the properties for GetOnMatchHooks
type Language ¶
type Language struct { Name string `json:"name"` LevelSpoken LanguageLevel `json:"levelSpoken"` LevelWritten LanguageLevel `json:"levelWritten"` }
Language is a language a user can speak
type LanguageLevel ¶
type LanguageLevel uint
LanguageLevel is something that i'm not sure what it is
const ( LanguageLevelUnknown LanguageLevel = iota LanguageLevelReasonable LanguageLevelGood LanguageLevelExcellent )
The lanague levels available
func (LanguageLevel) JSONSchemaDescribe ¶
func (LanguageLevel) JSONSchemaDescribe() jsonschema.Property
JSONSchemaDescribe implements schema.Describe
func (LanguageLevel) String ¶
func (ll LanguageLevel) String() string
func (LanguageLevel) Valid ¶
func (ll LanguageLevel) Valid() bool
Valid returns weather the language level is valid
type Match ¶
type Match struct { RequestID primitive.ObjectID `json:"requestId" bson:"requestId"` // Maybe we should remove this one it adds minimal extra value ProfileID primitive.ObjectID `json:"profileId" bson:"profileId" description:"the profile this match was made with"` KeyID primitive.ObjectID `json:"keyId" bson:"keyId" description:"the key used to upload this CV, this will be the api key used by the scraper"` When jsonHelpers.RFC3339Nano `json:"when"` ReferenceNr string `json:"referenceNr" bson:"referenceNr" description:"The reference number of the CV"` // Is this a debug match // This is currently only true if the match was made using the /tryMatcher dashboard page Debug bool `` /* 154-byte string literal not displayed */ // The profile domain match that was found YearsSinceWork *int `bson:",omitempty" json:"yearsSinceWork"` YearsSinceEducation *int `bson:",omitempty" json:"yearsSinceEducation"` // the education name of the profile that was matched Education *string `bson:",omitempty" json:"education"` // The profile desired profession match that was found DesiredProfession *string `bson:",omitempty" json:"desiredProfession"` ProfessionExperienced *string `bson:",omitempty" json:"professionExperienced"` DriversLicense bool `bson:",omitempty" json:"driversLicense"` ZipCode *ProfileDutchZipcode `bson:",omitempty" json:"zipCode"` }
Match contains information about a match We add omitempty to a lot of fields as it saves a lot of space in the database
type OnMatchHook ¶ added in v1.0.6
type OnMatchHook struct { db.M `bson:",inline"` KeyID primitive.ObjectID `json:"keyId" bson:"keyId"` Disabled bool `json:"disabled" bson:"disabled"` URL string `json:"url"` Method string `json:"method" description:"the method to use when calling the url (GET, POST, PUT, PATCH, DELETE)"` AddHeaders []Header `json:"addHeaders" bson:"addHeaders"` }
OnMatchHook can hook onto the matching process and call API calls in case of matches
func GetOnMatchHooks ¶ added in v1.0.19
func GetOnMatchHooks(dbConn db.Connection, props GetOnMatchHooksProps) ([]OnMatchHook, error)
GetOnMatchHooks returns all the onMatchHooks
func (*OnMatchHook) CallAndLogResult ¶ added in v1.0.19
CallAndLogResult calls the hook defined in OnMatchHook and logs the result
func (*OnMatchHook) CallWithRetry ¶ added in v1.0.31
CallWithRetry executes (*OnMatchHook).Call() with a retry if it failes with spesific reasons
func (*OnMatchHook) CollectionName ¶ added in v1.0.6
func (*OnMatchHook) CollectionName() string
CollectionName returns the collection name of the Profile
type PersonalDetails ¶
type PersonalDetails struct { Initials string `json:"initials,omitempty" jsonSchema:"notRequired"` FirstName string `json:"firstName,omitempty" jsonSchema:"notRequired"` SurNamePrefix string `json:"surNamePrefix,omitempty" jsonSchema:"notRequired"` SurName string `json:"surName,omitempty" jsonSchema:"notRequired"` DateOfBirth *jsonHelpers.RFC3339Nano `json:"dob,omitempty" jsonSchema:"notRequired"` Gender string `json:"gender,omitempty" jsonSchema:"notRequired"` StreetName string `json:"streetName,omitempty" jsonSchema:"notRequired"` HouseNumber string `json:"houseNumber,omitempty" jsonSchema:"notRequired"` HouseNumberSuffix string `json:"houseNumberSuffix,omitempty" jsonSchema:"notRequired"` Zip string `json:"zip,omitempty" jsonSchema:"notRequired"` City string `json:"city,omitempty" jsonSchema:"notRequired"` Country string `json:"country,omitempty" jsonSchema:"notRequired"` PhoneNumber *jsonHelpers.PhoneNumber `json:"phoneNumber,omitempty" jsonSchema:"notRequired"` Email string `json:"email,omitempty" jsonSchema:"notRequired"` }
PersonalDetails contains personal info
func (*PersonalDetails) ZipAsNr ¶ added in v1.0.19
func (pd *PersonalDetails) ZipAsNr() (uint16, bool)
ZipAsNr returns the zip code as an uint16 if possible Returns only the 4 digits of a zip code as a number The second argument is a success boolean, if false the zip code is not parsable
type Profile ¶
type Profile struct { db.M `bson:",inline"` Name string `json:"name"` Active bool `json:"active"` AllowedScrapers []primitive.ObjectID `` /* 168-byte string literal not displayed */ MustDesiredProfession bool `json:"mustDesiredProfession" bson:"mustDesiredProfession"` DesiredProfessions []ProfileProfession `json:"desiredProfessions" bson:"desiredProfessions"` YearsSinceWork *int `json:"yearsSinceWork" bson:"yearsSinceWork"` MustExpProfession bool `json:"mustExpProfession" bson:"mustExpProfession"` ProfessionExperienced []ProfileProfession `json:"professionExperienced" bson:"professionExperienced"` MustDriversLicense bool `json:"mustDriversLicense" bson:"mustDriversLicense"` DriversLicenses []ProfileDriversLicense `json:"driversLicenses" bson:"driversLicenses"` MustEducationFinished bool `json:"mustEducationFinished" bson:"mustEducationFinished"` MustEducation bool `` /* 132-byte string literal not displayed */ YearsSinceEducation *int `json:"yearsSinceEducation" bson:"yearsSinceEducation"` Educations []ProfileEducation `json:"educations" bson:"educations"` Zipcodes []ProfileDutchZipcode `json:"zipCodes" bson:"zipCodes"` // What should happen on a match OnMatch ProfileOnMatch `json:"onMatch" bson:"onMatch" description:"What should happen when a match is made on this profile"` Lables map[string]any `` /* 152-byte string literal not displayed */ ListsAllowed bool `json:"listsAllowed" bson:"listsAllowed"` // OldID is used to keep track of converted old profiles OldID *uint64 `bson:"_old_id" json:"-"` // Variables set by the matching process only when they needed // These are mainly used for caching so we don't have to calculate values twice // There values where detected using the -profile flag, see main.go for more info EducationFuzzyMatcherCache *fuzzymatcher.Matcher `bson:"-" json:"-"` ProfessionExperiencedFuzzyMatcherCache *fuzzymatcher.Matcher `bson:"-" json:"-"` DesiredProfessionsFuzzyMatcherCache *fuzzymatcher.Matcher `bson:"-" json:"-"` DomainPartsCache [][]string `bson:"-" json:"-"` NormalizedDriversLicensesCache []jsonHelpers.DriversLicense `bson:"-" json:"-"` }
Profile contains all the information about a search profile
func GetActualMatchActiveProfiles ¶ added in v1.0.23
func GetActualMatchActiveProfiles(conn db.Connection) ([]Profile, error)
GetActualMatchActiveProfiles returns that we can actually use Matches are not really helpfull if no desiredProfessions, professionExperienced, driversLicenses or educations is set Matches without an onMatch property are useless as we can't send the match anywhere
func GetListsProfiles ¶ added in v1.0.19
func GetListsProfiles(conn db.Connection) ([]Profile, error)
GetListsProfiles returns all profiles that can be used for the cv lists functionality
func GetProfile ¶
GetProfile returns a profile by id
func GetProfiles ¶
GetProfiles returns all profiles from the database
func (*Profile) CollectionName ¶
CollectionName returns the collection name of the Profile
func (*Profile) ValidateCreateNewProfile ¶
func (p *Profile) ValidateCreateNewProfile(conn db.Connection) error
ValidateCreateNewProfile validates a new profile to create
type ProfileDriversLicense ¶
type ProfileDriversLicense struct {
Name string `json:"name"`
}
ProfileDriversLicense contains the drivers license name
type ProfileDutchZipcode ¶
ProfileDutchZipcode is dutch zipcode range limited to the number
func (*ProfileDutchZipcode) IsWithinCithAndArea ¶
func (p *ProfileDutchZipcode) IsWithinCithAndArea(cityAndArea uint16) bool
IsWithinCithAndArea checks if the cityAndArea provided are in the range range of the zipcode
type ProfileEducation ¶
type ProfileEducation struct {
Name string `json:"name"`
}
ProfileEducation contains information about an education
type ProfileOnMatch ¶
type ProfileOnMatch struct {
SendMail []ProfileSendEmailData `json:"sendMail" bson:"sendMail"`
}
ProfileOnMatch defines what should happen when a profile is matched to a CV
type ProfileProfession ¶
type ProfileProfession struct {
Name string `json:"name"`
}
ProfileProfession contains information about a proffession
type ProfileSendEmailData ¶
type ProfileSendEmailData struct {
Email string `json:"email"`
}
ProfileSendEmailData only contains an email address atm
type ScraperLoginUser ¶ added in v1.0.13
type ScraperLoginUser struct { Username string `json:"username"` EncryptedPassword string `json:"encryptedPassword,omitempty" bson:"encryptedPassword"` }
ScraperLoginUser defines a user that can be used by a scraper to login into a scraped website
type ScraperLoginUsers ¶ added in v1.0.13
type ScraperLoginUsers struct { db.M `bson:",inline"` ScraperID primitive.ObjectID `json:"scraperId" bson:"scraperId"` ScraperPubKey string `json:"scraperPubKey" bson:"scraperPubKey"` Users []ScraperLoginUser `json:"users"` }
ScraperLoginUsers defines all the users a scraper can use
func (*ScraperLoginUsers) CollectionName ¶ added in v1.0.13
func (*ScraperLoginUsers) CollectionName() string
CollectionName should yield the collection name for the entry
func (*ScraperLoginUsers) EncryptPassword ¶ added in v1.0.17
func (s *ScraperLoginUsers) EncryptPassword(password string) (string, error)
EncryptPassword encrypts a user password using the public key of a scraper
func (*ScraperLoginUsers) Indexes ¶ added in v1.0.13
func (*ScraperLoginUsers) Indexes() []mongo.IndexModel
Indexes implements db.Entry
type StatusCodeError ¶ added in v1.0.31
type StatusCodeError struct {
// contains filtered or unexported fields
}
StatusCodeError is an error thrown by (*OnMatchHook).Call() when the status code is >= 400
func (*StatusCodeError) Error ¶ added in v1.0.31
func (e *StatusCodeError) Error() string
type WorkExperience ¶
type WorkExperience struct { Description string `json:"description"` Profession string `json:"profession"` StartDate *jsonHelpers.RFC3339Nano `json:"startDate"` EndDate *jsonHelpers.RFC3339Nano `json:"endDate"` StillEmployed bool `json:"stillEmployed"` Employer string `json:"employer"` WeeklyHoursWorked int `json:"weeklyHoursWorked"` }
WorkExperience is experience in work
func (*WorkExperience) Date ¶ added in v1.0.11
func (we *WorkExperience) Date() *jsonHelpers.RFC3339Nano
Date returns the EndDate if it is set, otherwise the StartDate If both are not set it returns nil
type WorkExperiences ¶ added in v1.0.11
type WorkExperiences []WorkExperience
WorkExperiences conatins a list of Work experiences and makes it sortable
func (WorkExperiences) Len ¶ added in v1.0.11
func (l WorkExperiences) Len() int
func (WorkExperiences) Less ¶ added in v1.0.11
func (l WorkExperiences) Less(i, j int) bool
func (WorkExperiences) Swap ¶ added in v1.0.11
func (l WorkExperiences) Swap(i, j int)