moderation

package
v0.0.0-...-6d1ceae Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Airtable schema
	Name         = "Name"
	Description  = "Description"
	Text         = "Text"
	Lang         = "Lang"
	Servings     = "Servings"
	Time         = "Time"
	Tags         = "Tags"
	Ingredients  = "Ingredients"
	Equipment    = "Equipment"
	Rating       = "Rating"
	Ideas        = "Ideas"
	Sources      = "Sources"
	Instructions = "Instructions"
	Nutrition    = "Nutrition"
	Moderation   = "Moderation"
	Error        = "Error"
	Meta         = "Meta"
	BaseSource   = "Source"
)
View Source
const (
	// Moderation statuses
	// NB: for moderation statuses that are supposed to be queried by the store
	// a view with the same name should be created in the Airtable base
	ModerationStatusPending     = "pending"
	ModerationStatusApproved    = "approved"
	ModerationStatusRejected    = "rejected"
	ModerationStatusNeedsChange = "needsChange"
	ModerationStatusFinished    = "finished"
	ModerationStatusErrored     = "errored"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AirtableModerationStore

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

func NewAirtableModerationStore

func NewAirtableModerationStore(cfg Config, log logger.Logger) (*AirtableModerationStore, error)

func (*AirtableModerationStore) Get

func (s *AirtableModerationStore) Get(
	ctx context.Context,
	moderationStatus string,
) ([]RecipeModerationInstance, error)

func (*AirtableModerationStore) GetApproved

func (*AirtableModerationStore) Save

func (s *AirtableModerationStore) Save(ctx context.Context, recipes []*recipe.Recipe) error

type Config

type Config struct {
	APIKey string
	BaseID string
	Table  string
}

type ModerationStore

type ModerationStore interface {
	Get(ctx context.Context, moderationStatus string) ([]RecipeModerationInstance, error)
	GetApproved(ctx context.Context) ([]RecipeModerationInstance, error)
	Save(ctx context.Context, recipes []*recipe.Recipe) error
}

type RecipeModerationInstance

type RecipeModerationInstance interface {
	Recipe() *recipe.Recipe
	Approve(context.Context) error
	Reject(context.Context) error
	NeedsChange(context.Context) error
	Finish(context.Context) error
	Errored(context.Context, error) error
}

Jump to

Keyboard shortcuts

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