kopia lustrzana https://github.com/reiver/greatape
refactor(project): 🎨 improve format and structure of the code
rodzic
30c7d0e48f
commit
081f5a33f3
|
@ -1,4 +0,0 @@
|
|||
google.golang.org/protobuf version=1.28.1 url=https://github.com/protocolbuffers/protobuf-go
|
||||
github.com/gorilla/websocket version=1.5.0 url=https://github.com/gorilla/websocket
|
||||
github.com/gorilla/securecookie version=1.1.1 url=https://github.com/gorilla/securecookie
|
||||
gopkg.in/yaml.v2 version=2.4.0 url=https://github.com/go-yaml/yaml
|
|
@ -1,14 +1,14 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
import . "github.com/reiver/greatape/components/contracts"
|
||||
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
)
|
||||
|
||||
//go:embed _packages.txt
|
||||
var packages []byte
|
||||
const packages = `
|
||||
google.golang.org/protobuf version=1.28.1 url=https://github.com/protocolbuffers/protobuf-go
|
||||
github.com/gorilla/websocket version=1.5.0 url=https://github.com/gorilla/websocket
|
||||
github.com/gorilla/securecookie version=1.1.1 url=https://github.com/gorilla/securecookie
|
||||
gopkg.in/yaml.v2 version=2.4.0 url=https://github.com/go-yaml/yaml
|
||||
`
|
||||
|
||||
func GetPackages(x IDispatcher) (IGetPackagesResult, error) {
|
||||
return x.NewGetPackagesResult(packages), nil
|
||||
return x.NewGetPackagesResult([]byte(packages)), nil
|
||||
}
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *authorizeInteractionOperation) OutputContainer() Pointer {
|
|||
func (operation *authorizeInteractionOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*AuthorizeInteractionRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *authorizeInteractionOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *changePasswordOperation) OutputContainer() Pointer {
|
|||
func (operation *changePasswordOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*ChangePasswordRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *changePasswordOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *checkUsernameAvailabilityOperation) OutputContainer() Pointer {
|
|||
func (operation *checkUsernameAvailabilityOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*CheckUsernameAvailabilityRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *checkUsernameAvailabilityOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *echoOperation) OutputContainer() Pointer {
|
|||
func (operation *echoOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*EchoRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *echoOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *followActorOperation) OutputContainer() Pointer {
|
|||
func (operation *followActorOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*FollowActorRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *followActorOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getActorOperation) OutputContainer() Pointer {
|
|||
func (operation *getActorOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetActorRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getActorOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getFollowersOperation) OutputContainer() Pointer {
|
|||
func (operation *getFollowersOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetFollowersRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getFollowersOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getFollowingOperation) OutputContainer() Pointer {
|
|||
func (operation *getFollowingOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetFollowingRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getFollowingOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getInboxOperation) OutputContainer() Pointer {
|
|||
func (operation *getInboxOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetInboxRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getInboxOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getOutboxOperation) OutputContainer() Pointer {
|
|||
func (operation *getOutboxOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetOutboxRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getOutboxOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getPackagesOperation) OutputContainer() Pointer {
|
|||
func (operation *getPackagesOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetPackagesRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getPackagesOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *getProfileByUserOperation) OutputContainer() Pointer {
|
|||
func (operation *getProfileByUserOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*GetProfileByUserRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *getProfileByUserOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *loginOperation) OutputContainer() Pointer {
|
|||
func (operation *loginOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*LoginRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *loginOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *logoutOperation) OutputContainer() Pointer {
|
|||
func (operation *logoutOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*LogoutRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *logoutOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *postToInboxOperation) OutputContainer() Pointer {
|
|||
func (operation *postToInboxOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*PostToInboxRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *postToInboxOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *postToOutboxOperation) OutputContainer() Pointer {
|
|||
func (operation *postToOutboxOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*PostToOutboxRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *postToOutboxOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *resetPasswordOperation) OutputContainer() Pointer {
|
|||
func (operation *resetPasswordOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*ResetPasswordRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *resetPasswordOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *signupOperation) OutputContainer() Pointer {
|
|||
func (operation *signupOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*SignupRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *signupOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *updateProfileByUserOperation) OutputContainer() Pointer {
|
|||
func (operation *updateProfileByUserOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*UpdateProfileByUserRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *updateProfileByUserOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *verifyOperation) OutputContainer() Pointer {
|
|||
func (operation *verifyOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*VerifyRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *verifyOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,15 +37,3 @@ func (operation *webfingerOperation) OutputContainer() Pointer {
|
|||
func (operation *webfingerOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
|
||||
return operation.run(context, payload.(*WebfingerRequest))
|
||||
}
|
||||
|
||||
/*
|
||||
func (operation *webfingerOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
|
||||
var (
|
||||
TIME_LIMIT_WARNING Duration = 20_000_000
|
||||
TIME_LIMIT_ALERT Duration = 35_000_000
|
||||
TIME_LIMIT_CRITICAL Duration = 50_000_000
|
||||
)
|
||||
|
||||
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -3,27 +3,22 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func AuthorizeInteractionService(context IContext, input *AuthorizeInteractionRequest) (result *AuthorizeInteractionResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "authorize_interaction"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "authorize_interaction", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "authorize_interaction", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.AuthorizeInteraction(input.Uri, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.AuthorizeInteraction(input.Uri, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*AuthorizeInteractionResult)
|
||||
result.Uri = _result.Uri()
|
||||
result.Success = _result.Success()
|
||||
result.Uri = commandResult.Uri()
|
||||
result.Success = commandResult.Success()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,25 +3,19 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func ChangePasswordService(context IContext, input *ChangePasswordRequest) (result *ChangePasswordResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "change_password"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "change_password", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "change_password", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.ChangePassword(input.CurrentPassword, input.NewPassword, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
if _, err = Conductor.ChangePassword(input.CurrentPassword, input.NewPassword, context.Identity()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*ChangePasswordResult)
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,26 +3,21 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func CheckUsernameAvailabilityService(context IContext, input *CheckUsernameAvailabilityRequest) (result *CheckUsernameAvailabilityResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "check_username_availability"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "check_username_availability", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "check_username_availability", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.CheckUsernameAvailability(input.Username, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.CheckUsernameAvailability(input.Username, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*CheckUsernameAvailabilityResult)
|
||||
result.IsAvailable = _result.IsAvailable()
|
||||
result.IsAvailable = commandResult.IsAvailable()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,39 +3,34 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func EchoService(context IContext, input *EchoRequest) (result *EchoResult, err error) {
|
||||
conductor := core.Conductor
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "echo", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "echo", input, result, err) }()
|
||||
source := "echo"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
var inputDocument IDocument
|
||||
if input.Document != nil {
|
||||
var err error
|
||||
if inputDocument, err = conductor.NewDocument(input.Document.Id, input.Document.Content); err == nil {
|
||||
if inputDocument, err = Conductor.NewDocument(input.Document.Id, input.Document.Content); err == nil {
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
_result, _err := conductor.Echo(inputDocument, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.Echo(inputDocument, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
var outputDocument *Document = nil
|
||||
if _result.Document() != nil {
|
||||
if commandResult.Document() != nil {
|
||||
outputDocument = &Document{
|
||||
Id: _result.Document().Id(),
|
||||
Content: _result.Document().Content(),
|
||||
Id: commandResult.Document().Id(),
|
||||
Content: commandResult.Document().Content(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,26 +3,21 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func FollowActorService(context IContext, input *FollowActorRequest) (result *FollowActorResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "follow_actor"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "follow_actor", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "follow_actor", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.FollowActor(input.Username, input.Acct, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.FollowActor(input.Username, input.Acct, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*FollowActorResult)
|
||||
result.Url = _result.Url()
|
||||
result.Url = commandResult.Url()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,71 +3,66 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetActorService(context IContext, input *GetActorRequest) (result *GetActorResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_actor"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_actor", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_actor", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetActor(input.Username, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetActor(input.Username, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
var outputIcon *ActivityPubMedia = nil
|
||||
if _result.Icon() != nil {
|
||||
if commandResult.Icon() != nil {
|
||||
outputIcon = &ActivityPubMedia{
|
||||
MediaType: _result.Icon().MediaType(),
|
||||
Type: _result.Icon().Type(),
|
||||
Url: _result.Icon().Url(),
|
||||
Width: _result.Icon().Width(),
|
||||
Height: _result.Icon().Height(),
|
||||
MediaType: commandResult.Icon().MediaType(),
|
||||
Type: commandResult.Icon().Type(),
|
||||
Url: commandResult.Icon().Url(),
|
||||
Width: commandResult.Icon().Width(),
|
||||
Height: commandResult.Icon().Height(),
|
||||
}
|
||||
}
|
||||
|
||||
var outputImage *ActivityPubMedia = nil
|
||||
if _result.Image() != nil {
|
||||
if commandResult.Image() != nil {
|
||||
outputImage = &ActivityPubMedia{
|
||||
MediaType: _result.Image().MediaType(),
|
||||
Type: _result.Image().Type(),
|
||||
Url: _result.Image().Url(),
|
||||
Width: _result.Image().Width(),
|
||||
Height: _result.Image().Height(),
|
||||
MediaType: commandResult.Image().MediaType(),
|
||||
Type: commandResult.Image().Type(),
|
||||
Url: commandResult.Image().Url(),
|
||||
Width: commandResult.Image().Width(),
|
||||
Height: commandResult.Image().Height(),
|
||||
}
|
||||
}
|
||||
|
||||
var outputPublicKey *ActivityPubPublicKey = nil
|
||||
if _result.PublicKey() != nil {
|
||||
if commandResult.PublicKey() != nil {
|
||||
outputPublicKey = &ActivityPubPublicKey{
|
||||
Id: _result.PublicKey().Id(),
|
||||
Owner: _result.PublicKey().Owner(),
|
||||
PublicKeyPem: _result.PublicKey().PublicKeyPem(),
|
||||
Id: commandResult.PublicKey().Id(),
|
||||
Owner: commandResult.PublicKey().Owner(),
|
||||
PublicKeyPem: commandResult.PublicKey().PublicKeyPem(),
|
||||
}
|
||||
}
|
||||
|
||||
result = context.ResultContainer().(*GetActorResult)
|
||||
result.Context = _result.Context()
|
||||
result.Id = _result.Id()
|
||||
result.Followers = _result.Followers()
|
||||
result.Following = _result.Following()
|
||||
result.Inbox = _result.Inbox()
|
||||
result.Outbox = _result.Outbox()
|
||||
result.Name = _result.Name()
|
||||
result.PreferredUsername = _result.PreferredUsername()
|
||||
result.Type = _result.Type()
|
||||
result.Url = _result.Url()
|
||||
result.Context = commandResult.Context()
|
||||
result.Id = commandResult.Id()
|
||||
result.Followers = commandResult.Followers()
|
||||
result.Following = commandResult.Following()
|
||||
result.Inbox = commandResult.Inbox()
|
||||
result.Outbox = commandResult.Outbox()
|
||||
result.Name = commandResult.Name()
|
||||
result.PreferredUsername = commandResult.PreferredUsername()
|
||||
result.Type = commandResult.Type()
|
||||
result.Url = commandResult.Url()
|
||||
result.Icon = outputIcon
|
||||
result.Image = outputImage
|
||||
result.PublicKey = outputPublicKey
|
||||
result.Summary = _result.Summary()
|
||||
result.Published = _result.Published()
|
||||
result.Summary = commandResult.Summary()
|
||||
result.Published = commandResult.Published()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,31 +3,26 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetFollowersService(context IContext, input *GetFollowersRequest) (result *GetFollowersResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_followers"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_followers", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_followers", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetFollowers(input.Username, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetFollowers(input.Username, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*GetFollowersResult)
|
||||
result.Context = _result.Context()
|
||||
result.Id = _result.Id()
|
||||
result.Type = _result.Type()
|
||||
result.TotalItems = _result.TotalItems()
|
||||
result.OrderedItems = _result.OrderedItems()
|
||||
result.First = _result.First()
|
||||
result.Context = commandResult.Context()
|
||||
result.Id = commandResult.Id()
|
||||
result.Type = commandResult.Type()
|
||||
result.TotalItems = commandResult.TotalItems()
|
||||
result.OrderedItems = commandResult.OrderedItems()
|
||||
result.First = commandResult.First()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,31 +3,26 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetFollowingService(context IContext, input *GetFollowingRequest) (result *GetFollowingResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_following"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_following", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_following", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetFollowing(input.Username, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetFollowing(input.Username, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*GetFollowingResult)
|
||||
result.Context = _result.Context()
|
||||
result.Id = _result.Id()
|
||||
result.Type = _result.Type()
|
||||
result.TotalItems = _result.TotalItems()
|
||||
result.OrderedItems = _result.OrderedItems()
|
||||
result.First = _result.First()
|
||||
result.Context = commandResult.Context()
|
||||
result.Id = commandResult.Id()
|
||||
result.Type = commandResult.Type()
|
||||
result.TotalItems = commandResult.TotalItems()
|
||||
result.OrderedItems = commandResult.OrderedItems()
|
||||
result.First = commandResult.First()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,27 +3,22 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetInboxService(context IContext, input *GetInboxRequest) (result *GetInboxResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_inbox"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_inbox", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_inbox", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetInbox(input.Username, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetInbox(input.Username, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
outputOrderedItems := make([]*ActivityPubActivity, 0)
|
||||
for _, orderedItem := range _result.OrderedItems() {
|
||||
for _, orderedItem := range commandResult.OrderedItems() {
|
||||
if orderedItem == nil {
|
||||
continue
|
||||
}
|
||||
|
@ -58,11 +53,11 @@ func GetInboxService(context IContext, input *GetInboxRequest) (result *GetInbox
|
|||
}
|
||||
|
||||
result = context.ResultContainer().(*GetInboxResult)
|
||||
result.Context = _result.Context()
|
||||
result.Id = _result.Id()
|
||||
result.Type = _result.Type()
|
||||
result.TotalItems = _result.TotalItems()
|
||||
result.Context = commandResult.Context()
|
||||
result.Id = commandResult.Id()
|
||||
result.Type = commandResult.Type()
|
||||
result.TotalItems = commandResult.TotalItems()
|
||||
result.OrderedItems = outputOrderedItems
|
||||
result.First = _result.First()
|
||||
result.First = commandResult.First()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,27 +3,22 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetOutboxService(context IContext, input *GetOutboxRequest) (result *GetOutboxResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_outbox"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_outbox", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_outbox", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetOutbox(input.Username, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetOutbox(input.Username, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
outputOrderedItems := make([]*ActivityPubActivity, 0)
|
||||
for _, orderedItem := range _result.OrderedItems() {
|
||||
for _, orderedItem := range commandResult.OrderedItems() {
|
||||
if orderedItem == nil {
|
||||
continue
|
||||
}
|
||||
|
@ -58,11 +53,11 @@ func GetOutboxService(context IContext, input *GetOutboxRequest) (result *GetOut
|
|||
}
|
||||
|
||||
result = context.ResultContainer().(*GetOutboxResult)
|
||||
result.Context = _result.Context()
|
||||
result.Id = _result.Id()
|
||||
result.Type = _result.Type()
|
||||
result.TotalItems = _result.TotalItems()
|
||||
result.Context = commandResult.Context()
|
||||
result.Id = commandResult.Id()
|
||||
result.Type = commandResult.Type()
|
||||
result.TotalItems = commandResult.TotalItems()
|
||||
result.OrderedItems = outputOrderedItems
|
||||
result.First = _result.First()
|
||||
result.First = commandResult.First()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,26 +3,21 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetPackagesService(context IContext, input *GetPackagesRequest) (result *GetPackagesResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_packages"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_packages", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_packages", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetPackages(context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetPackages(context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*GetPackagesResult)
|
||||
result.Body = _result.Body()
|
||||
result.Body = commandResult.Body()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,31 +3,26 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func GetProfileByUserService(context IContext, input *GetProfileByUserRequest) (result *GetProfileByUserResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "get_profile_by_user"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "get_profile_by_user", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_profile_by_user", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.GetProfileByUser(context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.GetProfileByUser(context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*GetProfileByUserResult)
|
||||
result.Username = _result.Username()
|
||||
result.DisplayName = _result.DisplayName()
|
||||
result.Avatar = _result.Avatar()
|
||||
result.Banner = _result.Banner()
|
||||
result.Summary = _result.Summary()
|
||||
result.Github = _result.Github()
|
||||
result.Username = commandResult.Username()
|
||||
result.DisplayName = commandResult.DisplayName()
|
||||
result.Avatar = commandResult.Avatar()
|
||||
result.Banner = commandResult.Banner()
|
||||
result.Summary = commandResult.Summary()
|
||||
result.Github = commandResult.Github()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,28 +3,23 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func LoginService(context IContext, input *LoginRequest) (result *LoginResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "login"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "login", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "login", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.Login(input.Email, input.Password, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.Login(input.Email, input.Password, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
context.SetCookie("Diamante", _result.Token())
|
||||
context.SetCookie("Diamante", commandResult.Token())
|
||||
result = context.ResultContainer().(*LoginResult)
|
||||
result.Username = _result.Username()
|
||||
result.Token = _result.Token()
|
||||
result.Username = commandResult.Username()
|
||||
result.Token = commandResult.Token()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,25 +3,19 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func LogoutService(context IContext, input *LogoutRequest) (result *LogoutResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "logout"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "logout", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "logout", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.Logout(context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
if _, err = Conductor.Logout(context.Identity()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*LogoutResult)
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,26 +3,21 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func PostToInboxService(context IContext, input *PostToInboxRequest) (result *PostToInboxResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "post_to_inbox"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "post_to_inbox", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "post_to_inbox", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.PostToInbox(input.Username, input.Body, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.PostToInbox(input.Username, input.Body, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*PostToInboxResult)
|
||||
result.Body = _result.Body()
|
||||
result.Body = commandResult.Body()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,26 +3,21 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func PostToOutboxService(context IContext, input *PostToOutboxRequest) (result *PostToOutboxResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "post_to_outbox"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "post_to_outbox", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "post_to_outbox", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.PostToOutbox(input.Username, input.Body, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.PostToOutbox(input.Username, input.Body, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*PostToOutboxResult)
|
||||
result.Body = _result.Body()
|
||||
result.Body = commandResult.Body()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,25 +3,19 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func ResetPasswordService(context IContext, input *ResetPasswordRequest) (result *ResetPasswordResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "reset_password"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "reset_password", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "reset_password", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.ResetPassword(input.UsernameOrEmail, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
if _, err = Conductor.ResetPassword(input.UsernameOrEmail, context.Identity()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*ResetPasswordResult)
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,28 +3,23 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func SignupService(context IContext, input *SignupRequest) (result *SignupResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "signup"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "signup", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "signup", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.Signup(input.Username, input.Email, input.Password, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.Signup(input.Username, input.Email, input.Password, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
context.SetCookie("Diamante", _result.Token())
|
||||
context.SetCookie("Diamante", commandResult.Token())
|
||||
result = context.ResultContainer().(*SignupResult)
|
||||
result.Token = _result.Token()
|
||||
result.Code = _result.Code()
|
||||
result.Token = commandResult.Token()
|
||||
result.Code = commandResult.Code()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -7,16 +7,14 @@ import (
|
|||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/constants"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func SystemCallService(context IContext, input *SystemCallRequest) (result *SystemCallResult, err error) {
|
||||
conductor := core.Conductor
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "system_call", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "system_call", input, result, err) }()
|
||||
source := "system_call"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
context.Logger().SysCall(fmt.Sprintf("SYSCALL: %s", input.Command))
|
||||
|
||||
|
@ -34,7 +32,7 @@ func SystemCallService(context IContext, input *SystemCallRequest) (result *Syst
|
|||
}
|
||||
|
||||
componentName := args[1]
|
||||
if component := conductor.GetSystemComponent(componentName); component == nil {
|
||||
if component := Conductor.GetSystemComponent(componentName); component == nil {
|
||||
return nil, ERROR_SYSTEM_COMPONENT_NOT_FOUND
|
||||
} else if err := component.Reload(); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -3,30 +3,25 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func UpdateProfileByUserService(context IContext, input *UpdateProfileByUserRequest) (result *UpdateProfileByUserResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "update_profile_by_user"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "update_profile_by_user", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "update_profile_by_user", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.UpdateProfileByUser(input.DisplayName, input.Avatar, input.Banner, input.Summary, input.Github, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.UpdateProfileByUser(input.DisplayName, input.Avatar, input.Banner, input.Summary, input.Github, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
result = context.ResultContainer().(*UpdateProfileByUserResult)
|
||||
result.DisplayName = _result.DisplayName()
|
||||
result.Avatar = _result.Avatar()
|
||||
result.Banner = _result.Banner()
|
||||
result.Summary = _result.Summary()
|
||||
result.Github = _result.Github()
|
||||
result.DisplayName = commandResult.DisplayName()
|
||||
result.Avatar = commandResult.Avatar()
|
||||
result.Banner = commandResult.Banner()
|
||||
result.Summary = commandResult.Summary()
|
||||
result.Github = commandResult.Github()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,27 +3,22 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func VerifyService(context IContext, input *VerifyRequest) (result *VerifyResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "verify"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "verify", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "verify", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.Verify(input.Email, input.Token, input.Code, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.Verify(input.Email, input.Token, input.Code, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
context.SetCookie("Diamante", _result.Token())
|
||||
context.SetCookie("Diamante", commandResult.Token())
|
||||
result = context.ResultContainer().(*VerifyResult)
|
||||
result.Token = _result.Token()
|
||||
result.Token = commandResult.Token()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -3,27 +3,22 @@ package services
|
|||
import (
|
||||
. "github.com/reiver/greatape/components/api/protobuf"
|
||||
. "github.com/reiver/greatape/components/contracts"
|
||||
"github.com/reiver/greatape/components/core"
|
||||
. "github.com/reiver/greatape/components/core"
|
||||
. "github.com/xeronith/diamante/contracts/service"
|
||||
)
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func WebfingerService(context IContext, input *WebfingerRequest) (result *WebfingerResult, err error) {
|
||||
conductor := core.Conductor
|
||||
source := "webfinger"
|
||||
/* //////// */ Conductor.LogRemoteCall(context, INIT, source, input, result, err)
|
||||
defer func() { Conductor.LogRemoteCall(context, DONE, source, input, result, err) }()
|
||||
|
||||
conductor.LogRemoteCall(context, INITIALIZE, "webfinger", input, result, err)
|
||||
defer func() { conductor.LogRemoteCall(context, FINALIZE, "webfinger", input, result, err) }()
|
||||
|
||||
_result, _err := conductor.Webfinger(input.Resource, context.Identity())
|
||||
if _err != nil {
|
||||
err = _err
|
||||
commandResult, err := Conductor.Webfinger(input.Resource, context.Identity())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_ = _result
|
||||
|
||||
outputLinks := make([]*ActivityPubLink, 0)
|
||||
for _, link := range _result.Links() {
|
||||
for _, link := range commandResult.Links() {
|
||||
if link == nil {
|
||||
continue
|
||||
}
|
||||
|
@ -37,8 +32,8 @@ func WebfingerService(context IContext, input *WebfingerRequest) (result *Webfin
|
|||
}
|
||||
|
||||
result = context.ResultContainer().(*WebfingerResult)
|
||||
result.Aliases = _result.Aliases()
|
||||
result.Aliases = commandResult.Aliases()
|
||||
result.Links = outputLinks
|
||||
result.Subject = _result.Subject()
|
||||
result.Subject = commandResult.Subject()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
INITIALIZE = 0
|
||||
FINALIZE = 100
|
||||
INIT = 0
|
||||
DONE = 100
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
Ładowanie…
Reference in New Issue