소스 검색

feat: add system acc id to vo

ntorga 2 달 전
부모
커밋
385a3b37e0
2개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 8 7
      src/domain/valueObject/accountId.go
  2. 1 2
      src/infra/webServer/webServerSetup.go

+ 8 - 7
src/domain/valueObject/accountId.go

@@ -4,20 +4,21 @@ import (
 	"errors"
 	"strconv"
 
-	voHelper "github.com/goinfinite/os/src/domain/valueObject/helper"
+	tkVoUtil "github.com/goinfinite/tk/src/domain/valueObject/util"
 )
 
-type AccountId uint64
-
 var AccountIdSystem = AccountId(0)
+var AccountIdNobody = AccountId(65534)
+
+type AccountId uint64
 
-func NewAccountId(value interface{}) (accountId AccountId, err error) {
-	uintValue, err := voHelper.InterfaceToUint(value)
+func NewAccountId(rawValue any) (accountId AccountId, err error) {
+	uint64Value, err := tkVoUtil.InterfaceToUint64(rawValue)
 	if err != nil {
-		return accountId, errors.New("AccountIdMustBeUint")
+		return accountId, errors.New("AccountIdMustBeUint64")
 	}
 
-	return AccountId(uintValue), nil
+	return AccountId(uint64Value), nil
 }
 
 func (vo AccountId) Uint64() uint64 {

+ 1 - 2
src/infra/webServer/webServerSetup.go

@@ -16,7 +16,6 @@ import (
 	o11yInfra "github.com/goinfinite/os/src/infra/o11y"
 	servicesInfra "github.com/goinfinite/os/src/infra/services"
 	vhostInfra "github.com/goinfinite/os/src/infra/vhost"
-	"github.com/goinfinite/os/src/presentation/service"
 )
 
 type WebServerSetup struct {
@@ -138,7 +137,7 @@ func (ws *WebServerSetup) FirstSetup() {
 	updateServiceDto := dto.NewUpdateService(
 		nginxServiceName, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
 		nil, nil, &nginxAutoStart, nil, nil, nil, nil, nil, nil,
-		service.LocalOperatorAccountId, service.LocalOperatorIpAddress,
+		valueObject.AccountIdSystem, valueObject.IpAddressSystem,
 	)
 	err = servicesCmdRepo.Update(updateServiceDto)
 	if err != nil {