edit

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedEdit = fmt.Errorf("votes can only be cast on pending edits")
View Source
var ErrEditAlreadyApplied = errors.New("edit already applied")
View Source
var ErrEditNotFound = errors.New("edit not found")
View Source
var ErrEntityDeleted = errors.New("entity is deleted")
View Source
var ErrEntityNotFound = errors.New("entity not found")
View Source
var ErrInvalidDraft = errors.New("invalid draft id")
View Source
var ErrInvalidImage = errors.New("invalid image id")
View Source
var ErrInvalidPerformer = errors.New("invalid performer id")
View Source
var ErrInvalidSite = errors.New("invalid url site id")
View Source
var ErrInvalidStudio = errors.New("invalid studio id")
View Source
var ErrInvalidTag = errors.New("invalid tag id")
View Source
var ErrInvalidVoteStatus = errors.New("invalid vote status")
View Source
var ErrMergeIDMissing = errors.New("merge target ID is required")
View Source
var ErrMergeTargetIsSource = errors.New("merge target cannot be used as source")
View Source
var ErrNoChanges = errors.New("edit contains no changes")
View Source
var ErrNoMergeSources = errors.New("no merge sources found")
View Source
var ErrSceneDraftRequired = fmt.Errorf("scenes have to be submitted through drafts")
View Source
var ErrUnauthorizedBot = fmt.Errorf("you do not have permission to submit bot edits")
View Source
var ErrUnauthorizedUpdate = fmt.Errorf("only the creator can update edits")
View Source
var ErrUpdateLimit = fmt.Errorf("edit update limit reached")

Functions

This section is empty.

Types

type Edit

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

Edit handles edit-related operations

func NewEdit

func NewEdit(queries *queries.Queries, withTxn queries.WithTxnFunc) *Edit

NewEdit creates a new edit service

func (*Edit) Apply

func (s *Edit) Apply(ctx context.Context, input models.ApplyEditInput) (*models.Edit, error)

func (*Edit) ApplyEdit

func (s *Edit) ApplyEdit(ctx context.Context, editID uuid.UUID, immediate bool) (*models.Edit, error)

func (*Edit) Cancel

func (s *Edit) Cancel(ctx context.Context, input models.CancelEditInput) (*models.Edit, error)

func (*Edit) CloseCompleted

func (s *Edit) CloseCompleted(ctx context.Context) ([]*models.Edit, error)

func (*Edit) CloseEdit

func (s *Edit) CloseEdit(ctx context.Context, editID uuid.UUID, status models.VoteStatusEnum) (*models.Edit, error)

func (*Edit) CreateComment

func (s *Edit) CreateComment(ctx context.Context, input models.EditCommentInput) (*models.Edit, *models.EditComment, error)

func (*Edit) CreatePerformerEdit

func (s *Edit) CreatePerformerEdit(ctx context.Context, input models.PerformerEditInput) (*models.Edit, error)

func (*Edit) CreateSceneEdit

func (s *Edit) CreateSceneEdit(ctx context.Context, input models.SceneEditInput) (*models.Edit, error)

func (*Edit) CreateStudioEdit

func (s *Edit) CreateStudioEdit(ctx context.Context, input models.StudioEditInput) (*models.Edit, error)

func (*Edit) CreateTagEdit

func (s *Edit) CreateTagEdit(ctx context.Context, input models.TagEditInput) (*models.Edit, error)

func (*Edit) CreateVote

func (s *Edit) CreateVote(ctx context.Context, input models.EditVoteInput) (*models.Edit, error)

func (*Edit) Delete

func (s *Edit) Delete(ctx context.Context, id uuid.UUID) (bool, error)

func (*Edit) FindByID

func (s *Edit) FindByID(ctx context.Context, id uuid.UUID) (*models.Edit, error)

func (*Edit) FindByPerformerID

func (s *Edit) FindByPerformerID(ctx context.Context, performerID uuid.UUID) ([]models.Edit, error)

func (*Edit) FindBySceneID

func (s *Edit) FindBySceneID(ctx context.Context, sceneID uuid.UUID) ([]models.Edit, error)

func (*Edit) FindByStudioID

func (s *Edit) FindByStudioID(ctx context.Context, studioID uuid.UUID) ([]models.Edit, error)

func (*Edit) FindByTagID

func (s *Edit) FindByTagID(ctx context.Context, tagID uuid.UUID) ([]models.Edit, error)

func (*Edit) FindPendingPerformerCreation

func (s *Edit) FindPendingPerformerCreation(ctx context.Context, input models.QueryExistingPerformerInput) ([]models.Edit, error)

func (*Edit) FindPendingSceneCreation

func (s *Edit) FindPendingSceneCreation(ctx context.Context, input models.QueryExistingSceneInput) ([]models.Edit, error)

func (*Edit) GetComments

func (s *Edit) GetComments(ctx context.Context, editID uuid.UUID) ([]models.EditComment, error)

func (*Edit) GetEditTarget

func (s *Edit) GetEditTarget(ctx context.Context, id uuid.UUID) (models.EditTarget, error)

func (*Edit) GetMergeSources

func (s *Edit) GetMergeSources(ctx context.Context, mergeIDs []uuid.UUID, targetType string) ([]models.EditTarget, error)

func (*Edit) GetMergedImages

func (s *Edit) GetMergedImages(ctx context.Context, id uuid.UUID) ([]models.Image, error)

func (*Edit) GetMergedPerformerAliases

func (s *Edit) GetMergedPerformerAliases(ctx context.Context, id uuid.UUID) ([]string, error)

func (*Edit) GetMergedPerformerPiercings

func (s *Edit) GetMergedPerformerPiercings(ctx context.Context, id uuid.UUID) ([]models.BodyModification, error)

func (*Edit) GetMergedPerformerTattoos

func (s *Edit) GetMergedPerformerTattoos(ctx context.Context, id uuid.UUID) ([]models.BodyModification, error)

func (*Edit) GetMergedPerformers

func (s *Edit) GetMergedPerformers(ctx context.Context, id uuid.UUID) ([]models.PerformerAppearance, error)

func (*Edit) GetMergedStudioAliases

func (s *Edit) GetMergedStudioAliases(ctx context.Context, id uuid.UUID) ([]string, error)

func (*Edit) GetMergedTags

func (s *Edit) GetMergedTags(ctx context.Context, id uuid.UUID) ([]models.Tag, error)

func (*Edit) GetMergedURLs

func (s *Edit) GetMergedURLs(ctx context.Context, id uuid.UUID) ([]models.URL, error)

func (*Edit) GetVotes

func (s *Edit) GetVotes(ctx context.Context, editID uuid.UUID) ([]models.EditVote, error)

func (*Edit) LoadCommentsByIds

func (s *Edit) LoadCommentsByIds(ctx context.Context, ids []uuid.UUID) ([]*models.EditComment, []error)

func (*Edit) LoadIds

func (s *Edit) LoadIds(ctx context.Context, ids []uuid.UUID) ([]*models.Edit, []error)

func (*Edit) PromoteUserVoteRights

func (s *Edit) PromoteUserVoteRights(ctx context.Context, userID uuid.UUID, threshold int) error

func (*Edit) QueryCount

func (s *Edit) QueryCount(ctx context.Context, filter models.EditQueryInput) (int, error)

func (*Edit) QueryEdits

func (s *Edit) QueryEdits(ctx context.Context, filter models.EditQueryInput) ([]models.Edit, error)

func (*Edit) ResolveVotingThreshold

func (s *Edit) ResolveVotingThreshold(ctx context.Context, edit *models.Edit) (models.VoteStatusEnum, error)

func (*Edit) UpdatePerformerEdit

func (s *Edit) UpdatePerformerEdit(ctx context.Context, id uuid.UUID, input models.PerformerEditInput) (*models.Edit, error)

func (*Edit) UpdateSceneEdit

func (s *Edit) UpdateSceneEdit(ctx context.Context, id uuid.UUID, input models.SceneEditInput) (*models.Edit, error)

func (*Edit) UpdateStudioEdit

func (s *Edit) UpdateStudioEdit(ctx context.Context, id uuid.UUID, input models.StudioEditInput) (*models.Edit, error)

func (*Edit) UpdateTagEdit

func (s *Edit) UpdateTagEdit(ctx context.Context, id uuid.UUID, input models.TagEditInput) (*models.Edit, error)

type InputSpecifiedFunc

type InputSpecifiedFunc func(qualifiedField string) bool

InputSpecifiedFunc is function that returns true if the qualified field name was specified in the input. Used to distinguish between nil/empty fields and unspecified fields

type PerformerEditProcessor

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

func Performer

func Performer(ctx context.Context, queries *queries.Queries, edit *models.Edit) *PerformerEditProcessor

func (*PerformerEditProcessor) ApplyEdit

func (m *PerformerEditProcessor) ApplyEdit(performer *models.Performer, create bool, data *models.PerformerEditData) error

func (*PerformerEditProcessor) CreateComment

func (m *PerformerEditProcessor) CreateComment(user *models.User, comment *string) error

func (*PerformerEditProcessor) CreateEdit

func (m *PerformerEditProcessor) CreateEdit() (*models.Edit, error)

func (*PerformerEditProcessor) CreateJoin

func (*PerformerEditProcessor) Edit

func (*PerformerEditProcessor) MergeInto

func (m *PerformerEditProcessor) MergeInto(source *models.Performer, target *models.Performer, setAliases bool) error

func (*PerformerEditProcessor) SoftDelete

func (m *PerformerEditProcessor) SoftDelete(performer models.Performer) (*models.Performer, error)

func (*PerformerEditProcessor) UpdateEdit

func (m *PerformerEditProcessor) UpdateEdit() (*models.Edit, error)

func (*PerformerEditProcessor) UpdateScenePerformerAlias

func (m *PerformerEditProcessor) UpdateScenePerformerAlias(performerID uuid.UUID, oldName string, newName string) error

func (*PerformerEditProcessor) UpdateScenePerformers

func (m *PerformerEditProcessor) UpdateScenePerformers(oldPerformer *models.Performer, newTarget *models.Performer, setAliases bool) error

type SceneEditProcessor

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

func Scene

func Scene(ctx context.Context, queries *queries.Queries, edit *models.Edit) *SceneEditProcessor

func (*SceneEditProcessor) ApplyEdit

func (m *SceneEditProcessor) ApplyEdit(scene *models.Scene, create bool, data *models.SceneEditData, userID *uuid.UUID) error

func (*SceneEditProcessor) CreateComment

func (m *SceneEditProcessor) CreateComment(user *models.User, comment *string) error

func (*SceneEditProcessor) CreateEdit

func (m *SceneEditProcessor) CreateEdit() (*models.Edit, error)

func (*SceneEditProcessor) CreateJoin

func (m *SceneEditProcessor) CreateJoin(input models.SceneEditInput) error

func (*SceneEditProcessor) Edit

func (m *SceneEditProcessor) Edit(input models.SceneEditInput, inputArgs utils.ArgumentsQuery, update bool) error

func (*SceneEditProcessor) MergeInto

func (m *SceneEditProcessor) MergeInto(source queries.Scene, target queries.Scene) error

func (*SceneEditProcessor) UpdateEdit

func (m *SceneEditProcessor) UpdateEdit() (*models.Edit, error)

type StudioEditProcessor

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

func Studio

func Studio(ctx context.Context, queries *queries.Queries, edit *models.Edit) *StudioEditProcessor

func (*StudioEditProcessor) CreateComment

func (m *StudioEditProcessor) CreateComment(user *models.User, comment *string) error

func (*StudioEditProcessor) CreateEdit

func (m *StudioEditProcessor) CreateEdit() (*models.Edit, error)

func (*StudioEditProcessor) CreateJoin

func (m *StudioEditProcessor) CreateJoin(input models.StudioEditInput) error

func (*StudioEditProcessor) Edit

func (*StudioEditProcessor) UpdateEdit

func (m *StudioEditProcessor) UpdateEdit() (*models.Edit, error)

type TagEditProcessor

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

func Tag

func Tag(ctx context.Context, queries *queries.Queries, edit *models.Edit) *TagEditProcessor

func (*TagEditProcessor) CreateComment

func (m *TagEditProcessor) CreateComment(user *models.User, comment *string) error

func (*TagEditProcessor) CreateEdit

func (m *TagEditProcessor) CreateEdit() (*models.Edit, error)

func (*TagEditProcessor) CreateJoin

func (m *TagEditProcessor) CreateJoin(input models.TagEditInput) error

func (*TagEditProcessor) Edit

func (m *TagEditProcessor) Edit(input models.TagEditInput, inputArgs utils.ArgumentsQuery) error

func (*TagEditProcessor) UpdateEdit

func (m *TagEditProcessor) UpdateEdit() (*models.Edit, error)

Jump to

Keyboard shortcuts

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