port

package
v0.0.0-...-06621f0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	VerifyAppIDToken(string) (*model.AppIDToken, error)
	RefreshAppIDToken(ctx context.Context, tokenString string) (newToken *model.AppIDToken, newTokenString string, err error)
	StartGoogleSignIn(context.Context, *http.Request) (redirectURL string, err error)
	FinishGoogleSignIn(context.Context, *http.Request) (redirectURL, appToken string, err error)
}

type CollaborationRepository

type CollaborationRepository interface {
	Find(ctx context.Context, memoID, userID uuid.UUID) (*ent.Collaboration, error)
	Create(ctx context.Context, memoID, userID uuid.UUID) (*ent.Collaboration, error)
	UpdateApprovedStatus(ctx context.Context, memoID, userID uuid.UUID, approve bool) (*ent.Collaboration, error)
	Delete(ctx context.Context, memoID, userID uuid.UUID) error
	DeleteAllByMemoID(
		ctx context.Context,
		memoID uuid.UUID,
	) (count int, err error)
}

type GoogleClient

type GoogleClient interface {
	ExchangeAuthCode(ctx context.Context, code, redirectURI string) (model.GoogleTokenResponse, error)
}

type JWTClient

type JWTClient interface {
	ParseGoogleIDTokenUnverified(tokenString string) (*model.GoogleIDToken, error)
	SignAppIDToken(*model.AppIDToken) (token *model.AppIDToken, tokenString string, err error)
	VerifyAppIDToken(tokenString string) (*model.AppIDToken, error)
}

type KVRepository

type KVRepository interface {
	Get(ctx context.Context, key string) (string, error)
	GetThenDelete(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key, val string, exp time.Duration) error
	Delete(ctx context.Context, keys ...string) (delCount int64, err error)
}

type MemoRepository

type MemoRepository interface {
	FindByID(ctx context.Context, memoID uuid.UUID) (*ent.Memo, error)
	FindByIDWithEdges(ctx context.Context, memoID uuid.UUID) (*ent.Memo, error)
	FindAllByUserIDWithEdges(
		ctx context.Context, userID uuid.UUID,
		sortParams model.MemoSortParams, pageParams model.PaginationParams) ([]*ent.Memo, error)
	FindAllByUserIDAndTagNamesWithEdges(
		ctx context.Context, userID uuid.UUID, tags []string,
		sortParams model.MemoSortParams, pageParams model.PaginationParams) ([]*ent.Memo, error)
	CountByUserIDAndTagNames(ctx context.Context, userID uuid.UUID, tags []string) (int, error)
	Create(ctx context.Context, memo *ent.Memo, userID uuid.UUID, tagIDs []int) (*ent.Memo, error)
	Update(context.Context, *ent.Memo) (*ent.Memo, error)
	UpdateIsPublish(ctx context.Context, memoID uuid.UUID, isPublish bool) (*ent.Memo, error)
	Delete(ctx context.Context, memoID uuid.UUID) error

	ReplaceTags(ctx context.Context, memoID uuid.UUID, tagIDs []int, updateTime bool) error

	RegisterSubscriber(ctx context.Context, memoID, userID uuid.UUID) error
	UnregisterSubscriber(ctx context.Context, memoID, userID uuid.UUID) error
	ClearSubscribers(ctx context.Context, memoID uuid.UUID) error
}

type MemoService

type MemoService interface {
	GetMemo(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) (*ent.Memo, error)
	ListMemos(
		ctx context.Context, userID uuid.UUID, tags []string,
		sortParams model.MemoSortParams, pageParams model.PaginationParams) (memos []*ent.Memo, totalCount int, err error)
	CreateMemo(ctx context.Context, memo *ent.Memo, tagNames []string, userID uuid.UUID) (*ent.Memo, error)
	UpdateMemo(
		ctx context.Context, memo *ent.Memo, tagNames []string,
		requester *model.AppIDToken, isPinUpdateTime bool) (*ent.Memo, error)
	UpdateMemoPublishedState(
		ctx context.Context, memoID uuid.UUID, publish bool, requester *model.AppIDToken) (*ent.Memo, error)
	DeleteMemo(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) error

	ListTags(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) ([]*ent.Tag, error)
	SearchTags(ctx context.Context, keyword string, requester *model.AppIDToken) ([]*ent.Tag, error)
	ReplaceTags(ctx context.Context, memoID uuid.UUID, tagNames []string, requester *model.AppIDToken) ([]*ent.Tag, error)
	DeleteOrphanTags(context.Context) (count int, err error)

	ListSubscribers(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) (*model.ListSubscribersResponse, error)
	SubscribeMemo(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) error
	UnsubscribeMemo(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) error

	ListCollaborators(
		ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) (*model.ListCollaboratorsResponse, error)
	RegisterCollaborator(ctx context.Context, memoID uuid.UUID, requester *model.AppIDToken) error
	AuthorizeCollaborator(
		ctx context.Context, memoID, collaboratorID uuid.UUID, approve bool, requester *model.AppIDToken) error
	DeleteCollaborator(ctx context.Context, memoID, collaboratorID uuid.UUID, requester *model.AppIDToken) error
}

type Pinger

type Pinger interface {
	Name() string
	Ping(context.Context) error
}

type TagRepository

type TagRepository interface {
	FindAllByMemoID(ctx context.Context, memoID uuid.UUID) ([]*ent.Tag, error)
	FindAllByUserIDAndNameContains(ctx context.Context, userID uuid.UUID, name string) ([]*ent.Tag, error)
	CreateIfNotExist(ctx context.Context, tagName string) (*ent.Tag, error)
	DeleteAllWithoutMemo(ctx context.Context, excludes []string) (count int, err error)
}

type TransactionManager

type TransactionManager interface {
	BeginTx(context.Context) (ctxWithTx context.Context, commit, rollback func() error)
	WithTx(context.Context, func(ctxWithTx context.Context) error) error
}

type UserRepository

type UserRepository interface {
	FindByID(ctx context.Context, userID uuid.UUID) (*ent.User, error)
	FindByEmail(ctx context.Context, email string) (*ent.User, error)
	FindAllBySubscribingMemoID(ctx context.Context, memoID uuid.UUID) ([]*ent.User, error)
	FindAllByCollaboratingMemoIDWithEdges(ctx context.Context, memoID uuid.UUID) ([]*ent.User, error)
	Upsert(context.Context, *ent.User) (*ent.User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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