initmod

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemInitializedKey = "system.initialized"
)

Variables

This section is empty.

Functions

func NewInitModule

func NewInitModule(logger logging.Logger, deps *core.Dependencies) core.Module

Types

type AdminInput

type AdminInput struct {
	Username string `json:"username" validate:"required,min=3,max=50"`
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,min=6"`
	Nickname string `json:"nickname" validate:"required"`
}

AdminInput 管理员账号输入

type InitHandler

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

func NewInitHandler

func NewInitHandler(service *InitService, logger logging.Logger) *InitHandler

func (*InitHandler) Setup

func (h *InitHandler) Setup(w http.ResponseWriter, r *http.Request)

Setup performs the system initialization @Summary Initialize system @Description Initialize the system with platform super-admin account @Tags Initialization @Accept json @Produce json @Param request body InitSetupRequest true "Initialization data" @Success 200 {object} InitSetupResponse @Failure 400 {object} responder.Error @Failure 401 {object} responder.Error @Failure 500 {object} responder.Error @Router /init/setup [post]

func (*InitHandler) Status

func (h *InitHandler) Status(w http.ResponseWriter, r *http.Request)

Status checks the system initialization status @Summary Check initialization status @Description Check if the system has been initialized @Tags Initialization @Accept json @Produce json @Success 200 {object} InitStatusResponse @Failure 500 {object} responder.Error @Router /init/status [get]

type InitModule

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

func (*InitModule) Name

func (m *InitModule) Name() string

func (*InitModule) RegisterPrivateRoutes

func (m *InitModule) RegisterPrivateRoutes(r chi.Router)

RegisterPrivateRoutes - init module has no private routes

func (*InitModule) RegisterPublicRoutes

func (m *InitModule) RegisterPublicRoutes(r chi.Router)

RegisterPublicRoutes registers public init endpoints (status, setup)

type InitService

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

func NewInitService

func NewInitService(client *ent.Client, config *config.Config, logger logging.Logger, domainService core.DomainResolver) *InitService

func (*InitService) CheckStatus

func (s *InitService) CheckStatus(ctx context.Context) (*InitStatusResponse, error)

CheckStatus checks if the system is already initialized

func (*InitService) Initialize

func (s *InitService) Initialize(ctx context.Context, req *InitSetupRequest) (*InitSetupResponse, error)

Initialize performs the system initialization

type InitSetupRequest

type InitSetupRequest struct {
	InitKey string     `json:"initKey" validate:"required"`
	Admin   AdminInput `json:"admin" validate:"required"`
}

InitSetupRequest 初始化请求

type InitSetupResponse

type InitSetupResponse struct {
	AdminUser          *UserInfo `json:"adminUser"`
	RolesCreated       int       `json:"rolesCreated"`
	PermissionsCreated int       `json:"permissionsCreated"`
	Message            string    `json:"message"`
}

InitSetupResponse 初始化响应

type InitStatusResponse

type InitStatusResponse struct {
	Initialized bool   `json:"initialized"`
	Version     string `json:"version"`
}

InitStatusResponse 初始化状态响应

type UserInfo

type UserInfo struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Email    string `json:"email"`
}

UserInfo 用户信息

Jump to

Keyboard shortcuts

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