controllers

package
v0.0.0-...-c89eb6e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Crescendo   string = "crescendo"
	Flat        string = "flat"
	Decrescendo string = "decrescendo"
)

Variables

View Source
var (
	ErrUserEmailAlreadyExist = errors.New("a user with this mail already exists")
	ErrUserAlreadyVerified   = errors.New("this user has already been activated")
	ErrUserHasNoPasswd       = errors.New("user has no password")
	ErrUserVerifCodeExpired  = errors.New("verification code is expired")
)

Functions

func ApproveClaim

func ApproveClaim(userID, bountyOwnerID uint, claimID uint, ownerCheck models.ClaimCheck) error

func CheckUserVerifCode

func CheckUserVerifCode(verifCode string) error

func ClaimBounty

func ClaimBounty(claimerID uint, issueID uint, pullRequestURL string, claimDetails string, claimCheck models.ClaimCheck) error

func CreateBounty

func CreateBounty(bounty *models.Bounty) error

func CreateHost

func CreateHost(host models.Host) error

func CreateIdentity

func CreateIdentity(identity *models.Identity) error

func CreateIssue

func CreateIssue(issue models.Issue) (models.Issue, error)

func CreateIssueFromGitHub

func CreateIssueFromGitHub(url string) (*models.Issue, error)

func CreateOrganization

func CreateOrganization(organization models.Organization) error

func CreateRepository

func CreateRepository(repository models.Repository) error

func CreateStripeSetupIntent

func CreateStripeSetupIntent(bounty *models.Bounty, ownerID uint, bountyOwnerStripeID string, connectedAccountID string) (*stripe.SetupIntent, error)

func CreateUser

func CreateUser(user models.User) error

func CreateUserPassword

func CreateUserPassword(pwd, code string) error

func DeleteBounty

func DeleteBounty(bountyID, userID uint) error

func DeleteClaim

func DeleteClaim(claimID string) error

func DeleteHost

func DeleteHost(hostID string) error

func DeleteIssue

func DeleteIssue(issueID string) error

func DeleteOrganization

func DeleteOrganization(organizationID string) error

func DeleteRepository

func DeleteRepository(repositoryID string) error

func FinalizeBounty

func FinalizeBounty(bountyID string) error

func GenerateOAuthState

func GenerateOAuthState(userID uint, oAuthHost string) (string, error)

GenerateOAuthState generates an encrypted OAuth state

func GetAllUnconfirmedBounties

func GetAllUnconfirmedBounties() ([]models.Bounty, error)

func GetAllUsers

func GetAllUsers() ([]models.User, error)

func GetBounties

func GetBounties() ([]models.Bounty, error)

func GetBounty

func GetBounty(bountyID string) (models.Bounty, error)

func GetBountyByID

func GetBountyByID(bountyID uint) (models.Bounty, error)

func GetClaim

func GetClaim(claimID string) (models.Claim, error)

func GetClaimByCaimCheck

func GetClaimByCaimCheck(claimerCheckID uint) (models.Claim, error)

func GetClaims

func GetClaims() ([]models.Claim, error)

func GetCurrentBountyAmount

func GetCurrentBountyAmount(bountyID uint) (float64, error)

func GetExternalIdentityByUserIDAndHostID

func GetExternalIdentityByUserIDAndHostID(claimerID, hostID uint) (models.Identity, error)

func GetGitHubAvatarURL

func GetGitHubAvatarURL(username string) (string, error)

func GetHost

func GetHost(hostID string) (models.Host, error)

func GetHostFromAddress

func GetHostFromAddress(hostAddress string) (models.Host, error)

func GetHostIdentitiesFromAddress

func GetHostIdentitiesFromAddress(hostAddress string) ([]models.Identity, error)

func GetHosts

func GetHosts() ([]models.Host, error)

func GetIssue

func GetIssue(issueID string) (models.Issue, error)

func GetIssueBounties

func GetIssueBounties(issueID string) (models.Issue, error)

func GetIssueByID

func GetIssueByID(issueID uint) (models.Issue, error)

func GetIssueByURL

func GetIssueByURL(url string) (*models.Issue, error)

func GetIssueByUrl

func GetIssueByUrl(issueUrl string) (models.Issue, error)

func GetIssues

func GetIssues() ([]models.Issue, error)

func GetMyIssues

func GetMyIssues(userID uint) ([]models.Issue, error)

func GetOrCreateCustomerID

func GetOrCreateCustomerID(accessToken, stripeAccountID, email string) (string, error)

func GetOrganization

func GetOrganization(organizationID string) (models.Organization, error)

func GetOrganizations

func GetOrganizations() ([]models.Organization, error)

func GetPaymentMethods

func GetPaymentMethods(userID uint) ([]models.PaymentMethod, error)

func GetPublicBountiesByIssue

func GetPublicBountiesByIssue() ([]models.Issue, error)

func GetRepositories

func GetRepositories() ([]models.Repository, error)

func GetRepository

func GetRepository(repositoryID string) (models.Repository, error)

func GetUserByEmail

func GetUserByEmail(email string) (models.User, error)

func GetUserByID

func GetUserByID(id uint) (models.User, error)

func GetUserIdentities

func GetUserIdentities(userID uint) ([]models.Identity, error)

func ParseGitHubURL

func ParseGitHubURL(url string) (owner, repo string, err error)

First, let's add a method to extract owner and repo from the URL

func PayoutBounty

func PayoutBounty(bounty models.Bounty, bountyOwnerStripeCustomerID, bountyHunterStripeCustomerID, bountyHunterStripeAccountID string) error

func ProcessPayment

func ProcessPayment(claimerID uint, bountyID uint) error

func RemovePaymentMethod

func RemovePaymentMethod(userID uint, paymentMethodID string) error

func SavePaymentMethod

func SavePaymentMethod(userID uint, pm *stripe.PaymentMethod) error

func SaveStripeConnectedAccountID

func SaveStripeConnectedAccountID(stateUserID uint, stripeUserAccountID, stripeUserCustomerID string) error

func UpdateBounty

func UpdateBounty(bounty models.Bounty) error

func UpdateClaim

func UpdateClaim(claim models.Claim) error

func UpdateHost

func UpdateHost(host models.Host) error

func UpdateIssue

func UpdateIssue(issue models.Issue) error

func UpdateOrganization

func UpdateOrganization(organization models.Organization) error

func UpdateRepository

func UpdateRepository(repository models.Repository) error

func UpdateUserStripeID

func UpdateUserStripeID(id uint, stripeUserId string) error

func ValidateBountyData

func ValidateBountyData(bounty models.Bounty, variables []models.BountyVariable) error

Types

type GitHubController

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

func NewGitHubController

func NewGitHubController() *GitHubController

func (*GitHubController) FetchGitHubIssue

func (gc *GitHubController) FetchGitHubIssue(url string) (*models.GitHubIssue, error)

type GitHubUser

type GitHubUser struct {
	AvatarURL string `json:"avatar_url"`
}

type OAuthState

type OAuthState struct {
	State     string    `json:"state"`
	ExpiresAt time.Time `json:"expires_at"`
	UserID    uint      `json:"user_id"`
	OAuthHost string    `json:"oauth_host"`
}

func DecryptAndReadOAuthState

func DecryptAndReadOAuthState(encryptedState string, oAuthHost string) (*OAuthState, error)

DecryptAndReadOAuthState decrypts and parses the OAuth state

Jump to

Keyboard shortcuts

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