Documentation
¶
Index ¶
- func AddToBlacklist(db *gorm.DB, token string, expiration time.Time) error
- func CleanupBlacklist(db *gorm.DB) error
- func GetFileType(File *multipart.FileHeader) (string, string, error)
- func GetImageDimensions(File *multipart.FileHeader) (string, int, int, error)
- func GetThumbnails(dateDir, fileUUID string, maxThumbSize uint, MimeType string, ...) (string, int, int, int64, error)
- func IsInBlacklist(db *gorm.DB, token string) (bool, error)
- type AlbumResponse
- type AlbumService
- func (s *AlbumService) CreateAlbum(name string, description string, galleryEnabled bool, userID uint, ...) (*AlbumResponse, error)
- func (s *AlbumService) DeleteAlbum(id uint, userID uint) error
- func (s *AlbumService) GetAlbum(id uint, userID uint) (*AlbumResponse, error)
- func (s *AlbumService) GetAlbumImages(id uint, userID uint, page, pageSize, offset int) (*GetAlbumImagesResponse, error)
- func (s *AlbumService) GetAlbums(userID uint, page, pageSize, offset int) (*GetAlbumsResponse, error)
- func (s *AlbumService) GetNotInAnyAlbum(userID uint, page, pageSize, offset int) (*GetAlbumImagesResponse, error)
- func (s *AlbumService) UpdateAlbum(id uint, userID uint, name string, description string, galleryEnabled bool, ...) (*AlbumResponse, error)
- type AuthService
- func (s *AuthService) Login(username, password string, jwtCfg *config.JWTConfig) (*LoginResponse, error)
- func (s *AuthService) Logout(refreshToken string, jwtCfg *config.JWTConfig) error
- func (s *AuthService) RefreshToken(refreshToken string, jwtCfg *config.JWTConfig) (*TokenResponse, error)
- func (s *AuthService) Register(username, password, email, locale string) (string, error)
- func (s *AuthService) RequestPasswordReset(email, locale string) error
- func (s *AuthService) ResetPassword(email, code, newPassword string) error
- func (s *AuthService) VerifyEmail(token string) error
- func (s *AuthService) VerifyPasswordResetCode(email, code string) error
- type GalleryImageResponse
- type GalleryService
- func (s *GalleryService) GetGallery(currentUserID uint) (*GetAlbumsResponse, error)
- func (s *GalleryService) GetGalleryImages(currentUserID uint, albumID uint, page, pageSize, offset int) (*GetGalleryImagesResponse, error)
- func (s *GalleryService) SearchGalleryImages(currentUserID uint, query string, page, pageSize, offset int) (*GetGalleryImagesResponse, error)
- type GetAlbumImagesResponse
- type GetAlbumsResponse
- type GetGalleryImagesResponse
- type GetImagesResponse
- type ImageResponse
- type ImageService
- func (s *ImageService) AddImageToAlbum(currentUserID uint, imageID uint, albumID uint) error
- func (s *ImageService) DeleteImage(currentUserID uint, imageID uint) error
- func (s *ImageService) GetImage(currentUserID uint, imageID uint) (*ImageResponse, error)
- func (s *ImageService) GetImages(currentUserID uint, page int, pageSize int) (*GetImagesResponse, error)
- func (s *ImageService) RemoveImageFromAlbum(currentUserID uint, imageID uint, albumID uint) error
- func (s *ImageService) SearchImagesByTagsOrTitle(currentUserID uint, searchKey string, page int, pageSize int) (*GetImagesResponse, error)
- func (s *ImageService) UpdateImage(currentUserID uint, imageID uint, originalName string, tags []string) (*ImageResponse, error)
- func (s *ImageService) UploadImage(currentUserID uint, AlbumIDs []uint, tags []string, ...) error
- func (s *ImageService) UploadImageLimitCheck(currentUserID uint, files []*multipart.FileHeader) error
- type LoginResponse
- type StorageUsage
- type TagCloudItem
- type TokenResponse
- type UserService
- func (s *UserService) GetImagesTagsCloud(userID uint) ([]TagCloudItem, error)
- func (s *UserService) GetMe(currentUserID uint) (*models.User, error)
- func (s *UserService) GetStorageUsage(userID uint) (*StorageUsage, error)
- func (s *UserService) UpdateMe(currentUserID uint, username, password string) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToBlacklist ¶
AddToBlacklist
func GetFileType ¶
func GetFileType(File *multipart.FileHeader) (string, string, error)
func GetImageDimensions ¶
func GetThumbnails ¶
Types ¶
type AlbumResponse ¶
type AlbumResponse struct {
ID uint `json:"id"`
UserID uint `json:"user_id"`
Name string `json:"name"`
Description string `json:"description"`
CoverImage string `json:"cover_image"`
ImageCount int `json:"image_count"`
GalleryEnabled bool `json:"gallery_enabled"`
SerialNumber int `json:"serial_number"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type AlbumService ¶
type AlbumService struct {
// contains filtered or unexported fields
}
func NewAlbumService ¶
func NewAlbumService(db *gorm.DB) *AlbumService
func (*AlbumService) CreateAlbum ¶
func (s *AlbumService) CreateAlbum(name string, description string, galleryEnabled bool, userID uint, serialNumber int) (*AlbumResponse, error)
func (*AlbumService) DeleteAlbum ¶
func (s *AlbumService) DeleteAlbum(id uint, userID uint) error
func (*AlbumService) GetAlbum ¶
func (s *AlbumService) GetAlbum(id uint, userID uint) (*AlbumResponse, error)
func (*AlbumService) GetAlbumImages ¶
func (s *AlbumService) GetAlbumImages(id uint, userID uint, page, pageSize, offset int) (*GetAlbumImagesResponse, error)
func (*AlbumService) GetAlbums ¶
func (s *AlbumService) GetAlbums(userID uint, page, pageSize, offset int) (*GetAlbumsResponse, error)
func (*AlbumService) GetNotInAnyAlbum ¶
func (s *AlbumService) GetNotInAnyAlbum(userID uint, page, pageSize, offset int) (*GetAlbumImagesResponse, error)
func (*AlbumService) UpdateAlbum ¶
func (s *AlbumService) UpdateAlbum(id uint, userID uint, name string, description string, galleryEnabled bool, serialNumber int) (*AlbumResponse, error)
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(db *gorm.DB, mailService *mail.MailService, cfg *config.Config) *AuthService
func (*AuthService) Login ¶
func (s *AuthService) Login(username, password string, jwtCfg *config.JWTConfig) (*LoginResponse, error)
func (*AuthService) Logout ¶
func (s *AuthService) Logout(refreshToken string, jwtCfg *config.JWTConfig) error
Logout 用户登出
func (*AuthService) RefreshToken ¶
func (s *AuthService) RefreshToken(refreshToken string, jwtCfg *config.JWTConfig) (*TokenResponse, error)
func (*AuthService) Register ¶
func (s *AuthService) Register(username, password, email, locale string) (string, error)
func (*AuthService) RequestPasswordReset ¶
func (s *AuthService) RequestPasswordReset(email, locale string) error
func (*AuthService) ResetPassword ¶
func (s *AuthService) ResetPassword(email, code, newPassword string) error
func (*AuthService) VerifyEmail ¶
func (s *AuthService) VerifyEmail(token string) error
func (*AuthService) VerifyPasswordResetCode ¶
func (s *AuthService) VerifyPasswordResetCode(email, code string) error
type GalleryImageResponse ¶
type GalleryImageResponse struct {
FileName string `json:"file_name"`
OriginalName string `json:"original_name"`
Tags []string `json:"tags" gorm:"serializer:json"`
FileURL string `json:"file_url"`
FileSize int64 `json:"file_size"`
Width int `json:"width"`
Height int `json:"height"`
ThumbnailURL string `json:"thumbnail_url"`
ThumbnailSize int64 `json:"thumbnail_size"`
ThumbnailWidth int `json:"thumbnail_width"`
ThumbnailHeight int `json:"thumbnail_height"`
MimeType string `json:"mime_type"`
}
type GalleryService ¶
type GalleryService struct {
// contains filtered or unexported fields
}
func NewGalleryService ¶
func NewGalleryService(db *gorm.DB) *GalleryService
func (*GalleryService) GetGallery ¶
func (s *GalleryService) GetGallery(currentUserID uint) (*GetAlbumsResponse, error)
func (*GalleryService) GetGalleryImages ¶
func (s *GalleryService) GetGalleryImages(currentUserID uint, albumID uint, page, pageSize, offset int) (*GetGalleryImagesResponse, error)
func (*GalleryService) SearchGalleryImages ¶
func (s *GalleryService) SearchGalleryImages(currentUserID uint, query string, page, pageSize, offset int) (*GetGalleryImagesResponse, error)
type GetAlbumImagesResponse ¶
type GetAlbumImagesResponse struct {
Images []ImageResponse `json:"images"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
type GetAlbumsResponse ¶
type GetAlbumsResponse struct {
Albums []AlbumResponse `json:"albums"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
type GetGalleryImagesResponse ¶
type GetGalleryImagesResponse struct {
Images []GalleryImageResponse `json:"images"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
type GetImagesResponse ¶
type GetImagesResponse struct {
Images []ImageResponse `json:"images"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
type ImageResponse ¶
type ImageResponse struct {
ID uint `json:"id"`
FileName string `json:"file_name"`
OriginalName string `json:"original_name"`
Tags []string `json:"tags" gorm:"serializer:json"`
FileURL string `json:"file_url"`
FileSize int64 `json:"file_size"`
Width int `json:"width"`
Height int `json:"height"`
ThumbnailURL string `json:"thumbnail_url"`
ThumbnailSize int64 `json:"thumbnail_size"`
ThumbnailWidth int `json:"thumbnail_width"`
ThumbnailHeight int `json:"thumbnail_height"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
MimeType string `json:"mime_type"`
UserID uint `json:"user_id"`
Albums []AlbumResponse `json:"albums"`
StorageName string `json:"storage_name"`
}
func MakeImageWithAlbum ¶
func MakeImageWithAlbum(imageModel models.Image) ImageResponse
func MakeImagesWithAlbum ¶
func MakeImagesWithAlbum(imageModels []models.Image) []ImageResponse
type ImageService ¶
type ImageService struct {
// contains filtered or unexported fields
}
func NewImageService ¶
func NewImageService(db *gorm.DB, cfg *config.Config) *ImageService
func (*ImageService) AddImageToAlbum ¶
func (s *ImageService) AddImageToAlbum(currentUserID uint, imageID uint, albumID uint) error
func (*ImageService) DeleteImage ¶
func (s *ImageService) DeleteImage(currentUserID uint, imageID uint) error
func (*ImageService) GetImage ¶
func (s *ImageService) GetImage(currentUserID uint, imageID uint) (*ImageResponse, error)
func (*ImageService) GetImages ¶
func (s *ImageService) GetImages(currentUserID uint, page int, pageSize int) (*GetImagesResponse, error)
func (*ImageService) RemoveImageFromAlbum ¶
func (s *ImageService) RemoveImageFromAlbum(currentUserID uint, imageID uint, albumID uint) error
func (*ImageService) SearchImagesByTagsOrTitle ¶
func (s *ImageService) SearchImagesByTagsOrTitle(currentUserID uint, searchKey string, page int, pageSize int) (*GetImagesResponse, error)
func (*ImageService) UpdateImage ¶
func (s *ImageService) UpdateImage(currentUserID uint, imageID uint, originalName string, tags []string) (*ImageResponse, error)
func (*ImageService) UploadImage ¶
func (s *ImageService) UploadImage(currentUserID uint, AlbumIDs []uint, tags []string, files []*multipart.FileHeader) error
func (*ImageService) UploadImageLimitCheck ¶
func (s *ImageService) UploadImageLimitCheck(currentUserID uint, files []*multipart.FileHeader) error
type LoginResponse ¶
type LoginResponse struct {
User models.User `json:"user"`
TokenResponse TokenResponse `json:"token_response"`
}
type StorageUsage ¶
type TagCloudItem ¶
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
RefreshExpiresIn int `json:"refresh_expires_in"`
}
TokenResponse 令牌响应结构体
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(db *gorm.DB, cfg *config.Config) *UserService
func (*UserService) GetImagesTagsCloud ¶
func (s *UserService) GetImagesTagsCloud(userID uint) ([]TagCloudItem, error)
GetImagesTagsCloud 获取用户图片标签云
func (*UserService) GetStorageUsage ¶
func (s *UserService) GetStorageUsage(userID uint) (*StorageUsage, error)
GetStorageUsage 获取用户存储空间使用情况
Click to show internal directories.
Click to hide internal directories.