refactor(components): 🎨 cleanup

master
Xeronith 2023-05-30 16:29:18 +03:30
rodzic 29b364553f
commit 606fa1bc55
72 zmienionych plików z 28 dodań i 359 usunięć

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func AuthorizeInteractionService(context IContext, input *AuthorizeInteractionRequest) (result *AuthorizeInteractionResult, err error) { func AuthorizeInteractionService(context IContext, input *AuthorizeInteractionRequest) (result *AuthorizeInteractionResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = AUTHORIZE_INTERACTION_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "authorize_interaction", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "authorize_interaction", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "authorize_interaction", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "authorize_interaction", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func CheckUsernameAvailabilityService(context IContext, input *CheckUsernameAvailabilityRequest) (result *CheckUsernameAvailabilityResult, err error) { func CheckUsernameAvailabilityService(context IContext, input *CheckUsernameAvailabilityRequest) (result *CheckUsernameAvailabilityResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = CHECK_USERNAME_AVAILABILITY_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "check_username_availability", 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) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "check_username_availability", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func EchoService(context IContext, input *EchoRequest) (result *EchoResult, err error) { func EchoService(context IContext, input *EchoRequest) (result *EchoResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = ECHO_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "echo", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "echo", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "echo", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "echo", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func FollowActorService(context IContext, input *FollowActorRequest) (result *FollowActorResult, err error) { func FollowActorService(context IContext, input *FollowActorRequest) (result *FollowActorResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = FOLLOW_ACTOR_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "follow_actor", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "follow_actor", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "follow_actor", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "follow_actor", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetActorService(context IContext, input *GetActorRequest) (result *GetActorResult, err error) { func GetActorService(context IContext, input *GetActorRequest) (result *GetActorResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_ACTOR_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_actor", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "get_actor", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_actor", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_actor", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetFollowersService(context IContext, input *GetFollowersRequest) (result *GetFollowersResult, err error) { func GetFollowersService(context IContext, input *GetFollowersRequest) (result *GetFollowersResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_FOLLOWERS_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_followers", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "get_followers", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_followers", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_followers", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetFollowingService(context IContext, input *GetFollowingRequest) (result *GetFollowingResult, err error) { func GetFollowingService(context IContext, input *GetFollowingRequest) (result *GetFollowingResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_FOLLOWING_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_following", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "get_following", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_following", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_following", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetInboxService(context IContext, input *GetInboxRequest) (result *GetInboxResult, err error) { func GetInboxService(context IContext, input *GetInboxRequest) (result *GetInboxResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_INBOX_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_inbox", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "get_inbox", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_inbox", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_inbox", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetOutboxService(context IContext, input *GetOutboxRequest) (result *GetOutboxResult, err error) { func GetOutboxService(context IContext, input *GetOutboxRequest) (result *GetOutboxResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_OUTBOX_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_outbox", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "get_outbox", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_outbox", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_outbox", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetPackagesService(context IContext, input *GetPackagesRequest) (result *GetPackagesResult, err error) { func GetPackagesService(context IContext, input *GetPackagesRequest) (result *GetPackagesResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_PACKAGES_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_packages", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "get_packages", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_packages", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_packages", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func GetProfileByUserService(context IContext, input *GetProfileByUserRequest) (result *GetProfileByUserResult, err error) { func GetProfileByUserService(context IContext, input *GetProfileByUserRequest) (result *GetProfileByUserResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = GET_PROFILE_BY_USER_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "get_profile_by_user", 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) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "get_profile_by_user", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func LoginService(context IContext, input *LoginRequest) (result *LoginResult, err error) { func LoginService(context IContext, input *LoginRequest) (result *LoginResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = LOGIN_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "login", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "login", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "login", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "login", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func LogoutService(context IContext, input *LogoutRequest) (result *LogoutResult, err error) { func LogoutService(context IContext, input *LogoutRequest) (result *LogoutResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = LOGOUT_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "logout", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "logout", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "logout", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "logout", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func PostToInboxService(context IContext, input *PostToInboxRequest) (result *PostToInboxResult, err error) { func PostToInboxService(context IContext, input *PostToInboxRequest) (result *PostToInboxResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = POST_TO_INBOX_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "post_to_inbox", 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) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "post_to_inbox", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func PostToOutboxService(context IContext, input *PostToOutboxRequest) (result *PostToOutboxResult, err error) { func PostToOutboxService(context IContext, input *PostToOutboxRequest) (result *PostToOutboxResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = POST_TO_OUTBOX_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "post_to_outbox", 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) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "post_to_outbox", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func SignupService(context IContext, input *SignupRequest) (result *SignupResult, err error) { func SignupService(context IContext, input *SignupRequest) (result *SignupResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = SIGNUP_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "signup", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "signup", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "signup", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "signup", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func UpdateProfileByUserService(context IContext, input *UpdateProfileByUserRequest) (result *UpdateProfileByUserResult, err error) { func UpdateProfileByUserService(context IContext, input *UpdateProfileByUserRequest) (result *UpdateProfileByUserResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = UPDATE_PROFILE_BY_USER_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "update_profile_by_user", 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) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "update_profile_by_user", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func VerifyService(context IContext, input *VerifyRequest) (result *VerifyResult, err error) { func VerifyService(context IContext, input *VerifyRequest) (result *VerifyResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = VERIFY_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "verify", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "verify", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "verify", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "verify", input, result, err) }()

Wyświetl plik

@ -10,7 +10,6 @@ import (
// noinspection GoUnusedParameter // noinspection GoUnusedParameter
func WebfingerService(context IContext, input *WebfingerRequest) (result *WebfingerResult, err error) { func WebfingerService(context IContext, input *WebfingerRequest) (result *WebfingerResult, err error) {
conductor := core.Conductor conductor := core.Conductor
_ = WEBFINGER_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "webfinger", input, result, err) conductor.LogRemoteCall(context, INITIALIZE, "webfinger", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "webfinger", input, result, err) }() defer func() { conductor.LogRemoteCall(context, FINALIZE, "webfinger", input, result, err) }()

Wyświetl plik

@ -2,9 +2,6 @@ package constants
import "errors" import "errors"
// noinspection GoSnakeCaseUsage
const ENABLE_CUSTOM_ERRORS = true
// noinspection GoSnakeCaseUsage // noinspection GoSnakeCaseUsage
const ( const (
// SYSTEM_ERRORS // SYSTEM_ERRORS

Wyświetl plik

@ -13,6 +13,8 @@ type (
IEntity interface { IEntity interface {
Stringer Stringer
Id() int64 Id() int64
SortOrder() float32
SetSortOrder(float32)
Payload() string Payload() string
SetPayload(string) SetPayload(string)
Validate() error Validate() error

Wyświetl plik

@ -4,9 +4,10 @@ import . "fmt"
type IObject interface { type IObject interface {
Stringer Stringer
// Returns the unique identifier or 'Id' of this object instance. // Id returns the unique identifier or 'Id' of this object instance.
Id() int64 Id() int64
// Checks whether the current instance contains any errors. SortOrder() float32
// Validate checks whether the current instance contains any errors.
Validate() error Validate() error
Lock(context uint64) Lock(context uint64)
Unlock(context uint64) Unlock(context uint64)

Wyświetl plik

@ -1175,7 +1175,7 @@ type IDispatcher interface {
// Format provides a wrapper around fmt.Sprintf // Format provides a wrapper around fmt.Sprintf
Format(format string, args ...interface{}) string Format(format string, args ...interface{}) string
// Sort sorts the provided slice using the provided comparator function. // Sort sorts the provided slice using the provided comparator function.
Sort(slice interface{}, less func(a, b int) bool) Sort(slice interface{}, less func(x, y int) bool)
// Search searches the input for any or all of the words in criteria. // Search searches the input for any or all of the words in criteria.
Search(input, criteria string) bool Search(input, criteria string) bool
// Email sends an email message asynchronously. // Email sends an email message asynchronously.

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -17,14 +15,6 @@ type accessControl struct {
value uint64 value uint64
} }
// noinspection GoUnusedExportedFunction
func InitializeAccessControl() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewAccessControl(id int64, key uint64, value uint64) (IAccessControl, error) { func NewAccessControl(id int64, key uint64, value uint64) (IAccessControl, error) {
instance := &accessControl{ instance := &accessControl{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type accessControlManager struct {
} }
func newAccessControlManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IAccessControlManager { func newAccessControlManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IAccessControlManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &accessControlManager{ manager := &accessControlManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,11 +3,7 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
"github.com/reiver/greatape/components/model/repository"
. "github.com/xeronith/diamante/contracts/security"
) )
type activityPubActivity struct { type activityPubActivity struct {
@ -23,14 +19,6 @@ type activityPubActivity struct {
published string published string
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubActivity() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubActivity() (IActivityPubActivity, error) { func NewActivityPubActivity() (IActivityPubActivity, error) {
instance := &activityPubActivity{} instance := &activityPubActivity{}

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/xeronith/diamante/contracts/logging" . "github.com/xeronith/diamante/contracts/logging"
@ -20,9 +19,6 @@ type activityPubActivityManager struct {
} }
func newActivityPubActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubActivityManager { func newActivityPubActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubActivityManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubActivityManager{ manager := &activityPubActivityManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -20,14 +18,6 @@ type activityPubFollower struct {
accepted bool accepted bool
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubFollower() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubFollower(id int64, handle string, inbox string, subject string, activity string, accepted bool) (IActivityPubFollower, error) { func NewActivityPubFollower(id int64, handle string, inbox string, subject string, activity string, accepted bool) (IActivityPubFollower, error) {
instance := &activityPubFollower{ instance := &activityPubFollower{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type activityPubFollowerManager struct {
} }
func newActivityPubFollowerManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubFollowerManager { func newActivityPubFollowerManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubFollowerManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubFollowerManager{ manager := &activityPubFollowerManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,7 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -22,14 +21,6 @@ type activityPubIncomingActivity struct {
raw string raw string
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubIncomingActivity() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubIncomingActivity(id int64, identityId int64, uniqueIdentifier string, timestamp int64, from string, to string, content string, raw string) (IActivityPubIncomingActivity, error) { func NewActivityPubIncomingActivity(id int64, identityId int64, uniqueIdentifier string, timestamp int64, from string, to string, content string, raw string) (IActivityPubIncomingActivity, error) {
instance := &activityPubIncomingActivity{ instance := &activityPubIncomingActivity{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -27,9 +26,6 @@ type activityPubIncomingActivityManager struct {
} }
func newActivityPubIncomingActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubIncomingActivityManager { func newActivityPubIncomingActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubIncomingActivityManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubIncomingActivityManager{ manager := &activityPubIncomingActivityManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,11 +3,7 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
"github.com/reiver/greatape/components/model/repository"
. "github.com/xeronith/diamante/contracts/security"
) )
type activityPubLink struct { type activityPubLink struct {
@ -17,14 +13,6 @@ type activityPubLink struct {
template string template string
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubLink() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubLink() (IActivityPubLink, error) { func NewActivityPubLink() (IActivityPubLink, error) {
instance := &activityPubLink{} instance := &activityPubLink{}

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/xeronith/diamante/contracts/logging" . "github.com/xeronith/diamante/contracts/logging"
@ -20,9 +19,6 @@ type activityPubLinkManager struct {
} }
func newActivityPubLinkManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubLinkManager { func newActivityPubLinkManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubLinkManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubLinkManager{ manager := &activityPubLinkManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,11 +3,7 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
"github.com/reiver/greatape/components/model/repository"
. "github.com/xeronith/diamante/contracts/security"
) )
type activityPubMedia struct { type activityPubMedia struct {
@ -18,14 +14,6 @@ type activityPubMedia struct {
height int32 height int32
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubMedia() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubMedia() (IActivityPubMedia, error) { func NewActivityPubMedia() (IActivityPubMedia, error) {
instance := &activityPubMedia{} instance := &activityPubMedia{}

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/xeronith/diamante/contracts/logging" . "github.com/xeronith/diamante/contracts/logging"
@ -20,9 +19,6 @@ type activityPubMediaManager struct {
} }
func newActivityPubMediaManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubMediaManager { func newActivityPubMediaManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubMediaManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubMediaManager{ manager := &activityPubMediaManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,11 +3,7 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
"github.com/reiver/greatape/components/model/repository"
. "github.com/xeronith/diamante/contracts/security"
) )
type activityPubObject struct { type activityPubObject struct {
@ -22,14 +18,6 @@ type activityPubObject struct {
published string published string
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubObject() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubObject() (IActivityPubObject, error) { func NewActivityPubObject() (IActivityPubObject, error) {
instance := &activityPubObject{} instance := &activityPubObject{}

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/xeronith/diamante/contracts/logging" . "github.com/xeronith/diamante/contracts/logging"
@ -20,9 +19,6 @@ type activityPubObjectManager struct {
} }
func newActivityPubObjectManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubObjectManager { func newActivityPubObjectManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubObjectManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubObjectManager{ manager := &activityPubObjectManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,7 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -22,14 +21,6 @@ type activityPubOutgoingActivity struct {
raw string raw string
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubOutgoingActivity() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubOutgoingActivity(id int64, identityId int64, uniqueIdentifier string, timestamp int64, from string, to string, content string, raw string) (IActivityPubOutgoingActivity, error) { func NewActivityPubOutgoingActivity(id int64, identityId int64, uniqueIdentifier string, timestamp int64, from string, to string, content string, raw string) (IActivityPubOutgoingActivity, error) {
instance := &activityPubOutgoingActivity{ instance := &activityPubOutgoingActivity{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -27,9 +26,6 @@ type activityPubOutgoingActivityManager struct {
} }
func newActivityPubOutgoingActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubOutgoingActivityManager { func newActivityPubOutgoingActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubOutgoingActivityManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubOutgoingActivityManager{ manager := &activityPubOutgoingActivityManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,11 +3,7 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
"github.com/reiver/greatape/components/model/repository"
. "github.com/xeronith/diamante/contracts/security"
) )
type activityPubPublicKey struct { type activityPubPublicKey struct {
@ -16,14 +12,6 @@ type activityPubPublicKey struct {
publicKeyPem string publicKeyPem string
} }
// noinspection GoUnusedExportedFunction
func InitializeActivityPubPublicKey() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubPublicKey() (IActivityPubPublicKey, error) { func NewActivityPubPublicKey() (IActivityPubPublicKey, error) {
instance := &activityPubPublicKey{} instance := &activityPubPublicKey{}

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/xeronith/diamante/contracts/logging" . "github.com/xeronith/diamante/contracts/logging"
@ -20,9 +19,6 @@ type activityPubPublicKeyManager struct {
} }
func newActivityPubPublicKeyManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubPublicKeyManager { func newActivityPubPublicKeyManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IActivityPubPublicKeyManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &activityPubPublicKeyManager{ manager := &activityPubPublicKeyManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,7 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -19,14 +18,6 @@ type category struct {
description string description string
} }
// noinspection GoUnusedExportedFunction
func InitializeCategory() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewCategory(id int64, categoryTypeId int64, categoryId int64, title string, description string) (ICategory, error) { func NewCategory(id int64, categoryTypeId int64, categoryId int64, title string, description string) (ICategory, error) {
instance := &category{ instance := &category{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -28,9 +27,6 @@ type categoryManager struct {
} }
func newCategoryManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ICategoryManager { func newCategoryManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ICategoryManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &categoryManager{ manager := &categoryManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -16,14 +14,6 @@ type categoryType struct {
description string description string
} }
// noinspection GoUnusedExportedFunction
func InitializeCategoryType() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewCategoryType(id int64, description string) (ICategoryType, error) { func NewCategoryType(id int64, description string) (ICategoryType, error) {
instance := &categoryType{ instance := &categoryType{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type categoryTypeManager struct {
} }
func newCategoryTypeManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ICategoryTypeManager { func newCategoryTypeManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ICategoryTypeManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &categoryTypeManager{ manager := &categoryTypeManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -16,14 +14,6 @@ type document struct {
content string content string
} }
// noinspection GoUnusedExportedFunction
func InitializeDocument() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewDocument(id int64, content string) (IDocument, error) { func NewDocument(id int64, content string) (IDocument, error) {
instance := &document{ instance := &document{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type documentManager struct {
} }
func newDocumentManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IDocumentManager { func newDocumentManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IDocumentManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &documentManager{ manager := &documentManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,7 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -40,14 +39,6 @@ type identity struct {
systemCallHandler func(Identity, []string) error systemCallHandler func(Identity, []string) error
} }
// noinspection GoUnusedExportedFunction
func InitializeIdentity() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewIdentity(id int64, username string, phoneNumber string, phoneNumberConfirmed bool, firstName string, lastName string, displayName string, email string, emailConfirmed bool, avatar string, banner string, summary string, token string, multiFactor bool, hash string, salt string, publicKey string, privateKey string, permission uint64, restriction uint32, lastLogin int64, loginCount uint32) (IIdentity, error) { func NewIdentity(id int64, username string, phoneNumber string, phoneNumberConfirmed bool, firstName string, lastName string, displayName string, email string, emailConfirmed bool, avatar string, banner string, summary string, token string, multiFactor bool, hash string, salt string, publicKey string, privateKey string, permission uint64, restriction uint32, lastLogin int64, loginCount uint32) (IIdentity, error) {
instance := &identity{ instance := &identity{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -24,9 +23,6 @@ type identityManager struct {
} }
func newIdentityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IIdentityManager { func newIdentityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IIdentityManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &identityManager{ manager := &identityManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewIdentityCache(), cache: NewIdentityCache(),

Wyświetl plik

@ -5,7 +5,6 @@ import (
"crypto/sha256" "crypto/sha256"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
@ -131,7 +130,7 @@ func Initialize(configuration IConfiguration, logger ILogger) error {
start := time.Now() start := time.Now()
componentName := component.Name() componentName := component.Name()
if _, exists := componentsContainer[componentName]; exists { if _, exists := componentsContainer[componentName]; exists {
return errors.New(fmt.Sprintf("%s already registered", componentName)) return fmt.Errorf("%s already registered", componentName)
} }
if err := component.Load(); err != nil { if err := component.Load(); err != nil {
@ -1318,10 +1317,7 @@ func (conductor *conductor) NewGetInboxResult(context string, id string, type_ s
func (conductor *conductor) LogRemoteCall(context IContext, eventType uint32, source string, input, result interface{}, err error) { func (conductor *conductor) LogRemoteCall(context IContext, eventType uint32, source string, input, result interface{}, err error) {
errorMessage := "" errorMessage := ""
if err != nil { if err != nil {
errorMessage = err.Error() errorMessage = strings.TrimPrefix(err.Error(), "ERROR_MESSAGE_")
if strings.HasPrefix(errorMessage, "ERROR_MESSAGE_") {
errorMessage = errorMessage[14:]
}
} }
if _, marshalError := json.Marshal(input); marshalError != nil { if _, marshalError := json.Marshal(input); marshalError != nil {

Wyświetl plik

@ -9,9 +9,14 @@ import (
) )
type object struct { type object struct {
mutex sync.RWMutex mutex sync.RWMutex
id int64 id int64
keychain map[uint64]*semaphore sortOrder float32
keychain map[uint64]*semaphore
}
func (object *object) SortOrder() float32 {
return object.sortOrder
} }
func (object *object) Id() int64 { func (object *object) Id() int64 {

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -23,14 +21,6 @@ type remoteActivity struct {
timestamp int64 timestamp int64
} }
// noinspection GoUnusedExportedFunction
func InitializeRemoteActivity() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewRemoteActivity(id int64, entryPoint string, duration int64, successful bool, errorMessage string, remoteAddress string, userAgent string, eventType uint32, timestamp int64) (IRemoteActivity, error) { func NewRemoteActivity(id int64, entryPoint string, duration int64, successful bool, errorMessage string, remoteAddress string, userAgent string, eventType uint32, timestamp int64) (IRemoteActivity, error) {
instance := &remoteActivity{ instance := &remoteActivity{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type remoteActivityManager struct {
} }
func newRemoteActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IRemoteActivityManager { func newRemoteActivityManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IRemoteActivityManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &remoteActivityManager{ manager := &remoteActivityManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,24 +3,12 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
"github.com/reiver/greatape/components/model/repository"
. "github.com/xeronith/diamante/contracts/security"
) )
type spi struct { type spi struct {
} }
// noinspection GoUnusedExportedFunction
func InitializeSpi() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewSpi() (ISpi, error) { func NewSpi() (ISpi, error) {
instance := &spi{} instance := &spi{}

Wyświetl plik

@ -21,9 +21,6 @@ type spiManager struct {
} }
func newSpiManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ISpiManager { func newSpiManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ISpiManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &spiManager{ manager := &spiManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -228,7 +228,7 @@ func (dispatcher *dispatcher) Format(format string, args ...interface{}) string
return fmt.Sprintf(format, args...) return fmt.Sprintf(format, args...)
} }
func (dispatcher *dispatcher) Sort(slice interface{}, less func(a, b int) bool) { func (dispatcher *dispatcher) Sort(slice interface{}, less func(x, y int) bool) {
sort.Slice(slice, less) sort.Slice(slice, less)
} }

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -17,14 +15,6 @@ type systemSchedule struct {
config string config string
} }
// noinspection GoUnusedExportedFunction
func InitializeSystemSchedule() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewSystemSchedule(id int64, enabled bool, config string) (ISystemSchedule, error) { func NewSystemSchedule(id int64, enabled bool, config string) (ISystemSchedule, error) {
instance := &systemSchedule{ instance := &systemSchedule{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type systemScheduleManager struct {
} }
func newSystemScheduleManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ISystemScheduleManager { func newSystemScheduleManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ISystemScheduleManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &systemScheduleManager{ manager := &systemScheduleManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -3,8 +3,6 @@ package core
import ( import (
"fmt" "fmt"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
"github.com/reiver/greatape/components/model/repository" "github.com/reiver/greatape/components/model/repository"
@ -16,14 +14,6 @@ type user struct {
github string github string
} }
// noinspection GoUnusedExportedFunction
func InitializeUser() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewUser(id int64, github string) (IUser, error) { func NewUser(id int64, github string) (IUser, error) {
instance := &user{ instance := &user{
object: object{ object: object{

Wyświetl plik

@ -1,7 +1,6 @@
package core package core
import ( import (
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts" . "github.com/reiver/greatape/components/contracts"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
@ -23,9 +22,6 @@ type userManager struct {
} }
func newUserManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IUserManager { func newUserManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) IUserManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &userManager{ manager := &userManager{
systemComponent: newSystemComponent(configuration, logger), systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(), cache: NewCache(),

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var AccessControlEntityType = reflect.TypeOf(accessControlEntity{}) var AccessControlEntityType = reflect.TypeOf(accessControlEntity{})
// noinspection GoUnusedExportedFunction
func InitializeAccessControlEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type accessControlEntity struct { type accessControlEntity struct {
entity entity
KeyField uint64 `json:"key" storage:"BIGINT" default:"0"` KeyField uint64 `json:"key" storage:"BIGINT" default:"0"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var ActivityPubFollowerEntityType = reflect.TypeOf(activityPubFollowerEntity{}) var ActivityPubFollowerEntityType = reflect.TypeOf(activityPubFollowerEntity{})
// noinspection GoUnusedExportedFunction
func InitializeActivityPubFollowerEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type activityPubFollowerEntity struct { type activityPubFollowerEntity struct {
entity entity
HandleField string `json:"handle" storage:"VARCHAR(256)" default:"''"` HandleField string `json:"handle" storage:"VARCHAR(256)" default:"''"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var ActivityPubIncomingActivityEntityType = reflect.TypeOf(activityPubIncomingActivityEntity{}) var ActivityPubIncomingActivityEntityType = reflect.TypeOf(activityPubIncomingActivityEntity{})
// noinspection GoUnusedExportedFunction
func InitializeActivityPubIncomingActivityEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type activityPubIncomingActivityEntity struct { type activityPubIncomingActivityEntity struct {
entity entity
IdentityIdField int64 `json:"identity_id"` IdentityIdField int64 `json:"identity_id"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var ActivityPubOutgoingActivityEntityType = reflect.TypeOf(activityPubOutgoingActivityEntity{}) var ActivityPubOutgoingActivityEntityType = reflect.TypeOf(activityPubOutgoingActivityEntity{})
// noinspection GoUnusedExportedFunction
func InitializeActivityPubOutgoingActivityEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type activityPubOutgoingActivityEntity struct { type activityPubOutgoingActivityEntity struct {
entity entity
IdentityIdField int64 `json:"identity_id"` IdentityIdField int64 `json:"identity_id"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var CategoryEntityType = reflect.TypeOf(categoryEntity{}) var CategoryEntityType = reflect.TypeOf(categoryEntity{})
// noinspection GoUnusedExportedFunction
func InitializeCategoryEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type categoryEntity struct { type categoryEntity struct {
entity entity
CategoryTypeIdField int64 `json:"category_type_id"` CategoryTypeIdField int64 `json:"category_type_id"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var CategoryTypeEntityType = reflect.TypeOf(categoryTypeEntity{}) var CategoryTypeEntityType = reflect.TypeOf(categoryTypeEntity{})
// noinspection GoUnusedExportedFunction
func InitializeCategoryTypeEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type categoryTypeEntity struct { type categoryTypeEntity struct {
entity entity
DescriptionField string `json:"description" storage:"VARCHAR(64)" default:"''"` DescriptionField string `json:"description" storage:"VARCHAR(64)" default:"''"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var DocumentEntityType = reflect.TypeOf(documentEntity{}) var DocumentEntityType = reflect.TypeOf(documentEntity{})
// noinspection GoUnusedExportedFunction
func InitializeDocumentEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type documentEntity struct { type documentEntity struct {
entity entity
ContentField string `json:"content" storage:"JSONB" default:"'{}'"` ContentField string `json:"content" storage:"JSONB" default:"'{}'"`

Wyświetl plik

@ -1,14 +1,23 @@
package entity package entity
type entity struct { type entity struct {
IdField int64 `json:"id"` IdField int64 `json:"id"`
PayloadField string `json:"payload"` SortOrderField float32 `json:"sort_order"`
PayloadField string `json:"payload"`
} }
func (entity *entity) Id() int64 { func (entity *entity) Id() int64 {
return entity.IdField return entity.IdField
} }
func (entity *entity) SortOrder() float32 {
return entity.SortOrderField
}
func (entity *entity) SetSortOrder(sortOrder float32) {
entity.SortOrderField = sortOrder
}
func (entity *entity) Payload() string { func (entity *entity) Payload() string {
if entity.PayloadField == "" { if entity.PayloadField == "" {
entity.PayloadField = "{}" entity.PayloadField = "{}"

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var IdentityEntityType = reflect.TypeOf(identityEntity{}) var IdentityEntityType = reflect.TypeOf(identityEntity{})
// noinspection GoUnusedExportedFunction
func InitializeIdentityEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type identityEntity struct { type identityEntity struct {
entity entity
UsernameField string `json:"username" storage:"VARCHAR(32)" default:"''"` UsernameField string `json:"username" storage:"VARCHAR(32)" default:"''"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var RemoteActivityEntityType = reflect.TypeOf(remoteActivityEntity{}) var RemoteActivityEntityType = reflect.TypeOf(remoteActivityEntity{})
// noinspection GoUnusedExportedFunction
func InitializeRemoteActivityEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type remoteActivityEntity struct { type remoteActivityEntity struct {
entity entity
EntryPointField string `json:"entry_point" storage:"VARCHAR(256)" default:"''"` EntryPointField string `json:"entry_point" storage:"VARCHAR(256)" default:"''"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var SystemScheduleEntityType = reflect.TypeOf(systemScheduleEntity{}) var SystemScheduleEntityType = reflect.TypeOf(systemScheduleEntity{})
// noinspection GoUnusedExportedFunction
func InitializeSystemScheduleEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type systemScheduleEntity struct { type systemScheduleEntity struct {
entity entity
EnabledField bool `json:"enabled" storage:"BOOLEAN" default:"FALSE"` EnabledField bool `json:"enabled" storage:"BOOLEAN" default:"FALSE"`

Wyświetl plik

@ -5,19 +5,12 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/reiver/greatape/app/validators"
. "github.com/reiver/greatape/components/constants" . "github.com/reiver/greatape/components/constants"
. "github.com/reiver/greatape/components/contracts/model" . "github.com/reiver/greatape/components/contracts/model"
) )
var UserEntityType = reflect.TypeOf(userEntity{}) var UserEntityType = reflect.TypeOf(userEntity{})
// noinspection GoUnusedExportedFunction
func InitializeUserEntity() {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
}
type userEntity struct { type userEntity struct {
entity entity
GithubField string `json:"github" storage:"VARCHAR(512)" default:"''"` GithubField string `json:"github" storage:"VARCHAR(512)" default:"''"`