github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/internal/server/index.go (about)

     1  package server
     2  
     3  import (
     4  	consts "github.com/easysoft/zendata/internal/pkg/const"
     5  	"github.com/easysoft/zendata/internal/server/core/module"
     6  	"github.com/easysoft/zendata/internal/server/index"
     7  	"github.com/kataras/iris/v12"
     8  )
     9  
    10  type IndexModule struct {
    11  	CommModule  *index.CommModule  `inject:""`
    12  	DefModule   *index.DefModule   `inject:""`
    13  	AdminModule *index.AdminModule `inject:""`
    14  	DataModule  *index.DataModule  `inject:""`
    15  	MockModule  *index.MockModule  `inject:""`
    16  }
    17  
    18  func NewIndexModule() *IndexModule {
    19  	return &IndexModule{}
    20  }
    21  
    22  func (m *IndexModule) Party() module.WebModule {
    23  	handler := func(v1 iris.Party) {}
    24  
    25  	modules := []module.WebModule{
    26  		m.DefModule.Party(),
    27  		m.CommModule.Party(),
    28  		m.AdminModule.Party(),
    29  
    30  		m.MockModule.Party(),
    31  		m.MockModule.PartyData(),
    32  	}
    33  	return module.NewModule(consts.ApiPath, handler, modules...)
    34  }
    35  
    36  func (m *IndexModule) PartyData() module.WebModule {
    37  	handler := func(v1 iris.Party) {}
    38  
    39  	modules := []module.WebModule{
    40  		m.DataModule.Party(),
    41  	}
    42  	return module.NewModule("/data", handler, modules...)
    43  }
    44  
    45  func (m *IndexModule) PartyMock() module.WebModule {
    46  	handler := func(v1 iris.Party) {}
    47  
    48  	modules := []module.WebModule{
    49  		m.MockModule.Party(),
    50  	}
    51  	return module.NewModule("/mock", handler, modules...)
    52  }