infrastructures

package
v0.0.0-...-adb56df Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthAdapter

type OAuthAdapter interface {
	GetByOauthClientID(ctx context.Context, id string) (*entities.OauthClient, error)
	GetOAuthClientRedirectURLsByOAuthClientID(ctx context.Context, oauthClientID string) (entities.OAuthClientRedirectURLList, error)
	CreateOAuthClient(ctx context.Context, client *entities.OauthClient, clientSecret string) (*entities.OauthClient, error)
	ExistOauthClient(ctx context.Context, id string) (bool, error)

	SetClientCredentialAccessToken(ctx context.Context, clientID, accessToken string, expireAt int64) error
	SetUserAccessToken(ctx context.Context, clientID, userID, accessToken string, scope entities.OauthScope, expireIn int64) error
	GetSession(ctx context.Context, accessToken string) (*entities.OauthSession, error)

	SetCode(ctx context.Context, code *entities.OAuthCode) error
	GetCode(ctx context.Context, code string) (*entities.OAuthCode, error)

	UpsertUserAuth(ctx context.Context, userAuth *entities.UserAuth) (*entities.UserAuth, error)
	GetUserAuth(ctx context.Context, userID, clientID string) (*entities.UserAuth, error)
	GetUserAuthByRefreshToken(ctx context.Context, refreshToken string) (*entities.UserAuth, error)
	DeleteUserAuth(ctx context.Context, userID, clientID string) error
	DeleteClientAllAuth(ctx context.Context, clientID string) error
}

func NewAuthAdapter

func NewAuthAdapter(
	oauthClientRepo repositories.OAuthClientRepository,
	oauthAccessTokenRepo repositories.OauthAccessTokenRepository,
	oauthClientRedirectURLRepo repositories.OAuthClientRedirectURLRepository,
	oauthCodeRepo repositories.OauthCodeRepository,
	userAuthRepository repositories.UserAuthRepository,
) OAuthAdapter

type PhotoAdapter

type PhotoAdapter interface {
	GetPhotoMetaByPhotoID(ctx context.Context, photoID int) (entities.PhotoMeta, error)
	GetPhotoMetaItemByPhotoIDTagID(ctx context.Context, photoID, tagID int) (*entities.PhotoMetaItem, error)
	GetPhotoByPhotoID(ctx context.Context, photoID int) (*entities.Photo, error)
	GetPhotos(ctx context.Context, limit, offset int) (entities.PhotoList, error)
	GetPhotoFileByPhotoFileID(ctx context.Context, photoFileID int) (*entities.PhotoFile, error)
	GetPhotoFileByFilePath(ctx context.Context, filePath string) (*entities.PhotoFile, error)
	GetPhotoFilesByPhotoID(ctx context.Context, photoID int) ([]*entities.PhotoFile, error)
	CountPhotos(ctx context.Context) (int, error)
	UpsertPhotoByFilePath(ctx context.Context, photo *entities.Photo) (*entities.Photo, error)
	ExistPhotoFileByFilePath(ctx context.Context, filePath string) (bool, error)
	UpsertPhotoMetaItemByPhotoTagID(ctx context.Context, photoID int, metaItem *entities.PhotoMetaItem) (*entities.PhotoMetaItem, error)
}

type PhotoStorageAdapter

type PhotoStorageAdapter interface {
	FindDirContents(dirPath string) ([]*entities.StorageFileInfo, error)
	LoadContent(path string) (entities.StorageFileData, error)
	ParsePhotoMeta(path string) (entities.PhotoMeta, error)
	SavePreview(ctx context.Context, photoID int, data []byte) error
	SaveThumbnail(ctx context.Context, photoID int, data []byte) error
	SavePhotoFile(ctx context.Context, userID, fileName string, dateTimeOriginal time.Time, data []byte) (*entities.StorageFileInfo, error)
	GenerateSignToSavePhoto(ctx context.Context, userID string, expireIn int64) (string, error)
	VerifySignToken(ctx context.Context, token string) (*entities.PhotoUploadInfo, error)
}

func NewPhotoStorageAdapter

func NewPhotoStorageAdapter(
	photoStorageRepo repositories.PhotoStorageRepository,
	thumbnailRepo repositories.PhotoThumbnailRepository,
	photoUploadSignRepo repositories.PhotoUploadSignRepository,
) PhotoStorageAdapter

type SearchAdapter

type SearchAdapter interface {
	InsertPhoto(ctx context.Context, photo *entities.Photo) error
	BulkInsertPhotos(ctx context.Context, photos entities.PhotoList) (*esutil.BulkIndexerStats, error)
	SearchPhotos(ctx context.Context, q *filters.PhotoSearchQuery) (*entities.PhotoSearchResult, error)
	AggregateByDateTimeOriginalYear(ctx context.Context) (entities.PhotoDateTimeAggregation, error)
	AggregateByDateTimeOriginalYearMonth(ctx context.Context, year int) (entities.PhotoDateTimeAggregation, error)
	AggregateByDateTimeOriginalYearMonthDate(ctx context.Context, year, month int) (entities.PhotoDateTimeAggregation, error)
}

type UserAdapter

type UserAdapter interface {
	GetUser(ctx context.Context, userID string) (*entities.User, error)
	GetUsers(ctx context.Context, filter *filters.UserFilter, limit, offset int) (entities.UserList, error)
	CountUsers(ctx context.Context, filter *filters.UserFilter) (int, error)
	ExistUser(ctx context.Context, userID string) (bool, error)
	CreateUser(ctx context.Context, user *entities.User, password string, isInitializedPassword bool, now time.Time) (*entities.User, error)
	UpdateUserProfile(ctx context.Context, user *entities.User) (*entities.User, error)
	GetUserPassword(ctx context.Context, userID string) (*entities.UserPassword, error)
}

func NewUserAdapter

func NewUserAdapter(
	userRepo repositories.UserRepository,
	userPasswordRepo repositories.UserPasswordRepository,
	photoStorageRepo repositories.PhotoStorageRepository,
) UserAdapter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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