Documentation ¶
Index ¶
- Constants
- func BatchTransferAsync(rail miso.Rail, cmd TransferGalleryImageReq, user common.User) (any, error)
- func CreateGalleryAccess(userNo string, galleryNo string, operator string) error
- func CreateGalleryForDir(rail miso.Rail, cmd CreateGalleryForDirCmd) (string, error)
- func CreateGalleryImage(rail miso.Rail, cmd CreateGalleryImageCmd, userNo string, username string) error
- func DeleteGallery(rail miso.Rail, cmd DeleteGalleryCmd, user common.User) error
- func DeleteGalleryImage(rail miso.Rail, fileKey string) error
- func DownloadFile(c miso.Rail, tmpToken string, absPath string) error
- func FindGalleryCreator(rail miso.Rail, galleryNo string) (*string, error)
- func GalleryExists(galleryNo string) (bool, error)
- func GalleryNoOfDir(dirFileKey string) (string, error)
- func GetFstoreTmpToken(c miso.Rail, fileId string, filename string) (string, error)
- func GrantGalleryAccessToUser(rail miso.Rail, cmd PermitGalleryAccessCmd, user common.User) error
- func GuessIsImage(rail miso.Rail, f FileInfoResp) bool
- func HasAccessToGallery(userNo string, galleryNo string) (bool, error)
- func IsGalleryNameUsed(name string, userNo string) (bool, error)
- func ListOwnedGalleryBriefs(rail miso.Rail, user common.User) (*[]VGalleryBrief, error)
- func ListedGrantedGalleryAccess(rail miso.Rail, tx *gorm.DB, req ListGrantedGalleryAccessCmd, user common.User) (miso.PageRes[ListedGalleryAccessRes], error)
- func OnCreateGalleryImgEvent(rail miso.Rail, evt CreateGalleryImgEvent) error
- func OnNotifyFileDeletedEvent(rail miso.Rail, evt NotifyFileDeletedEvent) error
- func PrepareEventBus(rail miso.Rail) error
- func RegisterRoutes(rail miso.Rail) error
- func RemoveGalleryAccess(rail miso.Rail, tx *gorm.DB, cmd RemoveGalleryAccessCmd, user common.User) error
- func TransferImagesInDir(rail miso.Rail, cmd TransferGalleryImageInDirReq, user common.User) error
- func UpdateGallery(rail miso.Rail, cmd UpdateGalleryCmd, user common.User) error
- func ValidateFileKey(c miso.Rail, fileKey string, userId int) (bool, error)
- type BatchGenFileKeyItem
- type BatchGenFileKeyReq
- type BatchGenFileKeyResp
- type CreateGalleryCmd
- type CreateGalleryForDirCmd
- type CreateGalleryImageCmd
- type CreateGalleryImgEvent
- type DeleteGalleryCmd
- type FileInfoResp
- type FileType
- type FindUserReq
- type Gallery
- type GalleryImage
- type GalleryUserAccess
- type GenFileTempTokenReq
- type GenFileTempTokenResp
- type GetFileInfoResp
- type ImageInfo
- type ImgStatus
- type ListFilesInDirResp
- type ListGalleriesCmd
- type ListGalleriesResp
- type ListGalleryImagesCmd
- type ListGalleryImagesResp
- type ListGrantedGalleryAccessCmd
- type ListedGalleryAccessRes
- type NotifyFileDeletedEvent
- type PermitGalleryAccessCmd
- type RemoveGalleryAccessCmd
- type ThumbnailInfo
- type TransferGalleryImageInDirReq
- type TransferGalleryImageReq
- type UpdateGUAIsDelCmd
- type UpdateGalleryCmd
- type UserInfo
- type VGallery
- type VGalleryBrief
- type ValidateFileKeyResp
Constants ¶
View Source
const ( AddDirGalleryImageEventBus = "fantahsea.dir.gallery.image.add" NotifyFileDeletedEventBus = "fantahsea.notify.file.deleted" )
View Source
const ( NORMAL ImgStatus = "NORMAL" DELETED ImgStatus = "DELETED" // 40mb is the maximum size for an image IMAGE_SIZE_THRESHOLD int64 = 40 * 1048576 )
View Source
const ( ManageFileCode = "manage-files" ManageFileName = "Manage files" )
Variables ¶
This section is empty.
Functions ¶
func BatchTransferAsync ¶
func CreateGalleryAccess ¶
Assign user access to the gallery
func CreateGalleryForDir ¶
func CreateGalleryForDir(rail miso.Rail, cmd CreateGalleryForDirCmd) (string, error)
Create a new Gallery for dir
func CreateGalleryImage ¶
func CreateGalleryImage(rail miso.Rail, cmd CreateGalleryImageCmd, userNo string, username string) error
Create a gallery image record
func DeleteGallery ¶
Delete a gallery
func DownloadFile ¶
Download file from mini-fstore
func FindGalleryCreator ¶
Find Gallery's creator by gallery_no
func GalleryNoOfDir ¶
func GetFstoreTmpToken ¶
func GrantGalleryAccessToUser ¶
Grant user's access to the gallery, only the owner can do so
func GuessIsImage ¶
func GuessIsImage(rail miso.Rail, f FileInfoResp) bool
Guess whether a file is an image
func HasAccessToGallery ¶
Check if user has access to the gallery
func IsGalleryNameUsed ¶
Check if the name is already used by current user
func ListOwnedGalleryBriefs ¶
List owned gallery briefs
func OnCreateGalleryImgEvent ¶
func OnCreateGalleryImgEvent(rail miso.Rail, evt CreateGalleryImgEvent) error
func OnNotifyFileDeletedEvent ¶
func OnNotifyFileDeletedEvent(rail miso.Rail, evt NotifyFileDeletedEvent) error
func PrepareEventBus ¶
func RegisterRoutes ¶
func RemoveGalleryAccess ¶
func TransferImagesInDir ¶
Transfer images in dir
func UpdateGallery ¶
Update a Gallery
Types ¶
type BatchGenFileKeyItem ¶
type BatchGenFileKeyReq ¶
type BatchGenFileKeyReq struct {
Items []BatchGenFileKeyItem `json:"items"`
}
type BatchGenFileKeyResp ¶
func BatchGetFstoreTmpToken ¶
func BatchGetFstoreTmpToken(c miso.Rail, req BatchGenFileKeyReq) ([]BatchGenFileKeyResp, error)
type CreateGalleryCmd ¶
type CreateGalleryCmd struct {
Name string `json:"name" validation:"notEmpty"`
}
type CreateGalleryForDirCmd ¶
type CreateGalleryImageCmd ¶
type CreateGalleryImgEvent ¶
type DeleteGalleryCmd ¶
type DeleteGalleryCmd struct {
GalleryNo string `json:"galleryNo" validation:"notEmpty"`
}
type FileInfoResp ¶
type FileInfoResp struct { /** name of the file */ Name string `json:"name"` /** file's uuid */ Uuid string `json:"uuid"` /** size of file in bytes */ SizeInBytes int64 `json:"sizeInBytes"` /** uploader id, i.e., user.id */ UploaderId int `json:"uploaderId"` /** uploader name */ UploaderName string `json:"uploaderName"` /** when the file is deleted */ IsDeleted bool `json:"isDeleted"` /** file type: FILE, DIR */ FileType FileType `json:"fileType"` /** parent file's uuid */ ParentFile string `json:"parentFile"` LocalPath string `json:"localPath"` FstoreFileId string `json:"fstoreFileId"` Thumbnail string `json:"thumbnail"` // also a mini-fstore file_id }
type FindUserReq ¶
type Gallery ¶
type Gallery struct { ID int64 GalleryNo string UserNo string Name string DirFileKey string CreateTime time.Time CreateBy string UpdateTime time.Time UpdateBy string IsDel common.IS_DEL }
Gallery
func CreateGallery ¶
Create a new Gallery
type GalleryImage ¶
type GalleryImage struct { ID int64 GalleryNo string ImageNo string Name string FileKey string Status ImgStatus CreateTime time.Time CreateBy string UpdateTime time.Time UpdateBy string IsDel common.IS_DEL }
Image that belongs to a Gallery
func (GalleryImage) TableName ¶
func (GalleryImage) TableName() string
type GalleryUserAccess ¶
type GalleryUserAccess struct { ID int64 GalleryNo string UserNo string CreateTime time.Time CreateBy string UpdateTime time.Time UpdateBy string IsDel common.IS_DEL }
User's access to a Gallery
func (GalleryUserAccess) TableName ¶
func (GalleryUserAccess) TableName() string
type GenFileTempTokenReq ¶
type GenFileTempTokenResp ¶
type GetFileInfoResp ¶
type GetFileInfoResp struct { miso.Resp Data *FileInfoResp `json:"data"` }
func GetFileInfo ¶
func GetFileInfo(c miso.Rail, fileKey string) (*GetFileInfoResp, error)
Get file info from file-service
type ListFilesInDirResp ¶
func ListFilesInDir ¶
List files in dir from vfm
type ListGalleriesCmd ¶
type ListGalleriesResp ¶
type ListGalleriesResp struct { Paging miso.Paging `json:"pagingVo"` Galleries []VGallery `json:"galleries"` }
func ListGalleries ¶
func ListGalleries(rail miso.Rail, cmd ListGalleriesCmd, user common.User) (ListGalleriesResp, error)
List Galleries
type ListGalleryImagesCmd ¶
type ListGalleryImagesResp ¶
type ListGalleryImagesResp struct { Images []ImageInfo `json:"images"` Paging miso.Paging `json:"pagingVo"` }
func ListGalleryImages ¶
func ListGalleryImages(rail miso.Rail, cmd ListGalleryImagesCmd, user common.User) (*ListGalleryImagesResp, error)
List gallery images
type ListedGalleryAccessRes ¶
type NotifyFileDeletedEvent ¶
type NotifyFileDeletedEvent struct {
FileKey string `json:"fileKey"`
}
type PermitGalleryAccessCmd ¶
type RemoveGalleryAccessCmd ¶
type ThumbnailInfo ¶
type TransferGalleryImageReq ¶
type TransferGalleryImageReq struct {
Images []CreateGalleryImageCmd
}
type UpdateGUAIsDelCmd ¶
type UpdateGalleryCmd ¶
type VGallery ¶
type VGallery struct { ID int64 `json:"id"` GalleryNo string `json:"galleryNo"` UserNo string `json:"userNo"` Name string `json:"name"` CreateTime miso.ETime `json:"-"` UpdateTime miso.ETime `json:"-"` CreateBy string `json:"createBy"` UpdateBy string `json:"updateBy"` IsOwner bool `json:"isOwner"` CreateTimeStr string `json:"createTime"` UpdateTimeStr string `json:"updateTime"` }
type VGalleryBrief ¶
type ValidateFileKeyResp ¶
Click to show internal directories.
Click to hide internal directories.