service

package
v0.0.0-...-79683fd Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 37 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapAuthToken

func MapAuthToken(token *authToken) map[string]string

func NewAuthTokenProvider

func NewAuthTokenProvider() *authTokenProvider

func NewValidator

func NewValidator(validatorServerURL string) *curationValidator

func ParseAuthToken

func ParseAuthToken(value map[string]string) (*authToken, error)

ParseAuthToken parses map into token

Types

type AuthTokenizer

type AuthTokenizer interface {
	CreateAuthToken(userID int64) (*authToken, error)
}

type Clock

type Clock interface {
	Now() time.Time
	Unix(sec int64, nsec int64) time.Time
}

type MultipartFileProvider

type MultipartFileProvider interface {
	Filename() string
	Size() int64
	Open() (multipart.File, error)
}

type MultipartFileWrapper

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

func NewMutlipartFileWrapper

func NewMutlipartFileWrapper(fileHeader *multipart.FileHeader) *MultipartFileWrapper

func (*MultipartFileWrapper) Filename

func (m *MultipartFileWrapper) Filename() string

func (*MultipartFileWrapper) Open

func (*MultipartFileWrapper) Size

func (m *MultipartFileWrapper) Size() int64

type RealClock

type RealClock struct {
}

func (*RealClock) Now

func (r *RealClock) Now() time.Time

func (*RealClock) Unix

func (r *RealClock) Unix(sec int64, nsec int64) time.Time

type SiteService

type SiteService struct {
	SSK SubmissionStatusKeeper
	// contains filtered or unexported fields
}

func New

func New(l *logrus.Entry, db *sql.DB, authBotSession, notificationBotSession *discordgo.Session,
	flashpointServerID, notificationChannelID, curationFeedChannelID, validatorServerURL string,
	sessionExpirationSeconds int64, submissionsDir, submissionImagesDir, flashfreezeDir string, isDev bool, rsu *resumableuploadservice.ResumableUploadService, archiveIndexerServerURL, flashfreezeIngestDir, fixesDir string) *SiteService

func (*SiteService) CreateFixFirstStep

func (s *SiteService) CreateFixFirstStep(ctx context.Context, uid int64, c *types.CreateFixFirstStep) (int64, error)

func (*SiteService) DeleteUserSessions

func (s *SiteService) DeleteUserSessions(ctx context.Context, uid int64) (int64, error)

func (*SiteService) GetBasePageData

func (s *SiteService) GetBasePageData(ctx context.Context) (*types.BasePageData, error)

GetBasePageData loads base user data, does not return error if user is not logged in

func (*SiteService) GetCurationImage

func (s *SiteService) GetCurationImage(ctx context.Context, ciid int64) (*types.CurationImage, error)

func (*SiteService) GetFixByID

func (s *SiteService) GetFixByID(ctx context.Context, fid int64) (*types.Fix, error)

func (*SiteService) GetFixesFiles

func (s *SiteService) GetFixesFiles(ctx context.Context, ffids []int64) ([]*types.FixesFile, error)

func (*SiteService) GetFlashfreezeRootFile

func (s *SiteService) GetFlashfreezeRootFile(ctx context.Context, fid int64) (*types.FlashfreezeFile, error)

func (*SiteService) GetNextSubmission

func (s *SiteService) GetNextSubmission(ctx context.Context, sid int64) (*int64, error)

func (*SiteService) GetPreviousSubmission

func (s *SiteService) GetPreviousSubmission(ctx context.Context, sid int64) (*int64, error)

func (*SiteService) GetProfilePageData

func (s *SiteService) GetProfilePageData(ctx context.Context, uid int64) (*types.ProfilePageData, error)

func (*SiteService) GetSearchFixesData

func (s *SiteService) GetSearchFixesData(ctx context.Context, filter *types.FixesFilter) (*types.SearchFixesPageData, error)

func (*SiteService) GetSearchFlashfreezeData

func (s *SiteService) GetSearchFlashfreezeData(ctx context.Context, filter *types.FlashfreezeFilter) (*types.SearchFlashfreezePageData, error)

func (*SiteService) GetStatisticsPageData

func (s *SiteService) GetStatisticsPageData(ctx context.Context) (*types.StatisticsPageData, error)

func (*SiteService) GetSubmissionFiles

func (s *SiteService) GetSubmissionFiles(ctx context.Context, sfids []int64) ([]*types.SubmissionFile, error)

func (*SiteService) GetSubmissionsFilesPageData

func (s *SiteService) GetSubmissionsFilesPageData(ctx context.Context, sid int64) (*types.SubmissionsFilesPageData, error)

func (*SiteService) GetSubmissionsPageData

func (s *SiteService) GetSubmissionsPageData(ctx context.Context, filter *types.SubmissionsFilter) (*types.SubmissionsPageData, error)

func (*SiteService) GetUIDFromSession

func (s *SiteService) GetUIDFromSession(ctx context.Context, key string) (int64, bool, error)

func (*SiteService) GetUserRoles

func (s *SiteService) GetUserRoles(ctx context.Context, uid int64) ([]string, error)

func (*SiteService) GetUserStatistics

func (s *SiteService) GetUserStatistics(ctx context.Context, uid int64) (*types.UserStatistics, error)

func (*SiteService) GetUsers

func (s *SiteService) GetUsers(ctx context.Context) ([]*types.User, error)

func (*SiteService) GetViewFixPageData

func (s *SiteService) GetViewFixPageData(ctx context.Context, fid int64) (*types.ViewFixPageData, error)

func (*SiteService) GetViewSubmissionPageData

func (s *SiteService) GetViewSubmissionPageData(ctx context.Context, uid, sid int64) (*types.ViewSubmissionPageData, error)

func (*SiteService) IndexUnindexedFlashfreezeItems

func (s *SiteService) IndexUnindexedFlashfreezeItems(l *logrus.Entry)

func (*SiteService) IngestFlashfreezeItems

func (s *SiteService) IngestFlashfreezeItems(l *logrus.Entry)

func (*SiteService) IngestUnknownFlashfreezeItems

func (s *SiteService) IngestUnknownFlashfreezeItems(l *logrus.Entry)

func (*SiteService) IsChunkReceived

func (s *SiteService) IsChunkReceived(ctx context.Context, resumableParams *types.ResumableParams) (bool, error)

func (*SiteService) Logout

func (s *SiteService) Logout(ctx context.Context, secret string) error

func (*SiteService) OverrideBot

func (s *SiteService) OverrideBot(ctx context.Context, sid int64) error

func (*SiteService) ProduceRemindersAboutRequestedChanges

func (s *SiteService) ProduceRemindersAboutRequestedChanges(ctx context.Context) (int, error)

ProduceRemindersAboutRequestedChanges generates notifications for every user with submissions which are waiting for changes more than a month

func (*SiteService) ReceiveComments

func (s *SiteService) ReceiveComments(ctx context.Context, uid int64, sids []int64, formAction, formMessage, formIgnoreDupeActions string) error

func (*SiteService) ReceiveFixesChunk

func (s *SiteService) ReceiveFixesChunk(ctx context.Context, fixID int64, resumableParams *types.ResumableParams, chunk []byte) error

func (*SiteService) ReceiveFlashfreezeChunk

func (s *SiteService) ReceiveFlashfreezeChunk(ctx context.Context, resumableParams *types.ResumableParams, chunk []byte) (*int64, error)

func (*SiteService) ReceiveSubmissionChunk

func (s *SiteService) ReceiveSubmissionChunk(ctx context.Context, sid *int64, resumableParams *types.ResumableParams, chunk []byte) (*string, error)

func (*SiteService) RecomputeSubmissionCacheAll

func (s *SiteService) RecomputeSubmissionCacheAll(ctx context.Context)

func (*SiteService) RunNotificationConsumer

func (s *SiteService) RunNotificationConsumer(logger *logrus.Entry, ctx context.Context, wg *sync.WaitGroup)

func (*SiteService) SaveUser

func (s *SiteService) SaveUser(ctx context.Context, discordUser *types.DiscordUser) (*authToken, error)

func (*SiteService) SearchSubmissions

func (s *SiteService) SearchSubmissions(ctx context.Context, filter *types.SubmissionsFilter) ([]*types.ExtendedSubmission, int64, error)

func (*SiteService) SoftDeleteComment

func (s *SiteService) SoftDeleteComment(ctx context.Context, cid int64, deleteReason string) error

func (*SiteService) SoftDeleteSubmission

func (s *SiteService) SoftDeleteSubmission(ctx context.Context, sid int64, deleteReason string) error

func (*SiteService) SoftDeleteSubmissionFile

func (s *SiteService) SoftDeleteSubmissionFile(ctx context.Context, sfid int64, deleteReason string) error

func (*SiteService) UpdateMasterDB

func (s *SiteService) UpdateMasterDB(ctx context.Context) error

func (*SiteService) UpdateNotificationSettings

func (s *SiteService) UpdateNotificationSettings(ctx context.Context, uid int64, notificationActions []string) error

func (*SiteService) UpdateSubscriptionSettings

func (s *SiteService) UpdateSubscriptionSettings(ctx context.Context, uid, sid int64, subscribe bool) error

type SubmissionStatusKeeper

type SubmissionStatusKeeper struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*SubmissionStatusKeeper) Get

func (*SubmissionStatusKeeper) SetCopying

func (s *SubmissionStatusKeeper) SetCopying(tempName string, message string)

func (*SubmissionStatusKeeper) SetFailed

func (s *SubmissionStatusKeeper) SetFailed(tempName, message string)

func (*SubmissionStatusKeeper) SetFinalizing

func (s *SubmissionStatusKeeper) SetFinalizing(tempName string)

func (*SubmissionStatusKeeper) SetReceived

func (s *SubmissionStatusKeeper) SetReceived(tempName string)

func (*SubmissionStatusKeeper) SetSuccess

func (s *SubmissionStatusKeeper) SetSuccess(tempName string, sid int64)

func (*SubmissionStatusKeeper) SetValidating

func (s *SubmissionStatusKeeper) SetValidating(tempName string)

type Validator

type Validator interface {
	Validate(ctx context.Context, file io.Reader, filename string) (*types.ValidatorResponse, error)
	GetTags(ctx context.Context) ([]types.Tag, error)
	ProvideArchiveForValidation(filePath string) (*types.ValidatorResponse, error)
}

Jump to

Keyboard shortcuts

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