vfm

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileTypeFile = "FILE" // file
	FileTypeDir  = "DIR"  // directory

	LDelN = 0 // normal file
	LDelY = 1 // file marked deleted

	PDelN = 0 // file marked deleted, the actual deletion is not yet processed
	PDelY = 1 // file finally deleted, may be removed from disk or move to somewhere else

	VfolderOwner   = "OWNER"   // owner of the vfolder
	VfolderGranted = "GRANTED" // granted access to the vfolder
)
View Source
const (
	FileSavedEventBus               = "event.bus.vfm.file.saved"
	ThumbnailUpdatedEventBus        = "event.bus.vfm.file.thumbnail.updated"
	FileLDeletedEventBus            = "event.bus.vfm.file.logic.deleted"
	CalcDirSizeEventBus             = "event.bus.vfm.dir.size.calc"
	AddFileToVFolderEventBus        = "event.bus.vfm.file.vfolder.add"
	CompressImgNotifyEventBus       = "vfm.image.compressed.event"
	GenVideoThumbnailNotifyEventBus = "vfm.video.thumbnail.generate"
	UnzipResultNotifyEventBus       = "vfm.unzip.result.notify.event"
	AddDirGalleryImgEventBus        = "event.bus.fantahsea.dir.gallery.image.add"
	SyncGalleryFileDeletedEventBus  = "event.bus.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 (
	FileStatusNormal = "NORMAL" // file.status - normal
)
View Source
const (
	ManageFilesResource = "manage-files"
)
View Source
const (
	PropVfmSiteHost = "vfm.site.host"
)
View Source
const (
	Version = "v0.1.19"
)

Variables

View Source
var (
	SchemaFs embed.FS
)

Functions

func AddFileToVFolder

func AddFileToVFolder(rail miso.Rail, tx *gorm.DB, req AddFileToVfolderReq, user common.User) error

func BatchDeleteFileEp

func BatchDeleteFileEp(inb *miso.Inbound, req BatchDeleteFileReq) (any, error)

func BatchTransferAsync

func BatchTransferAsync(rail miso.Rail, cmd TransferGalleryImageReq, user common.User, tx *gorm.DB) (any, error)

func BootstrapServer added in v0.1.19

func BootstrapServer(args []string)

func CachedFindUser

func CachedFindUser(rail miso.Rail, userNo string) (vault.UserInfo, error)

func CalcDirSize

func CalcDirSize(rail miso.Rail, fk string, db *gorm.DB) error

func CompensateThumbnail added in v0.1.14

func CompensateThumbnail(rail miso.Rail, tx *gorm.DB) error

func CreateFile

func CreateFile(rail miso.Rail, tx *gorm.DB, r CreateFileReq, user common.User) error

func CreateFileEp

func CreateFileEp(inb *miso.Inbound, req CreateFileReq) (any, error)

func CreateGalleryAccess

func CreateGalleryAccess(rail miso.Rail, tx *gorm.DB, userNo string, galleryNo string, operator string) error

Assign user access to the gallery

func CreateGalleryForDir

func CreateGalleryForDir(rail miso.Rail, cmd CreateGalleryForDirCmd, tx *gorm.DB) (string, error)

Create a new Gallery for dir

func CreateGalleryImage

func CreateGalleryImage(rail miso.Rail, cmd CreateGalleryImageCmd, userNo string, username string, tx *gorm.DB) error

Create a gallery image record

func CreateVFolder

func CreateVFolder(rail miso.Rail, tx *gorm.DB, r CreateVFolderReq, user common.User) (string, error)

func CreateVFolderEp

func CreateVFolderEp(inb *miso.Inbound, req CreateVFolderReq) (string, error)

func DeleteFile

func DeleteFile(rail miso.Rail, tx *gorm.DB, req DeleteFileReq, user common.User, condition func(FileInfo) bool) error

func DeleteFileEp

func DeleteFileEp(inb *miso.Inbound, req DeleteFileReq) (any, error)

func DeleteFstoreFile

func DeleteFstoreFile(rail miso.Rail, fileId string) error

func DeleteGallery

func DeleteGallery(rail miso.Rail, tx *gorm.DB, cmd DeleteGalleryCmd, user common.User) error

Delete a gallery

func DeleteGalleryEp

func DeleteGalleryEp(inb *miso.Inbound, cmd DeleteGalleryCmd) (any, error)

func DeleteGalleryImage

func DeleteGalleryImage(rail miso.Rail, tx *gorm.DB, fileKey string) error

func DupPreflightCheckEp

func DupPreflightCheckEp(inb *miso.Inbound, req PreflightCheckReq) (bool, error)

func FileExists

func FileExists(c miso.Rail, tx *gorm.DB, req PreflightCheckReq, user common.User) (bool, error)

func FindGalleryCreator

func FindGalleryCreator(rail miso.Rail, galleryNo string, tx *gorm.DB) (*string, error)

Find Gallery's creator by gallery_no

func GalleryExists

func GalleryExists(rail miso.Rail, tx *gorm.DB, galleryNo string) (bool, error)

Check if the gallery exists

func GalleryNoOfDir

func GalleryNoOfDir(dirFileKey string, tx *gorm.DB) (string, error)

func GenFileTknEp

func GenFileTknEp(inb *miso.Inbound, req GenerateTempTokenReq) (string, error)

func GenFileTknQRCodeEp added in v0.1.10

func GenFileTknQRCodeEp(inb *miso.Inbound)

func GenFstoreTknAsync

func GenFstoreTknAsync(rail miso.Rail, fileId string, name string) miso.Future[FstoreTmpToken]

func GenFstoreTknBatch added in v0.1.11

func GenFstoreTknBatch(rail miso.Rail, futures *miso.AwaitFutures[FstoreTmpToken], fileId string, name string)

func GenTempToken

func GenTempToken(rail miso.Rail, tx *gorm.DB, r GenerateTempTokenReq, user common.User) (string, error)

func GetFstoreTmpToken

func GetFstoreTmpToken(rail miso.Rail, fileId string, filename string) (string, error)

func GrantGalleryAccessToUser

func GrantGalleryAccessToUser(rail miso.Rail, tx *gorm.DB, cmd PermitGalleryAccessCmd, user common.User) error

Grant user's access to the gallery, only the owner can do so

func GranteGalleryAccessEp

func GranteGalleryAccessEp(inb *miso.Inbound, cmd PermitGalleryAccessCmd) (any, error)

func GuessIsImage

func GuessIsImage(rail miso.Rail, f FileInfo) bool

Guess whether a file is an image

func HandleAddFileToVFolderEvent

func HandleAddFileToVFolderEvent(rail miso.Rail, tx *gorm.DB, evt AddFileToVfolderEvent) error

func HandleZipUnpackResult

func HandleZipUnpackResult(rail miso.Rail, db *gorm.DB, evt fstore.UnzipFileReplyEvent) error

func HasAccessToGallery

func HasAccessToGallery(rail miso.Rail, tx *gorm.DB, userNo string, galleryNo string) (bool, error)

Check if user has access to the gallery

func ImMemBatchCalcDirSize added in v0.1.14

func ImMemBatchCalcDirSize(rail miso.Rail, db *gorm.DB) error

func IsGalleryNameUsed

func IsGalleryNameUsed(name string, userNo string, tx *gorm.DB) (bool, error)

Check if the name is already used by current user

func ListFiles

func ListFiles(rail miso.Rail, tx *gorm.DB, req ListFileReq, user common.User) (miso.PageRes[ListedFile], error)

func ListFilesEp

func ListFilesEp(inb *miso.Inbound, req ListFileReq) (miso.PageRes[ListedFile], error)

func ListFilesInDir

func ListFilesInDir(rail miso.Rail, tx *gorm.DB, req ListFilesInDirReq) ([]string, error)

func ListFilesInDirEp

func ListFilesInDirEp(inb *miso.Inbound, req ListFilesInDirReq) ([]string, error)

func ListGalleries

func ListGalleries(rail miso.Rail, cmd ListGalleriesCmd, user common.User, db *gorm.DB) (miso.PageRes[VGallery], error)

List Galleries

func ListGalleriesEp

func ListGalleriesEp(inb *miso.Inbound, cmd ListGalleriesCmd) (miso.PageRes[VGallery], error)

func MakeDir

func MakeDir(rail miso.Rail, tx *gorm.DB, req MakeDirReq, user common.User) (string, error)

func MakeDirEp

func MakeDirEp(inb *miso.Inbound, req MakeDirReq) (string, error)

func MoveFileToDir

func MoveFileToDir(rail miso.Rail, db *gorm.DB, req MoveIntoDirReq, user common.User) error

func MoveFileToDirEp

func MoveFileToDirEp(inb *miso.Inbound, req MoveIntoDirReq) (any, error)

func NewGalleryFileLock

func NewGalleryFileLock(rail miso.Rail, galleryNo string, fileKey string) *miso.RLock

func NewVFolderLock

func NewVFolderLock(rail miso.Rail, folderNo string) *miso.RLock

func OnAddFileToVfolderEvent

func OnAddFileToVfolderEvent(rail miso.Rail, evt AddFileToVfolderEvent) error

func OnCalcDirSizeEvt

func OnCalcDirSizeEvt(rail miso.Rail, evt CalcDirSizeEvt) error

func OnCreateGalleryImgEvent

func OnCreateGalleryImgEvent(rail miso.Rail, evt CreateGalleryImgEvent) error

func OnFileDeleted

func OnFileDeleted(rail miso.Rail, evt StreamEvent) error

event-pump send binlog event when a file_info is deleted (is_logic_deleted changed) vfm notifies fantahsea about the delete

func OnFileSaved

func OnFileSaved(rail miso.Rail, evt StreamEvent) error

event-pump send binlog event when a file_info record is saved. vfm guesses if the file is an image by file name, if so, vfm sends events to hammer to compress the image as a thumbnail

func OnImageCompressed

func OnImageCompressed(rail miso.Rail, evt hammer.ImageCompressReplyEvent) error

hammer sends event message when the thumbnail image is compressed and saved on mini-fstore

func OnNotifyFileDeletedEvent

func OnNotifyFileDeletedEvent(rail miso.Rail, evt NotifyFileDeletedEvent) error

func OnThumbnailGenerated added in v0.1.14

func OnThumbnailGenerated(rail miso.Rail, tx *gorm.DB, identifier string, fileId string) error

func OnThumbnailUpdated

func OnThumbnailUpdated(rail miso.Rail, evt StreamEvent) error

event-pump send binlog event when a file_info's thumbnail is updated. vfm receives the event and check if the file has a thumbnail, if so, sends events to fantahsea to create a gallery image, adding current image to the gallery for its directory

func OnUnzipFileReplyEvent

func OnUnzipFileReplyEvent(rail miso.Rail, evt fstore.UnzipFileReplyEvent) error

func OnVidoeThumbnailGenerated added in v0.1.14

func OnVidoeThumbnailGenerated(rail miso.Rail, evt hammer.GenVideoThumbnailReplyEvent) error

func PrepareEventBus

func PrepareEventBus(rail miso.Rail) error

func PrepareServer

func PrepareServer()

func PrintVersion added in v0.1.19

func PrintVersion(rail miso.Rail) error

func RegisterHttpRoutes

func RegisterHttpRoutes(rail miso.Rail) error

func RemoveFileFromVFolder

func RemoveFileFromVFolder(rail miso.Rail, tx *gorm.DB, req RemoveFileFromVfolderReq, user common.User) error

func RemoveGalleryAccess

func RemoveGalleryAccess(rail miso.Rail, tx *gorm.DB, cmd RemoveGalleryAccessCmd, user common.User) error

func RemoveGalleryAccessEp

func RemoveGalleryAccessEp(inb *miso.Inbound, cmd RemoveGalleryAccessCmd) (any, error)

func RemoveVFolder

func RemoveVFolder(rail miso.Rail, tx *gorm.DB, user common.User, req RemoveVFolderReq) error

func RemoveVFolderAccess

func RemoveVFolderAccess(rail miso.Rail, tx *gorm.DB, req RemoveGrantedFolderAccessReq, user common.User) error

func RemoveVFolderAccessEp

func RemoveVFolderAccessEp(inb *miso.Inbound, req RemoveGrantedFolderAccessReq) (any, error)

func RemoveVFolderEp

func RemoveVFolderEp(inb *miso.Inbound, req RemoveVFolderReq) (any, error)

func SaveFileRecord

func SaveFileRecord(rail miso.Rail, tx *gorm.DB, r SaveFileReq, user common.User) error

func ShareVFolder

func ShareVFolder(rail miso.Rail, tx *gorm.DB, sharedTo vault.UserInfo, folderNo string, user common.User) error

func ShareVFolderEp

func ShareVFolderEp(inb *miso.Inbound, req ShareVfolderReq) (any, error)

func TransferGalleryImageEp

func TransferGalleryImageEp(inb *miso.Inbound, cmd TransferGalleryImageReq) (any, error)

func TransferImagesInDir

func TransferImagesInDir(rail miso.Rail, cmd TransferGalleryImageInDirReq, user common.User, tx *gorm.DB) error

Transfer images in dir

func TruncateDir added in v0.1.16

func TruncateDir(rail miso.Rail, db *gorm.DB, req DeleteFileReq, user common.User, async bool) error

func TruncateDirEp added in v0.1.16

func TruncateDirEp(inb *miso.Inbound, req DeleteFileReq) (any, error)

func UnpackZip

func UnpackZip(rail miso.Rail, db *gorm.DB, user common.User, req UnpackZipReq) error

func UnpackZipEp

func UnpackZipEp(inb *miso.Inbound, req UnpackZipReq) (any, error)

func UpdateFile

func UpdateFile(rail miso.Rail, tx *gorm.DB, r UpdateFileReq, user common.User) error

func UpdateFileEp

func UpdateFileEp(inb *miso.Inbound, req UpdateFileReq) (any, error)

func UpdateGallery

func UpdateGallery(rail miso.Rail, cmd UpdateGalleryCmd, user common.User, tx *gorm.DB) error

Update a Gallery

func UpdateGalleryEp

func UpdateGalleryEp(inb *miso.Inbound, cmd UpdateGalleryCmd) (any, error)

func VFolderAddFileEp

func VFolderAddFileEp(inb *miso.Inbound, req AddFileToVfolderReq) (any, error)

func VFolderRemoveFileEp

func VFolderRemoveFileEp(inb *miso.Inbound, req RemoveFileFromVfolderReq) (any, error)

func ValidateFileOwner

func ValidateFileOwner(rail miso.Rail, tx *gorm.DB, q ValidateFileOwnerReq) (bool, error)

Types

type AddFileToVfolderEvent

type AddFileToVfolderEvent struct {
	Username string
	UserNo   string
	FolderNo string
	FileKeys []string
}

type AddFileToVfolderReq

type AddFileToVfolderReq struct {
	FolderNo string   `json:"folderNo"`
	FileKeys []string `json:"fileKeys"`
	Sync     bool     `json:"-"`
}

type BatchDeleteFileReq

type BatchDeleteFileReq struct {
	FileKeys []string
}

type CalcDirSizeEvt

type CalcDirSizeEvt struct {
	FileKey string
}

type CreateFileReq

type CreateFileReq struct {
	Filename         string `json:"filename"`
	FakeFstoreFileId string `json:"fstoreFileId"`
	ParentFile       string `json:"parentFile"`
}

type CreateGalleryCmd

type CreateGalleryCmd struct {
	Name string `json:"name" validation:"notEmpty"`
}

type CreateGalleryForDirCmd

type CreateGalleryForDirCmd struct {
	DirName    string
	DirFileKey string
	Username   string
	UserNo     string
}

type CreateGalleryImageCmd

type CreateGalleryImageCmd struct {
	GalleryNo string `json:"galleryNo"`
	Name      string `json:"name"`
	FileKey   string `json:"fileKey"`
}

type CreateGalleryImgEvent

type CreateGalleryImgEvent struct {
	Username     string `json:"username"`
	UserNo       string `json:"userNo"`
	DirFileKey   string `json:"dirFileKey"`
	DirName      string `json:"dirName"`
	ImageName    string `json:"imageName"`
	ImageFileKey string `json:"imageFileKey"`
}

type CreateVFolderReq

type CreateVFolderReq struct {
	Name string `json:"name"`
}

type DeleteFileReq

type DeleteFileReq struct {
	Uuid string `json:"uuid"`
}

type DeleteGalleryCmd

type DeleteGalleryCmd struct {
	GalleryNo string `json:"galleryNo" validation:"notEmpty"`
}

type FetchFileInfoReq

type FetchFileInfoReq struct {
	FileKey string `form:"fileKey"`
}

type FetchParentFileReq

type FetchParentFileReq struct {
	FileKey string `form:"fileKey"`
}

type FileDownloadInfo

type FileDownloadInfo struct {
	FileId         int
	Name           string
	IsLogicDeleted int
	FileType       string
	FstoreFileId   string
	UploaderNo     string
}

func (*FileDownloadInfo) Deleted

func (f *FileDownloadInfo) Deleted() bool

func (*FileDownloadInfo) IsFile

func (f *FileDownloadInfo) IsFile() bool

type FileInfo

type FileInfo struct {
	Id               int
	Name             string
	Uuid             string
	FstoreFileId     string
	Thumbnail        string // thumbnail is also a fstore's file_id
	IsLogicDeleted   int
	IsPhysicDeleted  int
	SizeInBytes      int64
	UploaderId       int    // deprecated.
	UploaderNo       string // uploader's user_no
	UploaderName     string
	UploadTime       miso.ETime
	LogicDeleteTime  miso.ETime
	PhysicDeleteTime miso.ETime
	UserGroup        int
	FsGroupId        int
	FileType         string
	ParentFile       string
	CreateTime       miso.ETime
	CreateBy         string
	UpdateTime       miso.ETime
	UpdateBy         string
	IsDel            int
}

func (FileInfo) IsZero

func (f FileInfo) IsZero() bool

type FileInfoResp

type FileInfoResp struct {
	Name         string `json:"name"`
	Uuid         string `json:"uuid"`
	SizeInBytes  int64  `json:"sizeInBytes"`
	UploaderNo   string `json:"uploaderNo"`
	UploaderName string `json:"uploaderName"`
	IsDeleted    bool   `json:"isDeleted"`
	FileType     string `json:"fileType"`
	ParentFile   string `json:"parentFile"`
	LocalPath    string `json:"localPath"`
	FstoreFileId string `json:"fstoreFileId"`
	Thumbnail    string `json:"thumbnail"`
}

func FetchFileInfoInternal

func FetchFileInfoInternal(rail miso.Rail, tx *gorm.DB, req FetchFileInfoReq) (FileInfoResp, error)

type FileKeyName

type FileKeyName struct {
	Name string
	Uuid string
}

type FileVFolder

type FileVFolder struct {
	FolderNo   string
	Uuid       string
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
	IsDel      bool
}

type FstoreFile

type FstoreFile struct {
	Id         int64       `json:"id"`
	FileId     string      `json:"fileId"`
	Name       string      `json:"name"`
	Status     string      `json:"status"`
	Size       int64       `json:"size"`
	Md5        string      `json:"md5"`
	UplTime    miso.ETime  `json:"uplTime"`
	LogDelTime *miso.ETime `json:"logDelTime"`
	PhyDelTime *miso.ETime `json:"phyDelTime"`
}

func FetchFstoreFileInfo

func FetchFstoreFileInfo(rail miso.Rail, fileId string, uploadFileId string) (FstoreFile, error)

func (FstoreFile) IsZero

func (f FstoreFile) IsZero() bool

type FstoreTmpToken

type FstoreTmpToken struct {
	FileId  string
	TempKey string
}
type Gallery struct {
	ID         int64
	GalleryNo  string
	UserNo     string
	Name       string
	DirFileKey string
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
	IsDel      bool
}

Gallery

func CreateGallery

func CreateGallery(rail miso.Rail, cmd CreateGalleryCmd, user common.User, tx *gorm.DB) (*Gallery, error)

Create a new Gallery

func CreateGalleryEp

func CreateGalleryEp(inb *miso.Inbound, cmd CreateGalleryCmd) (*Gallery, error)

func FindGallery

func FindGallery(rail miso.Rail, tx *gorm.DB, galleryNo string) (*Gallery, error)

Find Gallery by gallery_no

func (Gallery) TableName

func (Gallery) TableName() string

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      bool
}

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      bool
}

User's access to a Gallery

func (GalleryUserAccess) TableName

func (GalleryUserAccess) TableName() string

type GenerateTempTokenReq

type GenerateTempTokenReq struct {
	FileKey string `json:"fileKey"`
}

type GrantAccessReq

type GrantAccessReq struct {
	FileId    int    `json:"fileId" validation:"positive"`
	GrantedTo string `json:"grantedTo" validation:"notEmpty"`
}

type ImageInfo

type ImageInfo struct {
	ThumbnailToken  string `json:"thumbnailToken"`
	FileTempToken   string `json:"fileTempToken"`
	ImageFileId     string `json:"-"`
	ThumbnailFileId string `json:"-"`
}

type ImgStatus

type ImgStatus string

GalleryImage.status (doesn't really matter anymore)

type ListFileReq

type ListFileReq struct {
	Page       miso.Paging `json:"paging"`
	Filename   *string     `json:"filename"`
	FolderNo   *string     `json:"folderNo"`
	FileType   *string     `json:"fileType"`
	ParentFile *string     `json:"parentFile"`
	Sensitive  *bool       `json:"sensitive"`
}

type ListFilesInDirReq

type ListFilesInDirReq struct {
	FileKey string `form:"fileKey"`
	Limit   int    `form:"limit"`
	Page    int    `form:"page"`
}

type ListGalleriesCmd

type ListGalleriesCmd struct {
	Paging miso.Paging `json:"paging"`
}

type ListGalleryImagesCmd

type ListGalleryImagesCmd struct {
	GalleryNo   string `json:"galleryNo" validation:"notEmpty"`
	miso.Paging `json:"paging"`
}

type ListGalleryImagesResp

type ListGalleryImagesResp struct {
	Images []ImageInfo `json:"images"`
	Paging miso.Paging `json:"paging"`
}

func ListGalleryImages

func ListGalleryImages(rail miso.Rail, tx *gorm.DB, cmd ListGalleryImagesCmd, user common.User) (*ListGalleryImagesResp, error)

List gallery images

func ListGalleryImagesEp

func ListGalleryImagesEp(inb *miso.Inbound, cmd ListGalleryImagesCmd) (*ListGalleryImagesResp, error)

type ListGrantedFolderAccessReq

type ListGrantedFolderAccessReq struct {
	Page     miso.Paging `json:"paging"`
	FolderNo string      `json:"folderNo"`
}

type ListGrantedFolderAccessRes

type ListGrantedFolderAccessRes struct {
	Page    miso.Paging          `json:"paging"`
	Payload []ListedFolderAccess `json:"payload"`
}

func ListGrantedFolderAccess

func ListGrantedFolderAccess(rail miso.Rail, tx *gorm.DB, req ListGrantedFolderAccessReq, user common.User) (ListGrantedFolderAccessRes, error)

type ListGrantedGalleryAccessCmd

type ListGrantedGalleryAccessCmd struct {
	GalleryNo string `json:"galleryNo" validation:"notEmpty"`
	Paging    miso.Paging
}

type ListVFolderReq

type ListVFolderReq struct {
	Page miso.Paging `json:"paging"`
	Name string      `json:"name"`
}

type ListVFolderRes

type ListVFolderRes struct {
	Page    miso.Paging     `json:"paging"`
	Payload []ListedVFolder `json:"payload"`
}

func ListVFolders

func ListVFolders(rail miso.Rail, tx *gorm.DB, req ListVFolderReq, user common.User) (ListVFolderRes, error)

func ListVFoldersEp

func ListVFoldersEp(inb *miso.Inbound, req ListVFolderReq) (ListVFolderRes, error)

type ListedDir

type ListedDir struct {
	Id   int    `json:"id"`
	Uuid string `json:"uuid"`
	Name string `json:"name"`
}

func ListDirEp

func ListDirEp(inb *miso.Inbound) ([]ListedDir, error)

func ListDirs

func ListDirs(c miso.Rail, tx *gorm.DB, user common.User) ([]ListedDir, error)

type ListedFile

type ListedFile struct {
	Id             int        `json:"id"`
	Uuid           string     `json:"uuid"`
	Name           string     `json:"name"`
	UploadTime     miso.ETime `json:"uploadTime"`
	UploaderName   string     `json:"uploaderName"`
	SizeInBytes    int64      `json:"sizeInBytes"`
	FileType       string     `json:"fileType"`
	UpdateTime     miso.ETime `json:"updateTime"`
	ParentFileName string     `json:"parentFileName"`
	SensitiveMode  string     `json:"sensitiveMode"`
	ThumbnailToken string     `json:"thumbnailToken"`
	Thumbnail      string     `json:"-"`
	ParentFile     string     `json:"-"`
}

type ListedFolderAccess

type ListedFolderAccess struct {
	UserNo     string     `json:"userNo"`
	Username   string     `json:"username"`
	CreateTime miso.ETime `json:"createTime"`
}

type ListedGalleryAccessRes

type ListedGalleryAccessRes struct {
	Id         int
	GalleryNo  string
	UserNo     string
	Username   string
	CreateTime miso.ETime
}

type ListedVFolder

type ListedVFolder struct {
	Id         int        `json:"id"`
	FolderNo   string     `json:"folderNo"`
	Name       string     `json:"name"`
	CreateTime miso.ETime `json:"createTime"`
	CreateBy   string     `json:"createBy"`
	UpdateTime miso.ETime `json:"updateTime"`
	UpdateBy   string     `json:"updateBy"`
	Ownership  string     `json:"ownership"`
}

type MakeDirReq

type MakeDirReq struct {
	ParentFile string `json:"parentFile"`                 // Key of parent file
	Name       string `json:"name" validation:"notEmpty"` // name of the directory
}

type MoveIntoDirReq

type MoveIntoDirReq struct {
	Uuid           string `json:"uuid" validation:"notEmpty"`
	ParentFileUuid string `json:"parentFileUuid"`
}

type NotifyFileDeletedEvent

type NotifyFileDeletedEvent struct {
	FileKey string `json:"fileKey"`
}

type ParentFileInfo

type ParentFileInfo struct {
	Zero     bool   `json:"-"`
	FileKey  string `json:"fileKey"`
	Filename string `json:"fileName"`
}

func FindParentFile

func FindParentFile(c miso.Rail, tx *gorm.DB, req FetchParentFileReq, user common.User) (ParentFileInfo, error)

func GetParentFileEp

func GetParentFileEp(inb *miso.Inbound, req FetchParentFileReq) (*ParentFileInfo, error)

type PermitGalleryAccessCmd

type PermitGalleryAccessCmd struct {
	GalleryNo string `validation:"notEmpty"`
	Username  string `validation:"notEmpty"`
}

type PreflightCheckReq

type PreflightCheckReq struct {
	Filename      string `form:"fileName"`
	ParentFileKey string `form:"parentFileKey"`
}

type RemoveFileFromVfolderReq

type RemoveFileFromVfolderReq struct {
	FolderNo string   `json:"folderNo"`
	FileKeys []string `json:"fileKeys"`
}

type RemoveGalleryAccessCmd

type RemoveGalleryAccessCmd struct {
	GalleryNo string `json:"galleryNo" validation:"notEmpty"`
	UserNo    string `json:"userNo" validation:"notEmpty"`
}

type RemoveGrantedAccessReq

type RemoveGrantedAccessReq struct {
	FileId int `json:"fileId" validation:"positive"`
	UserId int `json:"userId" validation:"positive"`
}

type RemoveGrantedFolderAccessReq

type RemoveGrantedFolderAccessReq struct {
	FolderNo string `json:"folderNo"`
	UserNo   string `json:"userNo"`
}

type RemoveVFolderReq

type RemoveVFolderReq struct {
	FolderNo string
}

type SaveFileReq

type SaveFileReq struct {
	Filename   string
	FileId     string
	Size       int64
	ParentFile string
}

type ShareVfolderReq

type ShareVfolderReq struct {
	FolderNo string `json:"folderNo"`
	Username string `json:"username"`
}

type StreamEvent

type StreamEvent struct {
	Timestamp uint32                       `json:"timestamp"` // epoch time second
	Schema    string                       `json:"schema"`
	Table     string                       `json:"table"`
	Type      string                       `json:"type"`    // INS-INSERT, UPD-UPDATE, DEL-DELETE
	Columns   map[string]StreamEventColumn `json:"columns"` // key is the column name
}

type StreamEventColumn

type StreamEventColumn struct {
	DataType string `json:"dataType"`
	Before   string `json:"before"`
	After    string `json:"after"`
}

type ThumbnailInfo

type ThumbnailInfo struct {
	Name string
	Path string
}

type TransferGalleryImageInDirReq

type TransferGalleryImageInDirReq struct {
	// gallery no
	GalleryNo string `json:"galleryNo" validation:"notEmpty"`

	// file key of the directory
	FileKey string `json:"fileKey" validation:"notEmpty"`
}

type TransferGalleryImageReq

type TransferGalleryImageReq struct {
	Images []CreateGalleryImageCmd
}

type UnpackZipExtra

type UnpackZipExtra struct {
	FileKey       string // file key of the zip file
	ParentFileKey string // file key of the target directory
	UserNo        string
	Username      string
}

type UnpackZipReq

type UnpackZipReq struct {
	FileKey       string // file key of the zip file
	ParentFileKey string // file key of current directory (not where the zip entries will be saved)
}

type UpdateFileReq

type UpdateFileReq struct {
	Id            int `json:"id" validation:"positive"`
	Name          string
	SensitiveMode string
}

type UpdateGUAIsDelCmd

type UpdateGUAIsDelCmd struct {
	GalleryNo string
	UserNo    string
	IsDelFrom bool
	IsDelTo   bool
	UpdateBy  string
}

type UpdateGalleryCmd

type UpdateGalleryCmd struct {
	GalleryNo string `json:"galleryNo" validation:"notEmpty"`
	Name      string `json:"name" validation:"notEmpty"`
}

type UserVFolder

type UserVFolder struct {
	Id         int
	UserNo     string
	Username   string
	FolderNo   string
	Ownership  string
	GrantedBy  string // grantedBy (user_no)
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type VFolder

type VFolder struct {
	Id         int
	FolderNo   string
	Name       string
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type VFolderBrief

type VFolderBrief struct {
	FolderNo string `json:"folderNo"`
	Name     string `json:"name"`
}

func ListVFolderBrief

func ListVFolderBrief(rail miso.Rail, tx *gorm.DB, user common.User) ([]VFolderBrief, error)

func ListVFolderBriefEp

func ListVFolderBriefEp(inb *miso.Inbound) ([]VFolderBrief, error)

type VFolderWithOwnership

type VFolderWithOwnership struct {
	Id         int
	FolderNo   string
	Name       string
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
	Ownership  string
}

func (*VFolderWithOwnership) IsOwner

func (f *VFolderWithOwnership) IsOwner() bool

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 VGalleryBrief struct {
	GalleryNo string `json:"galleryNo"`
	Name      string `json:"name"`
}

func ListGalleryBriefsEp

func ListGalleryBriefsEp(inb *miso.Inbound) ([]VGalleryBrief, error)

func ListOwnedGalleryBriefs

func ListOwnedGalleryBriefs(rail miso.Rail, user common.User, tx *gorm.DB) ([]VGalleryBrief, error)

List owned gallery briefs

type ValidateFileOwnerReq

type ValidateFileOwnerReq struct {
	FileKey string `form:"fileKey"`
	UserNo  string `form:"userNo"`
}

Jump to

Keyboard shortcuts

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