store

package
v0.0.0-...-b42a24c Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobApplicationSubmission = 0
	JobApplicationInterview  = 1
	JobApplicationAssessment = 2
	JobApplicationOffer      = 3
	JobApplicationCompletion = 4
	JobApplicationRejection  = 5
)
View Source
const DateTimeFormat = "2006-01-02 15:04:05"
View Source
const TokenDuration = 7 * 24 * time.Hour

Set a token duration of 7 days

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	Connect() (*mongo.Client, context.Context, error)
	Disconnect(ctx context.Context, client *mongo.Client)
	GetCareerProfileByEmail(email string) (*types.CareerProfile, error)
	GetCareerProfileByID(profileId uuid.UUID) (*types.CareerProfile, error)
	StoreCareerProfile(careerProfileRequest *types.CareerProfile) (*types.CareerProfile, string, error)
	GetJobApplications(profileId uuid.UUID) (*[]types.JobApplication, error)
	GetJobApplicationByID(jobApplicationId uuid.UUID) (*types.JobApplication, error)
	StoreJobApplication(jobApplicationRequest *types.JobApplication) (*types.JobApplication, string, error)
	DeleteJobApplication(jobApplicationId uuid.UUID) error
	StoreAccessToken(profileId uuid.UUID, accessToken string, ipAddress string) (string, error)
	ValidateAccessToken(profileId uuid.UUID, accessToken string, ipAddress string) (bool, error)
}

type StoreClient

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

func NewStore

func NewStore() (*StoreClient, error)

NewStore returns a store client, which has methods to interact with MongoDB

func (*StoreClient) Connect

func (store *StoreClient) Connect() (*mongo.Client, context.Context, error)

Connect establishes a Mongo connection, and returns a MongoDB client

func (*StoreClient) DeleteJobApplication

func (store *StoreClient) DeleteJobApplication(jobApplicationId uuid.UUID) error

DeleteJobApplication retrieves an array of job applications from MongoDB

func (*StoreClient) Disconnect

func (store *StoreClient) Disconnect(ctx context.Context, client *mongo.Client)

Disconnect closes the MongoDB connection for the given client

func (*StoreClient) GetCareerProfileByEmail

func (store *StoreClient) GetCareerProfileByEmail(email string) (*types.CareerProfile, error)

GetCareerProfile retrieves a CareerProfile from MongoDB

func (*StoreClient) GetCareerProfileByID

func (store *StoreClient) GetCareerProfileByID(profileId uuid.UUID) (*types.CareerProfile, error)

GetCareerProfileByID retrieves a CareerProfile using the ID from MongoDB

func (*StoreClient) GetJobApplicationByID

func (store *StoreClient) GetJobApplicationByID(jobApplicationId uuid.UUID) (*types.JobApplication, error)

GetJobApplicationByID retrieves job application by ID from MongoDB

func (*StoreClient) GetJobApplications

func (store *StoreClient) GetJobApplications(profileId uuid.UUID) (*[]types.JobApplication, error)

GetJobApplications retrieves an array of job applications from MongoDB

func (*StoreClient) StoreAccessToken

func (store *StoreClient) StoreAccessToken(profileId uuid.UUID, accessToken string, ipAddress string) (string, error)

StoreAccessToken stores an access_token for a given profile_id

func (*StoreClient) StoreCareerProfile

func (store *StoreClient) StoreCareerProfile(careerProfile *types.CareerProfile) (*types.CareerProfile, string, error)

StoreCareerProfile upserts a CareerProfile in MongoDB

func (*StoreClient) StoreJobApplication

func (store *StoreClient) StoreJobApplication(jobApplicationRequest *types.JobApplication) (*types.JobApplication, string, error)

StoreJobApplication upserts a JobApplication in MongoDB

func (*StoreClient) ValidateAccessToken

func (store *StoreClient) ValidateAccessToken(profileId uuid.UUID, accessToken string, ipAddress string) (bool, error)

ValidateAccessToken checks that a given access_token is valid for a profile_id

Jump to

Keyboard shortcuts

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