feat: bare bones account service

This commit is contained in:
Derrick Hammer 2024-01-16 00:19:36 -05:00
parent 4a408a179d
commit 47602854a0
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
4 changed files with 28 additions and 1 deletions

15
account/account.go Normal file
View File

@ -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}
}

View File

@ -2,6 +2,7 @@ package main
import ( import (
"crypto/ed25519" "crypto/ed25519"
"git.lumeweb.com/LumeWeb/portal/account"
"git.lumeweb.com/LumeWeb/portal/api" "git.lumeweb.com/LumeWeb/portal/api"
"git.lumeweb.com/LumeWeb/portal/db" "git.lumeweb.com/LumeWeb/portal/db"
"git.lumeweb.com/LumeWeb/portal/interfaces" "git.lumeweb.com/LumeWeb/portal/interfaces"
@ -27,6 +28,7 @@ type PortalImpl struct {
storage interfaces.StorageService storage interfaces.StorageService
database interfaces.Database database interfaces.Database
casbin *casbin.Enforcer casbin *casbin.Enforcer
accounts interfaces.AccountService
} }
func (p *PortalImpl) Database() interfaces.Database { func (p *PortalImpl) Database() interfaces.Database {
@ -34,7 +36,6 @@ func (p *PortalImpl) Database() interfaces.Database {
} }
func NewPortal() interfaces.Portal { func NewPortal() interfaces.Portal {
portal := &PortalImpl{ portal := &PortalImpl{
apiRegistry: api.NewRegistry(), apiRegistry: api.NewRegistry(),
protocolRegistry: protocols.NewProtocolRegistry(), protocolRegistry: protocols.NewProtocolRegistry(),
@ -44,8 +45,10 @@ func NewPortal() interfaces.Portal {
storageServ := storage.NewStorageService(portal) storageServ := storage.NewStorageService(portal)
database := db.NewDatabase(portal) database := db.NewDatabase(portal)
accountService := account.NewAccountService(portal)
portal.storage = storageServ portal.storage = storageServ
portal.database = database portal.database = database
portal.accounts = accountService
return portal return portal
} }
@ -112,3 +115,7 @@ func (p *PortalImpl) Casbin() *casbin.Enforcer {
func (p *PortalImpl) SetCasbin(e *casbin.Enforcer) { func (p *PortalImpl) SetCasbin(e *casbin.Enforcer) {
p.casbin = e p.casbin = e
} }
func (p *PortalImpl) Accounts() interfaces.AccountService {
return p.accounts
}

4
interfaces/account.go Normal file
View File

@ -0,0 +1,4 @@
package interfaces
type AccountService interface {
}

View File

@ -23,4 +23,5 @@ type Portal interface {
Database() Database Database() Database
Casbin() *casbin.Enforcer Casbin() *casbin.Enforcer
SetCasbin(e *casbin.Enforcer) SetCasbin(e *casbin.Enforcer)
Accounts() AccountService
} }