services

package
v1.0.80 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitServices

func InitServices(ctx *core.APPContext)

Types

type AsyncTaskService

type AsyncTaskService struct {
	BaseService
}

AsyncTaskService handles business logic for async tasks

func (*AsyncTaskService) CreateTask

func (s *AsyncTaskService) CreateTask(taskType models.TaskType, resourceID, userID string) (models.AsyncTask, error)

CreateTask creates a new async task

func (*AsyncTaskService) GetTaskByID

func (s *AsyncTaskService) GetTaskByID(id string) (models.AsyncTask, error)

GetTaskByID returns a specific task by ID

func (*AsyncTaskService) GetTasksByResource

func (s *AsyncTaskService) GetTasksByResource(resourceID string) ([]models.AsyncTask, error)

GetTasksByResource returns all tasks for a specific resource

func (*AsyncTaskService) GetTasksByUser

func (s *AsyncTaskService) GetTasksByUser(userID string) ([]models.AsyncTask, error)

GetTasksByUser returns all tasks for a specific user

func (*AsyncTaskService) Init

func (s *AsyncTaskService) Init(ctx *core.APPContext)

func (*AsyncTaskService) UpdateTaskStatus

func (s *AsyncTaskService) UpdateTaskStatus(id string, status models.TaskStatus, message string) error

UpdateTaskStatus updates the status of a task

type BaseService

type BaseService struct {
	// contains filtered or unexported fields
}

func (*BaseService) InitService

func (s *BaseService) InitService(name string, ctx *core.APPContext, instance Service)

type Collection

type Collection struct {
	Name              string             `yaml:"name"`
	Label             string             `yaml:"label"`
	Path              string             `yaml:"path"`
	Format            string             `yaml:"format"`
	FileNameGenerator *FileNameGenerator `yaml:"file_name_generator"`
	Fields            []Field            `yaml:"fields,omitempty"`
}

Collection represents a collection in veda/config.yml

type EventService

type EventService struct {
	BaseService
}

EventService handles business logic for events

func (*EventService) CreateEvent

func (s *EventService) CreateEvent(request models.CreateEventRequest) (models.Event, error)

CreateEvent creates a new event

func (*EventService) Init

func (s *EventService) Init(ctx *core.APPContext)

type Field

type Field struct {
	Type     string `yaml:"type" json:"type"`
	Name     string `yaml:"name" json:"name"`
	Label    string `yaml:"label" json:"label"`
	Required bool   `yaml:"required,omitempty" json:"required"`
	Format   string `yaml:"format,omitempty" json:"format"`
	List     bool   `yaml:"list,omitempty" json:"list"`
	Default  string `yaml:"default,omitempty" json:"default"`
}

Field represents a field in a collection

type FileInfo

type FileInfo struct {
	Name      string    `json:"name"`
	Path      string    `json:"path"`
	IsDir     bool      `json:"is_dir"`
	IsDraft   bool      `json:"is_draft"`
	Size      int64     `json:"size"`
	ModTime   time.Time `json:"mod_time"`
	Extension string    `json:"extension,omitempty"`
}

FileInfo represents information about a file or directory

type FileNameGenerator added in v1.0.48

type FileNameGenerator struct {
	Type  string `yaml:"type" json:"type"`
	First string `yaml:"first" json:"first"`
}

type MetricsService added in v1.0.50

type MetricsService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*MetricsService) Handler added in v1.0.77

func (m *MetricsService) Handler() http.Handler

func (*MetricsService) Init added in v1.0.50

func (m *MetricsService) Init(ctx *core.APPContext)

func (*MetricsService) Middleware added in v1.0.79

func (m *MetricsService) Middleware() gin.HandlerFunc

type MinIOService

type MinIOService struct {
	BaseService
	MinIO *minio.Client
}

func (*MinIOService) BucketExists

func (s *MinIOService) BucketExists(bucketName string) (bool, error)

func (*MinIOService) DeleteFile

func (s *MinIOService) DeleteFile(name string, path string) error

func (*MinIOService) DownloadFile

func (s *MinIOService) DownloadFile(name string, path string) (*minio.Object, error)

func (*MinIOService) Init

func (s *MinIOService) Init(ctx *core.APPContext)

func (*MinIOService) UploadFile

func (s *MinIOService) UploadFile(name string, objectName string, file *multipart.FileHeader) (minio.UploadInfo, error)

type Service

type Service interface {
	Init(ctx *core.APPContext)
}

type SiteService

type SiteService struct {
	BaseService
}

func (*SiteService) AllowUserRegistration

func (s *SiteService) AllowUserRegistration() bool

func (*SiteService) GetSiteConfig

func (s *SiteService) GetSiteConfig(key string) (*models.SiteSetting, error)

func (*SiteService) Init

func (s *SiteService) Init(ctx *core.APPContext)

type StorageService

type StorageService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*StorageService) AttachFile

func (s *StorageService) AttachFile(userId string, files []*multipart.FileHeader) (map[string]interface{}, error)

func (*StorageService) GetAttachedFile

func (s *StorageService) GetAttachedFile(userId string, filePath string, eTag string) (*models.UserStorageFile, *minio.Object, error)

func (*StorageService) Init

func (s *StorageService) Init(ctx *core.APPContext)

type UserFileDraftStatusService added in v1.0.42

type UserFileDraftStatusService struct {
	BaseService
}

func (*UserFileDraftStatusService) GetDraftStatus added in v1.0.42

func (s *UserFileDraftStatusService) GetDraftStatus(userId string, repoId uint, collectionName string) (map[string]bool, error)

func (*UserFileDraftStatusService) Init added in v1.0.42

func (*UserFileDraftStatusService) RenameFile added in v1.0.42

func (s *UserFileDraftStatusService) RenameFile(userId string, repoId uint, collectionName string, oldPath string, newPath string) error

func (*UserFileDraftStatusService) SetDraftStatus added in v1.0.42

func (s *UserFileDraftStatusService) SetDraftStatus(userId string, repoId uint, collectionName string, filePath string, draft bool) error

type UserGitRepoCollectionService

type UserGitRepoCollectionService struct {
	BaseService
	// contains filtered or unexported fields
}

UserGitRepoCollectionService handles business logic for git repository collections

func (*UserGitRepoCollectionService) CommitWithGithubApp

func (s *UserGitRepoCollectionService) CommitWithGithubApp(repo models.UserGitRepo, message string) error

CommitWithGithubApp commits changes using GitHub app authentication

func (*UserGitRepoCollectionService) CreateFolder

func (s *UserGitRepoCollectionService) CreateFolder(repo *models.UserGitRepo, name string, path string, folder string) error

func (*UserGitRepoCollectionService) DeleteFile

func (s *UserGitRepoCollectionService) DeleteFile(repo *models.UserGitRepo, collectionName string, filePath string) error

DeleteFile deletes a file or directory within a collection

func (*UserGitRepoCollectionService) GetAllCollections

func (s *UserGitRepoCollectionService) GetAllCollections() ([]models.UserGitRepoCollection, error)

GetAllCollections returns all collections

func (*UserGitRepoCollectionService) GetCollectionByID

GetCollectionByID returns a specific collection by ID

func (*UserGitRepoCollectionService) GetCollectionByName

GetCollectionByName returns a collection by its name within a repository

func (*UserGitRepoCollectionService) GetCollectionByPath

func (s *UserGitRepoCollectionService) GetCollectionByPath(repoID uint, path string) (models.UserGitRepoCollection, error)

GetCollectionByPath returns a collection by its path within a repository

func (*UserGitRepoCollectionService) GetCollectionsByRepo

GetCollectionsByRepo returns all collections for a specific repository

func (*UserGitRepoCollectionService) GetCollectionsByRepoID

func (s *UserGitRepoCollectionService) GetCollectionsByRepoID(repoID uint) ([]models.UserGitRepoCollection, error)

GetCollectionsByRepoID returns all collections for a specific repository

func (*UserGitRepoCollectionService) GetFileContent

func (s *UserGitRepoCollectionService) GetFileContent(repo *models.UserGitRepo, collectionName string, filePath string) ([]byte, string, error)

GetFileContent retrieves the content of a file within a collection

func (*UserGitRepoCollectionService) GetRepo

func (*UserGitRepoCollectionService) Init

func (*UserGitRepoCollectionService) ListFilesInCollection

func (s *UserGitRepoCollectionService) ListFilesInCollection(repo *models.UserGitRepo, collectionName string) ([]FileInfo, error)

ListFilesInCollection lists all files under a collection path

func (*UserGitRepoCollectionService) ListFilesInPath

func (s *UserGitRepoCollectionService) ListFilesInPath(repo *models.UserGitRepo, collectionName string, subPath string) ([]FileInfo, error)

ListFilesInPath lists all files under a specific path within a collection

func (*UserGitRepoCollectionService) RenameFile

func (s *UserGitRepoCollectionService) RenameFile(repo *models.UserGitRepo, collectionName string, oldPath string, newPath string) error

RenameFile renames a file in a collection

func (*UserGitRepoCollectionService) UpdateFileContent

func (s *UserGitRepoCollectionService) UpdateFileContent(repo *models.UserGitRepo, collectionName string, filePath string, content []byte, isDraft *bool) error

UpdateFileContent updates the content of a file within a collection

func (*UserGitRepoCollectionService) VerifyRepoOwnership

func (s *UserGitRepoCollectionService) VerifyRepoOwnership(userID string, repoID uint) (*models.UserGitRepo, error)

type UserGitRepoLockService

type UserGitRepoLockService struct {
	BaseService
	// contains filtered or unexported fields
}

func (*UserGitRepoLockService) Acquire

func (s *UserGitRepoLockService) Acquire(repoID string) *sync.Mutex

func (*UserGitRepoLockService) Init

func (s *UserGitRepoLockService) Init(ctx *core.APPContext)

type UserGitRepoService

type UserGitRepoService struct {
	BaseService
	// contains filtered or unexported fields
}

UserGitRepoService handles business logic for git repositories

func (*UserGitRepoService) CheckWebHooks

func (s *UserGitRepoService) CheckWebHooks(repo *models.UserGitRepo) error

func (*UserGitRepoService) CreateRepo

func (s *UserGitRepoService) CreateRepo(repo *models.UserGitRepo) error

CreateRepo creates a new git repository

func (*UserGitRepoService) DeleteRepo

func (s *UserGitRepoService) DeleteRepo(repo *models.UserGitRepo) error

DeleteRepo deletes a git repository

func (*UserGitRepoService) GetAllRepos

func (s *UserGitRepoService) GetAllRepos() ([]models.UserGitRepo, error)

GetAllRepos returns all git repositories

func (*UserGitRepoService) GetInstallationToken

func (s *UserGitRepoService) GetInstallationToken(installationID int64) (*github.InstallationToken, error)

GetInstallationToken gets a GitHub app token for the repository

func (*UserGitRepoService) GetRepoBranches

func (s *UserGitRepoService) GetRepoBranches(repo *models.UserGitRepo) ([]string, error)

GetRepoBranches returns all branches for a specific git repository

func (*UserGitRepoService) GetRepoByID

func (s *UserGitRepoService) GetRepoByID(id string) (models.UserGitRepo, error)

GetRepoByID returns a specific git repository by ID

func (*UserGitRepoService) GetReposByURL

func (s *UserGitRepoService) GetReposByURL(url string) ([]models.UserGitRepo, error)

GetReposByURL returns repositories that match a specific remote URL

func (*UserGitRepoService) GetReposByUser

func (s *UserGitRepoService) GetReposByUser(userID string) ([]models.UserGitRepo, error)

GetReposByUser returns all git repositories for a specific user

func (*UserGitRepoService) Init

func (s *UserGitRepoService) Init(ctx *core.APPContext)

func (*UserGitRepoService) SyncRepo

func (s *UserGitRepoService) SyncRepo(repo *models.UserGitRepo, commitId string) error

SyncRepo synchronizes a git repository with its remote

func (*UserGitRepoService) UpdateRepo

UpdateRepo updates an existing git repository

func (*UserGitRepoService) UpdateRepoStatus

func (s *UserGitRepoService) UpdateRepoStatus(repo *models.UserGitRepo, status models.GitRepoStatus, errorMsg string) error

UpdateRepoStatus updates the status of a git repository

type UserService

type UserService struct {
	BaseService
	// contains filtered or unexported fields
}

UserService handles business logic related to users

func (*UserService) CreateOrUpdateUser

func (s *UserService) CreateOrUpdateUser(user *models.User) (*models.User, error)

CreateOrUpdateUser creates a new user or updates an existing one based on email

func (*UserService) CreateUserStorage

func (s *UserService) CreateUserStorage(storge *models.UserStorage) (*models.UserStorage, error)

func (*UserService) CreateUserStorageFile

func (s *UserService) CreateUserStorageFile(file *models.UserStorageFile) (*models.UserStorageFile, error)

func (*UserService) GetUserByID

func (s *UserService) GetUserByID(id string) (*models.User, error)

GetUserByID retrieves a user by ID

func (*UserService) GetUserStorage

func (s *UserService) GetUserStorage(userId string) (*models.UserStorage, error)

func (*UserService) GetUserStorageFile

func (s *UserService) GetUserStorageFile(id string, path string) (*models.UserStorageFile, error)

func (*UserService) Init

func (s *UserService) Init(ctx *core.APPContext)

type VedaConfig

type VedaConfig struct {
	Collections []Collection `yaml:"collections"`
	MDConfig    *md.MDConfig `yaml:"md_config"`
}

VedaConfig represents the structure of veda/config.yml

Jump to

Keyboard shortcuts

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