Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAPIKeysExists(conn db.Connection, apiKeys []primitive.ObjectID) error
- func CheckDashboardKeyExists(conn db.Connection)
- func DeleteSecretByKey(conn db.Connection, keyID primitive.ObjectID, key string) error
- func GetActualActiveProfilesCount(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 Education
- type Interest
- type Language
- type LanguageLevel
- type Match
- func GetMatches(dbConn db.Connection, keyID *primitive.ObjectID) ([]Match, error)
- func GetMatchesOnReferenceNr(dbConn db.Connection, referenceNr string, keyID *primitive.ObjectID) ([]Match, error)
- func GetMatchesSince(dbConn db.Connection, since time.Time, keyID *primitive.ObjectID) ([]Match, error)
- type PdfOptions
- type PersonalDetails
- type Profile
- type ProfileDriversLicense
- type ProfileDutchZipcode
- type ProfileEducation
- type ProfileHTTPCallData
- type ProfileOnMatch
- type ProfileProfession
- type ProfileSendEmailData
- type Secret
- func CreateSecret(keyID primitive.ObjectID, key string, encryptionKey string, value []byte, ...) (*Secret, error)
- func GetSecretByKey(conn db.Connection, keyID primitive.ObjectID, key string) (*Secret, error)
- func GetSecrets(conn db.Connection, keyID primitive.ObjectID) ([]Secret, error)
- func GetSecretsFromAllKeys(conn db.Connection) ([]Secret, error)
- func UnsafeMustCreateSecret(keyID primitive.ObjectID, key string, encryptionKey string, value []byte, ...) *Secret
- type SecretValueStructure
- type SecretValueStructureUserT
- type WorkExperience
Constants ¶
const ( // SecretValueStructureFree contains no value structure requirement it's up to the user SecretValueStructureFree = SecretValueStructure("free") // SecretValueStructureUser contains a username & password combo SecretValueStructureUser = SecretValueStructure("strict-user") // SecretValueStructureUsers contains a list of usernames and passwords SecretValueStructureUsers = SecretValueStructure("strict-users") )
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, } )
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 DeleteSecretByKey ¶
DeleteSecretByKey delete a secret
func GetActualActiveProfilesCount ¶
func GetActualActiveProfilesCount(conn db.Connection) (uint64, error)
GetActualActiveProfilesCount does the same as GetActualActiveProfiles 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 */ CreatedAt *jsonHelpers.RFC3339Nano `json:"createdAt,omitempty"` LastChanged *jsonHelpers.RFC3339Nano `json:"lastChanged,omitempty"` Educations []Education `json:"educations,omitempty"` WorkExperiences []WorkExperience `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"` PersonalPresentation string `json:"-"` // Not supported yet 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 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
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 { db.M `bson:",inline"` 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
func GetMatches ¶
GetMatches returns all matches for a specific key If keyID is nil, all matches for all keys are returned
func GetMatchesOnReferenceNr ¶
func GetMatchesOnReferenceNr(dbConn db.Connection, referenceNr string, keyID *primitive.ObjectID) ([]Match, error)
GetMatchesOnReferenceNr returns all matches that have been done on a ReferenceNr
func GetMatchesSince ¶
func GetMatchesSince(dbConn db.Connection, since time.Time, keyID *primitive.ObjectID) ([]Match, error)
GetMatchesSince returns all matches that have been done since a certain date+time
func (*Match) CollectionName ¶
CollectionName returns the collection name of the Profile
func (*Match) GetMatchSentence ¶
GetMatchSentence returns a
type PdfOptions ¶
type PdfOptions struct { // See pdf_generator/bin/fonts.dart > _fontFilesMap for available fonts FontHeader *string `json:"fontHeader" bson:"fontHeader"` FontRegular *string `json:"fontRegular" bson:"fontRegular"` // See pdf_generator/bin/args.dart > LayoutStyle for available styles Style *string `json:"style" bson:"style"` // Expected to be a hex value like: #ffffff HeaderColor *string `json:"headerColor" bson:"headerColor"` SubHeaderColor *string `json:"subHeaderColor" bson:"subHeaderColor"` LogoImageURL *string `json:"logoImageUrl" bson:"logoImageUrl"` CompanyName *string `json:"companyName" bson:"companyName"` CompanyAddress *string `json:"companyAddress" bson:"companyAddress"` }
PdfOptions contains options for the creation of the pdf
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
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"` // 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 EducationFuzzyMatcher *fuzzymatcher.Matcher `bson:"-" json:"-"` ProfessionExperiencedFuzzyMatcher *fuzzymatcher.Matcher `bson:"-" json:"-"` DesiredProfessionsFuzzyMatcher *fuzzymatcher.Matcher `bson:"-" json:"-"` DomainPartsCache [][]string `bson:"-" json:"-"` NormalizedDriversLicensesCache []jsonHelpers.DriversLicense `bson:"-" json:"-"` }
Profile contains all the information about a search profile
func GetActualActiveProfiles ¶
func GetActualActiveProfiles(conn db.Connection) ([]Profile, error)
GetActualActiveProfiles 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 GetProfile ¶
GetProfile returns a profile by id
func GetProfiles ¶
func GetProfiles(conn db.Connection) ([]Profile, error)
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 ProfileHTTPCallData ¶
ProfileHTTPCallData defines a http address that should be called when a match was made
func (*ProfileHTTPCallData) MakeRequest ¶
func (d *ProfileHTTPCallData) MakeRequest(profile Profile, match Match)
MakeRequest creates a http request
type ProfileOnMatch ¶
type ProfileOnMatch struct { SendMail []ProfileSendEmailData `json:"sendMail" bson:"sendMail"` HTTPCall []ProfileHTTPCallData `json:"httpCall" bson:"httpCall"` PdfOptions *PdfOptions `` /* 148-byte string literal not displayed */ }
ProfileOnMatch defines what should happen when a profile is matched to a CV
func (*ProfileOnMatch) HasPDFOptions ¶
func (onMatch *ProfileOnMatch) HasPDFOptions() bool
HasPDFOptions returns true if the PdfOptions is set and has at least one option set
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 Secret ¶
type Secret struct { db.M `bson:",inline"` KeyID primitive.ObjectID `bson:"keyId" json:"keyId"` Key string `json:"key" description:"the identifier of this secret"` Value string `json:"-"` Description string `json:"description" description:"a description for this secret"` ValueStructure SecretValueStructure `` /* 129-byte string literal not displayed */ }
Secret contains a secret value that can be stored in the database by a api user The secret value is encrypted with a key that is not stored on our side and is controlled by the api user
func CreateSecret ¶
func CreateSecret( keyID primitive.ObjectID, key string, encryptionKey string, value []byte, description string, valueStructure SecretValueStructure, ) (*Secret, error)
CreateSecret creates a secret
func GetSecretByKey ¶
GetSecretByKey gets a secret
func GetSecrets ¶
GetSecrets gets all secrets from a key
func GetSecretsFromAllKeys ¶
func GetSecretsFromAllKeys(conn db.Connection) ([]Secret, error)
GetSecretsFromAllKeys gets all secrets
func UnsafeMustCreateSecret ¶
func UnsafeMustCreateSecret( keyID primitive.ObjectID, key string, encryptionKey string, value []byte, description string, valueStructure SecretValueStructure, ) *Secret
UnsafeMustCreateSecret Creates a secret and panics if an error is returned
func (*Secret) CollectionName ¶
CollectionName returns the collection name of a secret
func (Secret) Decrypt ¶
func (secret Secret) Decrypt(key string) (json.RawMessage, error)
Decrypt decrypts the value of a secret
func (*Secret) UpdateValue ¶
func (secret *Secret) UpdateValue(value []byte, encryptionKey string, valueStructure SecretValueStructure) error
UpdateValue updates the value field to a new json value
type SecretValueStructure ¶
type SecretValueStructure string
SecretValueStructure tells what the structure of the encrypted data is
func (SecretValueStructure) Valid ¶
func (s SecretValueStructure) Valid() bool
Valid returns weather s is a valid structure
func (SecretValueStructure) ValidateValue ¶
func (s SecretValueStructure) ValidateValue(value []byte) bool
ValidateValue validates value agains the s it's structure
type SecretValueStructureUserT ¶
type SecretValueStructureUserT struct { Username string `json:"username"` Password string `json:"password"` }
SecretValueStructureUserT is the data structure for SecretValueStructureUser
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