dao

package
v0.0.0-...-80e094b Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package dao provides access to the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthcodeDAOService

type AuthcodeDAOService interface {
	// CompanyHasAuthCode will check if the supplied company number has an auth code
	CompanyHasAuthCode(companyNumber string) (bool, error)
	// UpsertEmptyAuthCode updates an authcode, or inserts if not already present
	UpsertEmptyAuthCode(companyNumber string) error
}

AuthcodeDAOService interface declares how to interact with the persistence layer regardless of underlying technology

func NewAuthCodeDAOService

func NewAuthCodeDAOService(cfg *config.Config) AuthcodeDAOService

NewAuthCodeDAOService will create a new instance of the AuthCode Service interface. All details about its implementation and the database driver will be hidden from outside of this package

type AuthcodeRequestDAOService

type AuthcodeRequestDAOService interface {
	// InsertAuthcodeRequest creates an auth-code-request
	InsertAuthCodeRequest(dao *models.AuthCodeRequestResourceDao) error
	// GetAuthCodeRequest returns an auth-code-request
	GetAuthCodeRequest(authCodeRequestID string) (*models.AuthCodeRequestResourceDao, error)
	// UpdateAuthCodeRequestOfficer updates the officer details in an auth-code-request
	UpdateAuthCodeRequestOfficer(dao *models.AuthCodeRequestResourceDao) error
	// UpdateAuthCodeRequestStatus updates the status in an auth-code-request
	UpdateAuthCodeRequestStatus(dao *models.AuthCodeRequestResourceDao) error
	// CheckMultipleCorporateBodySubmissions checks whether multiple requests have been made for a company
	CheckMultipleCorporateBodySubmissions(companyNumber string) (bool, error)
	// CheckMultipleUserSubmissions checks whether multiple requests have been made for a user
	CheckMultipleUserSubmissions(email string) (bool, error)
}

AuthcodeRequestDAOService interface declares how to interact with the persistence layer regardless of underlying technology

func NewAuthCodeRequestDAOService

func NewAuthCodeRequestDAOService(cfg *config.Config) AuthcodeRequestDAOService

NewAuthCodeRequestDAOService will create a new instance of the AuthCode Request Service interface. All details about its implementation and the database driver will be hidden from outside of this package

type MongoDatabaseInterface

type MongoDatabaseInterface interface {
	Collection(name string, opts ...*options.CollectionOptions) *mongo.Collection
}

MongoDatabaseInterface is an interface that describes the mongodb driver

type MongoService

type MongoService struct {
	CollectionName string
	// contains filtered or unexported fields
}

MongoService is an implementation of the Service interface using MongoDB as the backend driver.

func (*MongoService) CheckMultipleCorporateBodySubmissions

func (m *MongoService) CheckMultipleCorporateBodySubmissions(companyNumber string) (bool, error)

CheckMultipleCorporateBodySubmissions checks for multiple company submitted requests. A maximum of one request every 3 days is permitted per company.

func (*MongoService) CheckMultipleUserSubmissions

func (m *MongoService) CheckMultipleUserSubmissions(email string) (bool, error)

CheckMultipleUserSubmissions checks whether a user has submitted multiple requests. A maximum of 3 user requests in a 24 hour period are permitted.

func (*MongoService) CompanyHasAuthCode

func (m *MongoService) CompanyHasAuthCode(companyNumber string) (bool, error)

CompanyHasAuthCode checks whether a company has an active auth code

func (*MongoService) GetAuthCodeRequest

func (m *MongoService) GetAuthCodeRequest(authCodeRequestID string) (*models.AuthCodeRequestResourceDao, error)

GetAuthCodeRequest returns an auth code request from the db

func (*MongoService) InsertAuthCodeRequest

func (m *MongoService) InsertAuthCodeRequest(dao *models.AuthCodeRequestResourceDao) error

InsertAuthCodeRequest inserts an auth code request into the db

func (*MongoService) UpdateAuthCodeRequestOfficer

func (m *MongoService) UpdateAuthCodeRequestOfficer(dao *models.AuthCodeRequestResourceDao) error

UpdateAuthCodeRequestOfficer updates an authcode request with officer details

func (*MongoService) UpdateAuthCodeRequestStatus

func (m *MongoService) UpdateAuthCodeRequestStatus(dao *models.AuthCodeRequestResourceDao) error

UpdateAuthCodeRequestStatus updates an authcode request with status details

func (*MongoService) UpsertEmptyAuthCode

func (m *MongoService) UpsertEmptyAuthCode(companyNumber string) error

UpsertEmptyAuthCode updates an authcode, or inserts if not already present

Jump to

Keyboard shortcuts

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