From 47602854a0a23514bc26169acb00fd34ce97328b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 16 Jan 2024 00:19:36 -0500 Subject: [PATCH] feat: bare bones account service --- account/account.go | 15 +++++++++++++++ cmd/portal/portal.go | 9 ++++++++- interfaces/account.go | 4 ++++ interfaces/portal.go | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 account/account.go create mode 100644 interfaces/account.go diff --git a/account/account.go b/account/account.go new file mode 100644 index 0000000..feb621f --- /dev/null +++ b/account/account.go @@ -0,0 +1,15 @@ +package account + +import "git.lumeweb.com/LumeWeb/portal/interfaces" + +var ( + _ interfaces.AccountService = (*AccountServiceImpl)(nil) +) + +type AccountServiceImpl struct { + portal interfaces.Portal +} + +func NewAccountService(portal interfaces.Portal) interfaces.AccountService { + return &AccountServiceImpl{portal: portal} +} diff --git a/cmd/portal/portal.go b/cmd/portal/portal.go index 2b82077..cc364be 100644 --- a/cmd/portal/portal.go +++ b/cmd/portal/portal.go @@ -2,6 +2,7 @@ package main import ( "crypto/ed25519" + "git.lumeweb.com/LumeWeb/portal/account" "git.lumeweb.com/LumeWeb/portal/api" "git.lumeweb.com/LumeWeb/portal/db" "git.lumeweb.com/LumeWeb/portal/interfaces" @@ -27,6 +28,7 @@ type PortalImpl struct { storage interfaces.StorageService database interfaces.Database casbin *casbin.Enforcer + accounts interfaces.AccountService } func (p *PortalImpl) Database() interfaces.Database { @@ -34,7 +36,6 @@ func (p *PortalImpl) Database() interfaces.Database { } func NewPortal() interfaces.Portal { - portal := &PortalImpl{ apiRegistry: api.NewRegistry(), protocolRegistry: protocols.NewProtocolRegistry(), @@ -44,8 +45,10 @@ func NewPortal() interfaces.Portal { storageServ := storage.NewStorageService(portal) database := db.NewDatabase(portal) + accountService := account.NewAccountService(portal) portal.storage = storageServ portal.database = database + portal.accounts = accountService return portal } @@ -112,3 +115,7 @@ func (p *PortalImpl) Casbin() *casbin.Enforcer { func (p *PortalImpl) SetCasbin(e *casbin.Enforcer) { p.casbin = e } + +func (p *PortalImpl) Accounts() interfaces.AccountService { + return p.accounts +} diff --git a/interfaces/account.go b/interfaces/account.go new file mode 100644 index 0000000..441020e --- /dev/null +++ b/interfaces/account.go @@ -0,0 +1,4 @@ +package interfaces + +type AccountService interface { +} diff --git a/interfaces/portal.go b/interfaces/portal.go index d258a88..4bf4c15 100644 --- a/interfaces/portal.go +++ b/interfaces/portal.go @@ -23,4 +23,5 @@ type Portal interface { Database() Database Casbin() *casbin.Enforcer SetCasbin(e *casbin.Enforcer) + Accounts() AccountService }