database

package
v0.0.0-...-d61e0a5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearKey

func ClearKey(key string) error

ClearKey removes the given key's row from the database

func CreateOAuthToken

func CreateOAuthToken() error

CreateOAuthToken inserts a new OAuth token into the database

func CreateUser

func CreateUser(_newUser User) error

CreateUser stores a new user in the database

func GetKey

func GetKey(key string) (string, error)

GetKey fetches the given key's value from the database

func MgoRequest

func MgoRequest(collection string, s func(*mgo.Collection) error) error

MgoRequest will interact with the database

func SetKey

func SetKey(key string, value string) error

SetKey updates or inserts a key with the provided value

func UpdateUser

func UpdateUser(_existingUser User) error

UpdateUser updates an existing user in the database

Types

type NotificationProposalStarted

type NotificationProposalStarted struct {
	TwitterID         string    `json:"twitter_id" bson:"twitter_id"`
	LiveMode          bool      `json:"live_mode" bson:"live_mode"`
	RepositoryHash    string    `json:"repository_hash" bson:"repository_hash"`
	RepositoryName    string    `json:"repository_name" bson:"repository_name"`
	KNWVoteID         int       `json:"knw_vote_id" bson:"knw_vote_id"`
	KnowledgeLabel    string    `json:"knowledge_label" bson:"knowledge_label"`
	ProposerTwitterID string    `json:"proposer_twitter_id" bson:"proposer_twitter_id"`
	ProposerGithubID  string    `json:"proposer_github_handle" bson:"proposer_github_handle"`
	Description       string    `json:"description" bson:"description"`
	Identifier        string    `json:"identifier" bson:"identifier"`
	CommitUntil       time.Time `json:"commit_until" bson:"commit_until"`
	RevealUntil       time.Time `json:"reveal_until" bson:"reveal_until"`
}

NotificationProposalStarted struct

type OAuthToken

type OAuthToken struct {
	TwitterHandle    string    `bson:"twitter_handle"`
	TwitterID        int64     `bson:"twitter_id"`
	OAuthToken       string    `bson:"oauth_token"`
	OAuthTokenSecret string    `bson:"oauth_token_secret"`
	CreatedAt        time.Time `bson:"created_at"`
}

OAuthToken stores the data required to control the two bots which act as the frontend for our TCR. This table should only have two rows, one for the TCR Bot and one for the VIP bot.

func FindOAuthTokenByHandle

func FindOAuthTokenByHandle(handle string) (*OAuthToken, error)

FindOAuthTokenByHandle returns an OAuth token given a twitter handle

func (*OAuthToken) Save

func (token *OAuthToken) Save() error

Save saves the OAuthToken to the database

type User

type User struct {
	TwitterID               string    `bson:"twitter_id"`
	TwitterScreenName       string    `bson:"twitter_screen_name"`
	ETHAddress              string    `bson:"eth_address"`
	PassedKYCDemo           bool      `bson:"passed_kyc_demo"`
	PassedKYCLive           bool      `bson:"passed_kyc_live"`
	SkipKYC                 bool      `bson:"skip_kyc"`
	DateOfContact           time.Time `bson:"date_of_contact"`
	HasUsedClient           bool      `bson:"used_client"`
	HasBeenAskedForFeedback bool      `bson:"asked_for_feedback"`
	HasProvidedFeedback     bool      `bson:"provided_feedback"`
}

User struct for a twitter user

func GetUser

func GetUser(_twitterID string) (*User, error)

GetUser returns a user object when the user exists

func GetUsersForFeedback

func GetUsersForFeedback() ([]User, error)

GetUsersForFeedback returns an array of users that passed the KYC but haven't provided feedback yet

Jump to

Keyboard shortcuts

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