services

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound  = errors.New("user not found")
	ErrWrongPassword = errors.New("wrong password")
)

Functions

func AuthAdmin

func AuthAdmin(userName, plainPassword, path string) (bool, error)

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func DeleteFiles

func DeleteFiles(files []models.File) error

func DeleteFolder

func DeleteFolder(folderID uuid.UUID) error

func GetAllFiles

func GetAllFiles() []models.File

func GetFileByID

func GetFileByID(id uuid.UUID) (*models.File, bool)

func GetFolderContentByID

func GetFolderContentByID(folderID uuid.UUID) ([]models.File, []models.Folder, error)

func HasPinCode

func HasPinCode(file *models.File) bool

func HashPassword

func HashPassword(password string) (string, error)

func SaveFile

func SaveFile(filename string, diskPath string, pinCode string, folderID *uuid.UUID) error

SaveFile persists metadata for a file that already exists on disk.

func SaveFolder

func SaveFolder(files []*multipart.FileHeader, pathsList []string, parentFolderID *uuid.UUID, pinCode string, displayName string) error

SaveFolder saves an entire folder structure with nested files and subfolders Parameters: - c: Gin context for accessing request data and multipart form - files: Array of file headers from the multipart form - pathsList: Array of relative paths corresponding to each file - parentFolderID: UUID of the parent folder where this structure will be created - pinCode: Optional PIN code for file protection Returns error if folder creation, file save, or database operations fail

func SaveUploadedFile

func SaveUploadedFile(file *multipart.FileHeader, dstPath string) error

SaveUploadedFile writes the multipart upload to disk (atomic via temp file + rename).

func SaveUploadedFileAndCreateRecord

func SaveUploadedFileAndCreateRecord(fileHeader *multipart.FileHeader, diskPath string, pinCode string, folderID *uuid.UUID, displayName string) error

SaveUploadedFileAndCreateRecord: 1) write to disk, 2) persist DB record, 3) cleanup disk file if DB step fails.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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