database

package
v0.0.0-...-50815b3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBClient

type DBClient interface {
	// AddNewUser creates a new user in the database
	AddNewUser(u *models.User, e *models.EmailVerification) error
	// GetUser returns a user from the database with the given email
	GetUser(email string) (*models.User, error)
	// DeleteUser deletes a user from the database with the given email
	DeleteUser(email string) error
	// GetEmailVerification returns a pending email verification from the database
	// with the given email and hash
	GetEmailVerification(email string, hash string) (*models.EmailVerification, error)
	// AddNewClub creates a new club in the database with a user (creator) associated to it
	AddNewClub(c *models.Club, cu *models.ClubUser) error
	// GetClub returns a club with the given id
	GetClub(id string) (*models.Club, error)
	// GetAllClubUsers returns a list of ClubUsers associated with a club
	GetAllClubUsers(id string) ([]*models.ClubUser, error)
	// DeleteClub deletes a club from the database with the given id
	DeleteClub(id string) error
	// AddNewPeriod creates a new period item in the club table
	AddNewPeriod(clubID string, period *models.Period) error
	// AddNewEvent creates a new event in the club table
	AddNewEvent(clubID string, event *models.EventProps) error
	// GetEvent returns an event from the database
	GetEvent(clubID string, period string, eventID string) (*models.EventProps, error)
	// GetEvents returns all the events of an application period
	GetEvents(clubID string, period string) ([]*models.EventProps, error)
	// DeleteEvent deletes an event and all of its applications
	DeleteEvent(clubID string, period string, eventID string) error
	// AddNewApplicant creates a new applicant in the club table for an application period
	AddNewApplicant(clubID string, applicant *models.Applicant) error
	// GetApplicant returns an applicant for a application period
	GetApplicant(clubID string, period string, email string) (*models.Applicant, error)
	// GetApplicants returns all the applicants for an application period
	GetApplicants(clubID string, period string) ([]*models.Applicant, error)
	// DeleteApplicant deletes an applicant from a application period and their event applications
	DeleteApplicant(clubID string, period string, email string) error
	// AddNewApplication adds an application to the database
	AddNewApplication(clubID string, application *models.Application) error
	// GetApplication returns the application for an event by applicant email
	GetApplication(clubID string, period string, eventID string, email string) (*models.Application, error)
	// GetApplications returns all the applications for an event
	GetApplications(clubID string, period string, eventID string) ([]*models.Application, error)
	// DeleteApplication deletes the application for an event by applicant email
	DeleteApplication(clubID string, period string, eventID string, email string) error
	// AddTag adds a new Tag for that application period
	AddTag(clubID string, tag *models.Tag) error
	// GetTags returns all the tags for an application period
	GetTags(clubID string, period string) ([]*models.Tag, error)
	// DeleteTag deletes a tag for the application period
	DeleteTag(clubID string, period string, tag string) error
}

DBClient wraps the AWS DynamoDB database API

type Database

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

Database handles database connections

func New

func New(awsConfig client.ConfigProvider, logger *zap.SugaredLogger) (*Database, error)

New creates a new database client

func (*Database) AddNewApplicant

func (db *Database) AddNewApplicant(clubID string, applicant *models.Applicant) error

AddNewApplicant creates a new applicant in the club table for an application period

func (*Database) AddNewApplication

func (db *Database) AddNewApplication(clubID string, application *models.Application) error

AddNewApplication adds an application to the database

func (*Database) AddNewClub

func (db *Database) AddNewClub(c *models.Club, cu *models.ClubUser) error

AddNewClub creates a new club in the database with a user (creator) associated to it

func (*Database) AddNewEvent

func (db *Database) AddNewEvent(clubID string, event *models.EventProps) error

AddNewEvent creates a new event in the club table

func (*Database) AddNewPeriod

func (db *Database) AddNewPeriod(clubID string, period *models.Period) error

AddNewPeriod creates a new period item in the club table

func (*Database) AddNewUser

func (db *Database) AddNewUser(u *models.User, e *models.EmailVerification) error

AddNewUser creates a new user in the database

func (*Database) AddTag

func (db *Database) AddTag(clubID string, tag *models.Tag) error

AddTag adds a new Tag for that application period

func (*Database) DeleteApplicant

func (db *Database) DeleteApplicant(clubID string, period string, email string) error

DeleteApplicant deletes an applicant from a application period and their event applications

func (*Database) DeleteApplication

func (db *Database) DeleteApplication(clubID string, period string, eventID string, email string) error

DeleteApplication deletes the application for an event by applicant email

func (*Database) DeleteClub

func (db *Database) DeleteClub(id string) error

DeleteClub deletes a club from the database with the given id

func (*Database) DeleteEvent

func (db *Database) DeleteEvent(clubID string, period string, eventID string) error

DeleteEvent deletes an event and all of its applications

func (*Database) DeleteTag

func (db *Database) DeleteTag(clubID string, period string, tag string) error

DeleteTag deletes a tag for the application period

func (*Database) DeleteUser

func (db *Database) DeleteUser(email string) error

DeleteUser deletes a user from the database with the given email

func (*Database) GetAllClubUsers

func (db *Database) GetAllClubUsers(id string) ([]*models.ClubUser, error)

GetAllClubUsers returns a list of ClubUsers associated with a club

func (*Database) GetApplicant

func (db *Database) GetApplicant(clubID string, period string, email string) (*models.Applicant, error)

GetApplicant returns an applicant for a application period

func (*Database) GetApplicants

func (db *Database) GetApplicants(clubID string, period string) ([]*models.Applicant, error)

GetApplicants returns all the applicants for an application period

func (*Database) GetApplication

func (db *Database) GetApplication(clubID string, period string, eventID string, email string) (*models.Application, error)

GetApplication returns the application for an event by applicant email

func (*Database) GetApplications

func (db *Database) GetApplications(clubID string, period string, eventID string) ([]*models.Application, error)

GetApplications returns all the applications for an event

func (*Database) GetClub

func (db *Database) GetClub(id string) (*models.Club, error)

GetClub returns a club with the given id

func (*Database) GetEmailVerification

func (db *Database) GetEmailVerification(email string, hash string) (*models.EmailVerification, error)

GetEmailVerification returns a pending email verification from the database with the given email and hash

func (*Database) GetEvent

func (db *Database) GetEvent(clubID string, period string, eventID string) (*models.EventProps, error)

GetEvent returns an event from the database

func (*Database) GetEvents

func (db *Database) GetEvents(clubID string, period string) ([]*models.EventProps, error)

GetEvents returns all the events of an application period

func (*Database) GetTags

func (db *Database) GetTags(clubID string, period string) ([]*models.Tag, error)

GetTags returns all the tags for an application period

func (*Database) GetUser

func (db *Database) GetUser(email string) (*models.User, error)

GetUser returns a user from the database with the given email

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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