Porównaj commity

...

9 Commity

Autor SHA1 Wiadomość Data
Xeronith 770107b54b chore(project): ⬆️ upgrade dependencies 2023-05-01 16:07:00 +03:30
Xeronith e112f03a42 docs(workspace): 📝 update readme 2023-05-01 14:46:00 +03:30
Xeronith afaf8e7d40 fix(components): 🔧 update default config 2023-05-01 14:43:07 +03:30
Xeronith 9df75b259a refactor(project): 🗑️ cleanup 2023-05-01 14:42:14 +03:30
Xeronith dab29fbe95 chore(project): ⬆️ upgrade dependencies 2023-05-01 14:41:20 +03:30
Xeronith 0cb28b3f79 test(project): 🧪 resolve default storage issue 2023-05-01 10:54:20 +03:30
Xeronith 9f448d656d docs(project): 📝 update readme 2023-05-01 10:53:38 +03:30
Xeronith 55ed82112a feat(app): add data seed 2023-05-01 10:53:16 +03:30
Xeronith e811d3d5f8 fix(database): 🩹 resolve triggers issue 2023-05-01 10:52:25 +03:30
43 zmienionych plików z 182 dodań i 103 usunięć

Wyświetl plik

@ -366,5 +366,3 @@ __debug_bin
.ionide
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,intellij+all,goland+all,go,node,macos
config.yaml

2
.gitignore vendored
Wyświetl plik

@ -367,5 +367,3 @@ __debug_bin
.ionide
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,intellij+all,goland+all,go,node,macos
config.yaml

Wyświetl plik

@ -5,12 +5,21 @@
<img style="width:150px" src="https://raw.githubusercontent.com/reiver/greatape/master/assets/media/greatape-logo.png" />
[![image](https://img.shields.io/badge/Go-00A7D0?style=for-the-badge&logo=go&logoColor=white)](https://go.dev) [![image](https://img.shields.io/badge/ActivityPub-DD307D?style=for-the-badge&logoColor=white)](https://www.w3.org/TR/activitypub/) [![image](https://img.shields.io/badge/JSON--LD-FF6600?style=for-the-badge&logo=json&logoColor=white)](https://json-ld.org) [![image](https://img.shields.io/badge/Sqlite-449A45?style=for-the-badge&logo=sqlite&logoColor=white)](https://sqlite.org/index.html) [![image](https://img.shields.io/badge/MySQL-32738C?style=for-the-badge&logo=mysql&logoColor=white)](https://www.mysql.com) [![image](https://img.shields.io/badge/MariaDB-39818D?style=for-the-badge&logo=mariadb&logoColor=white)](https://mariadb.com) [![image](https://img.shields.io/badge/PostgreSQL-40668D?style=for-the-badge&logo=postgresql&logoColor=white)](https://www.postgresql.org)
[![image](https://img.shields.io/badge/Go-00A7D0?style=for-the-badge&logo=go&logoColor=white)](https://go.dev) [![image](https://img.shields.io/badge/ActivityPub-DD307D?style=for-the-badge&logoColor=white)](https://www.w3.org/TR/activitypub/) [![image](https://img.shields.io/badge/JSON--LD-FF6600?style=for-the-badge&logo=json&logoColor=white)](https://json-ld.org) [![image](https://img.shields.io/badge/PostgreSQL-40668D?style=for-the-badge&logo=postgresql&logoColor=white)](https://www.postgresql.org)
**greatape** is a free **social audio & video** social-media platform that can be used via an app.
**greatape** is a Fediverse technology that supports Federation via ActivityPub.
## Running the Project
1. Create an empty Postgres database.
2. Clone the project repository: `git clone https://github.com/reiver/greatape`
3. Navigate to the project directory: `cd greatape`
4. Download the project dependencies: `go mod download`
5. Update the `config.yaml` file in the project root directory with the actual values for your database.
6. Run the project: `go run main.go`
## Team
The following is a list of the people who are actively working on Great Ape (in alphabetical order):

Wyświetl plik

@ -7,6 +7,18 @@ import (
)
func Initialize(x IDispatcher) error {
// data seed
if !x.IdentityExists(1) {
identity := x.AddIdentityWithCustomId(0, "invalid", "0", false, EMPTY, EMPTY, EMPTY, "invalid@localhost", false, EMPTY, EMPTY, EMPTY, "0", false, EMPTY, EMPTY, EMPTY, EMPTY, NOT_SET, ACL_RESTRICTION_ACCESS_DENIED, NOT_SET, NOT_SET)
x.AddUser(identity.Id(), EMPTY)
identity = x.AddIdentityWithCustomId(1, "root", "1", false, EMPTY, EMPTY, EMPTY, "root@localhost", false, EMPTY, EMPTY, EMPTY, "1", true, EMPTY, EMPTY, EMPTY, EMPTY, ACL_PERMISSION_ADMIN, ACL_RESTRICTION_NONE, NOT_SET, NOT_SET)
x.AddUser(identity.Id(), EMPTY)
categoryType := x.AddCategoryTypeWithCustomId(0, EMPTY)
_ = x.AddCategoryWithCustomId(0, categoryType.Id(), NOT_SET, EMPTY, EMPTY)
}
// system schedules
x.Ensure(
x.Schedule(jobs.SYSTEM_SCHEDULE_HOURLY, CRON_EVERY_HOUR, jobs.Hourly),

Wyświetl plik

@ -19,7 +19,7 @@ func newAccessControlsRepository(logger ILogger) IAccessControlsRepository {
}
func (repository *accessControlsRepository) Add(entity IAccessControlEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *accessControlsRepository) Add(entity IAccessControlEntity, edi
}
func (repository *accessControlsRepository) AddAtomic(transaction IRepositoryTransaction, entity IAccessControlEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newActivityPubFollowersRepository(logger ILogger) IActivityPubFollowersRepo
}
func (repository *activityPubFollowersRepository) Add(entity IActivityPubFollowerEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *activityPubFollowersRepository) Add(entity IActivityPubFollowe
}
func (repository *activityPubFollowersRepository) AddAtomic(transaction IRepositoryTransaction, entity IActivityPubFollowerEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newActivityPubIncomingActivitiesRepository(logger ILogger) IActivityPubInco
}
func (repository *activityPubIncomingActivitiesRepository) Add(entity IActivityPubIncomingActivityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *activityPubIncomingActivitiesRepository) Add(entity IActivityP
}
func (repository *activityPubIncomingActivitiesRepository) AddAtomic(transaction IRepositoryTransaction, entity IActivityPubIncomingActivityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newActivityPubOutgoingActivitiesRepository(logger ILogger) IActivityPubOutg
}
func (repository *activityPubOutgoingActivitiesRepository) Add(entity IActivityPubOutgoingActivityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *activityPubOutgoingActivitiesRepository) Add(entity IActivityP
}
func (repository *activityPubOutgoingActivitiesRepository) AddAtomic(transaction IRepositoryTransaction, entity IActivityPubOutgoingActivityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newCategoriesRepository(logger ILogger) ICategoriesRepository {
}
func (repository *categoriesRepository) Add(entity ICategoryEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *categoriesRepository) Add(entity ICategoryEntity, editor int64
}
func (repository *categoriesRepository) AddAtomic(transaction IRepositoryTransaction, entity ICategoryEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newCategoryTypesRepository(logger ILogger) ICategoryTypesRepository {
}
func (repository *categoryTypesRepository) Add(entity ICategoryTypeEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *categoryTypesRepository) Add(entity ICategoryTypeEntity, edito
}
func (repository *categoryTypesRepository) AddAtomic(transaction IRepositoryTransaction, entity ICategoryTypeEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newDocumentsRepository(logger ILogger) IDocumentsRepository {
}
func (repository *documentsRepository) Add(entity IDocumentEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *documentsRepository) Add(entity IDocumentEntity, editor int64)
}
func (repository *documentsRepository) AddAtomic(transaction IRepositoryTransaction, entity IDocumentEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newIdentitiesRepository(logger ILogger) IIdentitiesRepository {
}
func (repository *identitiesRepository) Add(entity IIdentityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *identitiesRepository) Add(entity IIdentityEntity, editor int64
}
func (repository *identitiesRepository) AddAtomic(transaction IRepositoryTransaction, entity IIdentityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -13,7 +13,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_DOCUMENT,
&sync.Mutex{},
"INSERT INTO `documents` (`id`, `content`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?);",
`INSERT INTO "documents" ("id", "content", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5);`,
func(entity IPipeEntity) Parameters {
e := entity.(IDocumentPipeEntity)
return Parameters{e.Id(), e.Content(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -22,7 +22,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_SYSTEM_SCHEDULE,
&sync.Mutex{},
"INSERT INTO `system_schedules` (`id`, `enabled`, `config`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?);",
`INSERT INTO "system_schedules" ("id", "enabled", "config", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6);`,
func(entity IPipeEntity) Parameters {
e := entity.(ISystemSchedulePipeEntity)
return Parameters{e.Id(), e.Enabled(), e.Config(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -31,7 +31,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_IDENTITY,
&sync.Mutex{},
"INSERT INTO `identities` (`id`, `username`, `phone_number`, `phone_number_confirmed`, `first_name`, `last_name`, `display_name`, `email`, `email_confirmed`, `avatar`, `banner`, `summary`, `token`, `multi_factor`, `hash`, `salt`, `public_key`, `private_key`, `permission`, `restriction`, `last_login`, `login_count`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
`INSERT INTO "identities" ("id", "username", "phone_number", "phone_number_confirmed", "first_name", "last_name", "display_name", "email", "email_confirmed", "avatar", "banner", "summary", "token", "multi_factor", "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25);`,
func(entity IPipeEntity) Parameters {
e := entity.(IIdentityPipeEntity)
return Parameters{e.Id(), e.Username(), e.PhoneNumber(), e.PhoneNumberConfirmed(), e.FirstName(), e.LastName(), e.DisplayName(), e.Email(), e.EmailConfirmed(), e.Avatar(), e.Banner(), e.Summary(), e.Token(), e.MultiFactor(), e.Hash(), e.Salt(), e.PublicKey(), e.PrivateKey(), e.Permission(), e.Restriction(), e.LastLogin(), e.LoginCount(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -40,7 +40,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_ACCESS_CONTROL,
&sync.Mutex{},
"INSERT INTO `access_controls` (`id`, `key`, `value`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?);",
`INSERT INTO "access_controls" ("id", "key", "value", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6);`,
func(entity IPipeEntity) Parameters {
e := entity.(IAccessControlPipeEntity)
return Parameters{e.Id(), e.Key(), e.Value(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -49,7 +49,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_REMOTE_ACTIVITY,
&sync.Mutex{},
"INSERT INTO `remote_activities` (`id`, `entry_point`, `duration`, `successful`, `error_message`, `remote_address`, `user_agent`, `event_type`, `timestamp`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
`INSERT INTO "remote_activities" ("id", "entry_point", "duration", "successful", "error_message", "remote_address", "user_agent", "event_type", "timestamp", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);`,
func(entity IPipeEntity) Parameters {
e := entity.(IRemoteActivityPipeEntity)
return Parameters{e.Id(), e.EntryPoint(), e.Duration(), e.Successful(), e.ErrorMessage(), e.RemoteAddress(), e.UserAgent(), e.EventType(), e.Timestamp(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -58,7 +58,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_CATEGORY_TYPE,
&sync.Mutex{},
"INSERT INTO `category_types` (`id`, `description`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?);",
`INSERT INTO "category_types" ("id", "description", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5);`,
func(entity IPipeEntity) Parameters {
e := entity.(ICategoryTypePipeEntity)
return Parameters{e.Id(), e.Description(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -67,7 +67,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_CATEGORY,
&sync.Mutex{},
"INSERT INTO `categories` (`id`, `category_type_id`, `category_id`, `title`, `description`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?, ?, ?);",
`INSERT INTO "categories" ("id", "category_type_id", "category_id", "title", "description", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6, $7, $8);`,
func(entity IPipeEntity) Parameters {
e := entity.(ICategoryPipeEntity)
return Parameters{e.Id(), e.CategoryTypeId(), e.CategoryId(), e.Title(), e.Description(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -76,7 +76,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_USER,
&sync.Mutex{},
"INSERT INTO `users` (`id`, `github`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?);",
`INSERT INTO "users" ("id", "github", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5);`,
func(entity IPipeEntity) Parameters {
e := entity.(IUserPipeEntity)
return Parameters{e.Id(), e.Github(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -85,7 +85,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_ACTIVITY_PUB_INCOMING_ACTIVITY,
&sync.Mutex{},
"INSERT INTO `activity_pub_incoming_activities` (`id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
`INSERT INTO "activity_pub_incoming_activities" ("id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);`,
func(entity IPipeEntity) Parameters {
e := entity.(IActivityPubIncomingActivityPipeEntity)
return Parameters{e.Id(), e.IdentityId(), e.UniqueIdentifier(), e.Timestamp(), e.From(), e.To(), e.Content(), e.Raw(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -94,7 +94,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_ACTIVITY_PUB_OUTGOING_ACTIVITY,
&sync.Mutex{},
"INSERT INTO `activity_pub_outgoing_activities` (`id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
`INSERT INTO "activity_pub_outgoing_activities" ("id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);`,
func(entity IPipeEntity) Parameters {
e := entity.(IActivityPubOutgoingActivityPipeEntity)
return Parameters{e.Id(), e.IdentityId(), e.UniqueIdentifier(), e.Timestamp(), e.From(), e.To(), e.Content(), e.Raw(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}
@ -103,7 +103,7 @@ func (repository *pipeRepository) GetPipeDescriptors() []*pipeDescriptor {
{
PIPE_ACTIVITY_PUB_FOLLOWER,
&sync.Mutex{},
"INSERT INTO `activity_pub_followers` (`id`, `handle`, `inbox`, `subject`, `activity`, `accepted`, `editor`, `queued_at`, `payload`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);",
`INSERT INTO "activity_pub_followers" ("id", "handle", "inbox", "subject", "activity", "accepted", "editor", "queued_at", "payload") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);`,
func(entity IPipeEntity) Parameters {
e := entity.(IActivityPubFollowerPipeEntity)
return Parameters{e.Id(), e.Handle(), e.Inbox(), e.Subject(), e.Activity(), e.Accepted(), e.GetEditor(), e.GetQueueTimestamp().UnixNano(), e.Payload()}

Wyświetl plik

@ -19,7 +19,7 @@ func newRemoteActivitiesRepository(logger ILogger) IRemoteActivitiesRepository {
}
func (repository *remoteActivitiesRepository) Add(entity IRemoteActivityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *remoteActivitiesRepository) Add(entity IRemoteActivityEntity,
}
func (repository *remoteActivitiesRepository) AddAtomic(transaction IRepositoryTransaction, entity IRemoteActivityEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -39,3 +39,4 @@ CREATE TABLE "access_controls"
##########
CREATE INDEX "idx_access_controls_status" ON "access_controls" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "access_controls_after_update"() RETURNS TRIGGER AS $access_controls_after_update$
BEGIN
INSERT INTO "access_controls_history"("action", "original_id", "key", "value", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."key", "OLD"."value", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."key", OLD."value", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$access_controls_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "access_controls_after_update_trigger" AFTER UPDATE ON "access_controls"
CREATE OR REPLACE TRIGGER "access_controls_after_update_trigger" BEFORE UPDATE ON "access_controls"
FOR EACH ROW EXECUTE FUNCTION "access_controls_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "access_controls_after_update_trigger" AFTER UPDATE ON
CREATE OR REPLACE FUNCTION "access_controls_after_delete"() RETURNS TRIGGER AS $access_controls_after_delete$
BEGIN
INSERT INTO "access_controls_history"("action", "original_id", "key", "value", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."key", "OLD"."value", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."key", OLD."value", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$access_controls_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "access_controls_after_delete_trigger" AFTER DELETE ON "access_controls"
CREATE OR REPLACE TRIGGER "access_controls_after_delete_trigger" BEFORE DELETE ON "access_controls"
FOR EACH ROW EXECUTE FUNCTION "access_controls_after_delete"();
##########

Wyświetl plik

@ -45,3 +45,4 @@ CREATE TABLE "activity_pub_followers"
##########
CREATE INDEX "idx_activity_pub_followers_status" ON "activity_pub_followers" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "activity_pub_followers_after_update"() RETURNS TRIGGER AS $activity_pub_followers_after_update$
BEGIN
INSERT INTO "activity_pub_followers_history"("action", "original_id", "handle", "inbox", "subject", "activity", "accepted", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."handle", "OLD"."inbox", "OLD"."subject", "OLD"."activity", "OLD"."accepted", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."handle", OLD."inbox", OLD."subject", OLD."activity", OLD."accepted", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$activity_pub_followers_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "activity_pub_followers_after_update_trigger" AFTER UPDATE ON "activity_pub_followers"
CREATE OR REPLACE TRIGGER "activity_pub_followers_after_update_trigger" BEFORE UPDATE ON "activity_pub_followers"
FOR EACH ROW EXECUTE FUNCTION "activity_pub_followers_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "activity_pub_followers_after_update_trigger" AFTER UP
CREATE OR REPLACE FUNCTION "activity_pub_followers_after_delete"() RETURNS TRIGGER AS $activity_pub_followers_after_delete$
BEGIN
INSERT INTO "activity_pub_followers_history"("action", "original_id", "handle", "inbox", "subject", "activity", "accepted", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."handle", "OLD"."inbox", "OLD"."subject", "OLD"."activity", "OLD"."accepted", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."handle", OLD."inbox", OLD."subject", OLD."activity", OLD."accepted", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$activity_pub_followers_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "activity_pub_followers_after_delete_trigger" AFTER DELETE ON "activity_pub_followers"
CREATE OR REPLACE TRIGGER "activity_pub_followers_after_delete_trigger" BEFORE DELETE ON "activity_pub_followers"
FOR EACH ROW EXECUTE FUNCTION "activity_pub_followers_after_delete"();
##########

Wyświetl plik

@ -50,3 +50,4 @@ CREATE TABLE "activity_pub_incoming_activities"
##########
CREATE INDEX "idx_activity_pub_incoming_activities_status" ON "activity_pub_incoming_activities" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "activity_pub_incoming_activities_after_update"() RETURNS TRIGGER AS $activity_pub_incoming_activities_after_update$
BEGIN
INSERT INTO "activity_pub_incoming_activities_history"("action", "original_id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."identity_id", "OLD"."unique_identifier", "OLD"."timestamp", "OLD"."from", "OLD"."to", "OLD"."content", "OLD"."raw", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."identity_id", OLD."unique_identifier", OLD."timestamp", OLD."from", OLD."to", OLD."content", OLD."raw", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$activity_pub_incoming_activities_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "activity_pub_incoming_activities_after_update_trigger" AFTER UPDATE ON "activity_pub_incoming_activities"
CREATE OR REPLACE TRIGGER "activity_pub_incoming_activities_after_update_trigger" BEFORE UPDATE ON "activity_pub_incoming_activities"
FOR EACH ROW EXECUTE FUNCTION "activity_pub_incoming_activities_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "activity_pub_incoming_activities_after_update_trigger
CREATE OR REPLACE FUNCTION "activity_pub_incoming_activities_after_delete"() RETURNS TRIGGER AS $activity_pub_incoming_activities_after_delete$
BEGIN
INSERT INTO "activity_pub_incoming_activities_history"("action", "original_id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."identity_id", "OLD"."unique_identifier", "OLD"."timestamp", "OLD"."from", "OLD"."to", "OLD"."content", "OLD"."raw", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."identity_id", OLD."unique_identifier", OLD."timestamp", OLD."from", OLD."to", OLD."content", OLD."raw", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$activity_pub_incoming_activities_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "activity_pub_incoming_activities_after_delete_trigger" AFTER DELETE ON "activity_pub_incoming_activities"
CREATE OR REPLACE TRIGGER "activity_pub_incoming_activities_after_delete_trigger" BEFORE DELETE ON "activity_pub_incoming_activities"
FOR EACH ROW EXECUTE FUNCTION "activity_pub_incoming_activities_after_delete"();
##########

Wyświetl plik

@ -50,3 +50,4 @@ CREATE TABLE "activity_pub_outgoing_activities"
##########
CREATE INDEX "idx_activity_pub_outgoing_activities_status" ON "activity_pub_outgoing_activities" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "activity_pub_outgoing_activities_after_update"() RETURNS TRIGGER AS $activity_pub_outgoing_activities_after_update$
BEGIN
INSERT INTO "activity_pub_outgoing_activities_history"("action", "original_id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."identity_id", "OLD"."unique_identifier", "OLD"."timestamp", "OLD"."from", "OLD"."to", "OLD"."content", "OLD"."raw", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."identity_id", OLD."unique_identifier", OLD."timestamp", OLD."from", OLD."to", OLD."content", OLD."raw", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$activity_pub_outgoing_activities_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "activity_pub_outgoing_activities_after_update_trigger" AFTER UPDATE ON "activity_pub_outgoing_activities"
CREATE OR REPLACE TRIGGER "activity_pub_outgoing_activities_after_update_trigger" BEFORE UPDATE ON "activity_pub_outgoing_activities"
FOR EACH ROW EXECUTE FUNCTION "activity_pub_outgoing_activities_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "activity_pub_outgoing_activities_after_update_trigger
CREATE OR REPLACE FUNCTION "activity_pub_outgoing_activities_after_delete"() RETURNS TRIGGER AS $activity_pub_outgoing_activities_after_delete$
BEGIN
INSERT INTO "activity_pub_outgoing_activities_history"("action", "original_id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."identity_id", "OLD"."unique_identifier", "OLD"."timestamp", "OLD"."from", "OLD"."to", "OLD"."content", "OLD"."raw", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."identity_id", OLD."unique_identifier", OLD."timestamp", OLD."from", OLD."to", OLD."content", OLD."raw", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$activity_pub_outgoing_activities_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "activity_pub_outgoing_activities_after_delete_trigger" AFTER DELETE ON "activity_pub_outgoing_activities"
CREATE OR REPLACE TRIGGER "activity_pub_outgoing_activities_after_delete_trigger" BEFORE DELETE ON "activity_pub_outgoing_activities"
FOR EACH ROW EXECUTE FUNCTION "activity_pub_outgoing_activities_after_delete"();
##########

Wyświetl plik

@ -45,3 +45,4 @@ CREATE TABLE "categories"
##########
CREATE INDEX "idx_categories_status" ON "categories" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "categories_after_update"() RETURNS TRIGGER AS $categories_after_update$
BEGIN
INSERT INTO "categories_history"("action", "original_id", "category_type_id", "category_id", "title", "description", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."category_type_id", "OLD"."category_id", "OLD"."title", "OLD"."description", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."category_type_id", OLD."category_id", OLD."title", OLD."description", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$categories_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "categories_after_update_trigger" AFTER UPDATE ON "categories"
CREATE OR REPLACE TRIGGER "categories_after_update_trigger" BEFORE UPDATE ON "categories"
FOR EACH ROW EXECUTE FUNCTION "categories_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "categories_after_update_trigger" AFTER UPDATE ON "cat
CREATE OR REPLACE FUNCTION "categories_after_delete"() RETURNS TRIGGER AS $categories_after_delete$
BEGIN
INSERT INTO "categories_history"("action", "original_id", "category_type_id", "category_id", "title", "description", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."category_type_id", "OLD"."category_id", "OLD"."title", "OLD"."description", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."category_type_id", OLD."category_id", OLD."title", OLD."description", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$categories_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "categories_after_delete_trigger" AFTER DELETE ON "categories"
CREATE OR REPLACE TRIGGER "categories_after_delete_trigger" BEFORE DELETE ON "categories"
FOR EACH ROW EXECUTE FUNCTION "categories_after_delete"();
##########

Wyświetl plik

@ -37,3 +37,4 @@ CREATE TABLE "category_types"
##########
CREATE INDEX "idx_category_types_status" ON "category_types" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "category_types_after_update"() RETURNS TRIGGER AS $category_types_after_update$
BEGIN
INSERT INTO "category_types_history"("action", "original_id", "description", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."description", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."description", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$category_types_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "category_types_after_update_trigger" AFTER UPDATE ON "category_types"
CREATE OR REPLACE TRIGGER "category_types_after_update_trigger" BEFORE UPDATE ON "category_types"
FOR EACH ROW EXECUTE FUNCTION "category_types_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "category_types_after_update_trigger" AFTER UPDATE ON
CREATE OR REPLACE FUNCTION "category_types_after_delete"() RETURNS TRIGGER AS $category_types_after_delete$
BEGIN
INSERT INTO "category_types_history"("action", "original_id", "description", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."description", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."description", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$category_types_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "category_types_after_delete_trigger" AFTER DELETE ON "category_types"
CREATE OR REPLACE TRIGGER "category_types_after_delete_trigger" BEFORE DELETE ON "category_types"
FOR EACH ROW EXECUTE FUNCTION "category_types_after_delete"();
##########

Wyświetl plik

@ -37,3 +37,4 @@ CREATE TABLE "documents"
##########
CREATE INDEX "idx_documents_status" ON "documents" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "documents_after_update"() RETURNS TRIGGER AS $documents_after_update$
BEGIN
INSERT INTO "documents_history"("action", "original_id", "content", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."content", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."content", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$documents_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "documents_after_update_trigger" AFTER UPDATE ON "documents"
CREATE OR REPLACE TRIGGER "documents_after_update_trigger" BEFORE UPDATE ON "documents"
FOR EACH ROW EXECUTE FUNCTION "documents_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "documents_after_update_trigger" AFTER UPDATE ON "docu
CREATE OR REPLACE FUNCTION "documents_after_delete"() RETURNS TRIGGER AS $documents_after_delete$
BEGIN
INSERT INTO "documents_history"("action", "original_id", "content", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."content", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."content", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$documents_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "documents_after_delete_trigger" AFTER DELETE ON "documents"
CREATE OR REPLACE TRIGGER "documents_after_delete_trigger" BEFORE DELETE ON "documents"
FOR EACH ROW EXECUTE FUNCTION "documents_after_delete"();
##########

Wyświetl plik

@ -77,3 +77,4 @@ CREATE TABLE "identities"
##########
CREATE INDEX "idx_identities_status" ON "identities" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "identities_after_update"() RETURNS TRIGGER AS $identities_after_update$
BEGIN
INSERT INTO "identities_history"("action", "original_id", "username", "phone_number", "phone_number_confirmed", "first_name", "last_name", "display_name", "email", "email_confirmed", "avatar", "banner", "summary", "token", "multi_factor", "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."username", "OLD"."phone_number", "OLD"."phone_number_confirmed", "OLD"."first_name", "OLD"."last_name", "OLD"."display_name", "OLD"."email", "OLD"."email_confirmed", "OLD"."avatar", "OLD"."banner", "OLD"."summary", "OLD"."token", "OLD"."multi_factor", "OLD"."hash", "OLD"."salt", "OLD"."public_key", "OLD"."private_key", "OLD"."permission", "OLD"."restriction", "OLD"."last_login", "OLD"."login_count", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."username", OLD."phone_number", OLD."phone_number_confirmed", OLD."first_name", OLD."last_name", OLD."display_name", OLD."email", OLD."email_confirmed", OLD."avatar", OLD."banner", OLD."summary", OLD."token", OLD."multi_factor", OLD."hash", OLD."salt", OLD."public_key", OLD."private_key", OLD."permission", OLD."restriction", OLD."last_login", OLD."login_count", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$identities_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "identities_after_update_trigger" AFTER UPDATE ON "identities"
CREATE OR REPLACE TRIGGER "identities_after_update_trigger" BEFORE UPDATE ON "identities"
FOR EACH ROW EXECUTE FUNCTION "identities_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "identities_after_update_trigger" AFTER UPDATE ON "ide
CREATE OR REPLACE FUNCTION "identities_after_delete"() RETURNS TRIGGER AS $identities_after_delete$
BEGIN
INSERT INTO "identities_history"("action", "original_id", "username", "phone_number", "phone_number_confirmed", "first_name", "last_name", "display_name", "email", "email_confirmed", "avatar", "banner", "summary", "token", "multi_factor", "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."username", "OLD"."phone_number", "OLD"."phone_number_confirmed", "OLD"."first_name", "OLD"."last_name", "OLD"."display_name", "OLD"."email", "OLD"."email_confirmed", "OLD"."avatar", "OLD"."banner", "OLD"."summary", "OLD"."token", "OLD"."multi_factor", "OLD"."hash", "OLD"."salt", "OLD"."public_key", "OLD"."private_key", "OLD"."permission", "OLD"."restriction", "OLD"."last_login", "OLD"."login_count", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."username", OLD."phone_number", OLD."phone_number_confirmed", OLD."first_name", OLD."last_name", OLD."display_name", OLD."email", OLD."email_confirmed", OLD."avatar", OLD."banner", OLD."summary", OLD."token", OLD."multi_factor", OLD."hash", OLD."salt", OLD."public_key", OLD."private_key", OLD."permission", OLD."restriction", OLD."last_login", OLD."login_count", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$identities_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "identities_after_delete_trigger" AFTER DELETE ON "identities"
CREATE OR REPLACE TRIGGER "identities_after_delete_trigger" BEFORE DELETE ON "identities"
FOR EACH ROW EXECUTE FUNCTION "identities_after_delete"();
##########

Wyświetl plik

@ -51,3 +51,4 @@ CREATE TABLE "remote_activities"
##########
CREATE INDEX "idx_remote_activities_status" ON "remote_activities" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "remote_activities_after_update"() RETURNS TRIGGER AS $remote_activities_after_update$
BEGIN
INSERT INTO "remote_activities_history"("action", "original_id", "entry_point", "duration", "successful", "error_message", "remote_address", "user_agent", "event_type", "timestamp", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."entry_point", "OLD"."duration", "OLD"."successful", "OLD"."error_message", "OLD"."remote_address", "OLD"."user_agent", "OLD"."event_type", "OLD"."timestamp", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."entry_point", OLD."duration", OLD."successful", OLD."error_message", OLD."remote_address", OLD."user_agent", OLD."event_type", OLD."timestamp", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$remote_activities_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "remote_activities_after_update_trigger" AFTER UPDATE ON "remote_activities"
CREATE OR REPLACE TRIGGER "remote_activities_after_update_trigger" BEFORE UPDATE ON "remote_activities"
FOR EACH ROW EXECUTE FUNCTION "remote_activities_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "remote_activities_after_update_trigger" AFTER UPDATE
CREATE OR REPLACE FUNCTION "remote_activities_after_delete"() RETURNS TRIGGER AS $remote_activities_after_delete$
BEGIN
INSERT INTO "remote_activities_history"("action", "original_id", "entry_point", "duration", "successful", "error_message", "remote_address", "user_agent", "event_type", "timestamp", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."entry_point", "OLD"."duration", "OLD"."successful", "OLD"."error_message", "OLD"."remote_address", "OLD"."user_agent", "OLD"."event_type", "OLD"."timestamp", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."entry_point", OLD."duration", OLD."successful", OLD."error_message", OLD."remote_address", OLD."user_agent", OLD."event_type", OLD."timestamp", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$remote_activities_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "remote_activities_after_delete_trigger" AFTER DELETE ON "remote_activities"
CREATE OR REPLACE TRIGGER "remote_activities_after_delete_trigger" BEFORE DELETE ON "remote_activities"
FOR EACH ROW EXECUTE FUNCTION "remote_activities_after_delete"();
##########

Wyświetl plik

@ -39,3 +39,4 @@ CREATE TABLE "system_schedules"
##########
CREATE INDEX "idx_system_schedules_status" ON "system_schedules" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "system_schedules_after_update"() RETURNS TRIGGER AS $system_schedules_after_update$
BEGIN
INSERT INTO "system_schedules_history"("action", "original_id", "enabled", "config", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."enabled", "OLD"."config", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."enabled", OLD."config", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$system_schedules_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "system_schedules_after_update_trigger" AFTER UPDATE ON "system_schedules"
CREATE OR REPLACE TRIGGER "system_schedules_after_update_trigger" BEFORE UPDATE ON "system_schedules"
FOR EACH ROW EXECUTE FUNCTION "system_schedules_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "system_schedules_after_update_trigger" AFTER UPDATE O
CREATE OR REPLACE FUNCTION "system_schedules_after_delete"() RETURNS TRIGGER AS $system_schedules_after_delete$
BEGIN
INSERT INTO "system_schedules_history"("action", "original_id", "enabled", "config", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."enabled", "OLD"."config", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."enabled", OLD."config", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$system_schedules_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "system_schedules_after_delete_trigger" AFTER DELETE ON "system_schedules"
CREATE OR REPLACE TRIGGER "system_schedules_after_delete_trigger" BEFORE DELETE ON "system_schedules"
FOR EACH ROW EXECUTE FUNCTION "system_schedules_after_delete"();
##########

Wyświetl plik

@ -38,3 +38,4 @@ CREATE TABLE "users"
##########
CREATE INDEX "idx_users_status" ON "users" ("status");

Wyświetl plik

@ -3,13 +3,14 @@
CREATE OR REPLACE FUNCTION "users_after_update"() RETURNS TRIGGER AS $users_after_update$
BEGIN
INSERT INTO "users_history"("action", "original_id", "github", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('update', "OLD"."id", "OLD"."github", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('update', OLD."id", OLD."github", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN NEW;
END;
$users_after_update$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "users_after_update_trigger" AFTER UPDATE ON "users"
CREATE OR REPLACE TRIGGER "users_after_update_trigger" BEFORE UPDATE ON "users"
FOR EACH ROW EXECUTE FUNCTION "users_after_update"();
##########
@ -17,12 +18,14 @@ CREATE OR REPLACE TRIGGER "users_after_update_trigger" AFTER UPDATE ON "users"
CREATE OR REPLACE FUNCTION "users_after_delete"() RETURNS TRIGGER AS $users_after_delete$
BEGIN
INSERT INTO "users_history"("action", "original_id", "github", "editor", "status", "sort_order", "queued_at", "created_at", "updated_at", "payload")
VALUES('delete', "OLD"."id", "OLD"."github", "OLD"."editor", "OLD"."status", "OLD"."sort_order", "OLD"."queued_at", "OLD"."created_at", "OLD"."updated_at", "OLD"."payload");
VALUES('delete', OLD."id", OLD."github", OLD."editor", OLD."status", OLD."sort_order", OLD."queued_at", OLD."created_at", OLD."updated_at", OLD."payload");
RETURN OLD;
END;
$users_after_delete$ LANGUAGE plpgsql;
##########
CREATE OR REPLACE TRIGGER "users_after_delete_trigger" AFTER DELETE ON "users"
CREATE OR REPLACE TRIGGER "users_after_delete_trigger" BEFORE DELETE ON "users"
FOR EACH ROW EXECUTE FUNCTION "users_after_delete"();
##########

Wyświetl plik

@ -19,7 +19,7 @@ func newSystemSchedulesRepository(logger ILogger) ISystemSchedulesRepository {
}
func (repository *systemSchedulesRepository) Add(entity ISystemScheduleEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *systemSchedulesRepository) Add(entity ISystemScheduleEntity, e
}
func (repository *systemSchedulesRepository) AddAtomic(transaction IRepositoryTransaction, entity ISystemScheduleEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

Wyświetl plik

@ -19,7 +19,7 @@ func newUsersRepository(logger ILogger) IUsersRepository {
}
func (repository *usersRepository) Add(entity IUserEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}
@ -29,7 +29,7 @@ func (repository *usersRepository) Add(entity IUserEntity, editor int64) error {
}
func (repository *usersRepository) AddAtomic(transaction IRepositoryTransaction, entity IUserEntity, editor int64) error {
if entity.Id() <= 0 {
if entity.Id() < 0 {
return ERROR_INVALID_PARAMETERS
}

19
config.yaml 100644
Wyświetl plik

@ -0,0 +1,19 @@
environment: development
server:
fqdn: localhost
protocol: http
ports:
passive: 7080
# used for secure cookie
# doc: https://pkg.go.dev/github.com/gorilla/securecookie@v1.1.1
hash_key: '---INSERT-YOUR-HASH-KEY---'
block_key: '---INSERT-YOUR-BLOCK-KEY---'
postgres:
host: 127.0.0.1
port: 5432
database: greatape
username: postgres
password: password

Wyświetl plik

@ -1,9 +1,16 @@
environment: development
server:
protocol: http
fqdn: localhost
protocol: http
ports:
passive: 7080
# used for secure cookie
# doc: https://pkg.go.dev/github.com/gorilla/securecookie@v1.1.1
hash_key: '---INSERT-YOUR-HASH-KEY---'
block_key: '---INSERT-YOUR-BLOCK-KEY---'
postgres:
host: 127.0.0.1
port: 5432

8
go.mod
Wyświetl plik

@ -5,24 +5,22 @@ go 1.19
require (
github.com/robfig/cron v1.2.0
github.com/sendgrid/sendgrid-go v3.12.0+incompatible
github.com/xeronith/diamante v1.7.0
github.com/xeronith/diamante v1.7.4
google.golang.org/protobuf v1.28.1
)
require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/gofrs/uuid v3.3.0+incompatible // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/influxdata/influxdb v1.11.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/jinzhu/configor v1.2.1 // indirect
github.com/labstack/echo/v4 v4.10.2 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/nyaruka/phonenumbers v1.1.6 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/sendgrid/rest v2.6.9+incompatible // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect

22
go.sum
Wyświetl plik

@ -1,4 +1,5 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -7,17 +8,14 @@ github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/influxdata/influxdb v1.11.0 h1:0X+ZsbcOWc6AEi5MHee9BYqXCKmz8IZsljrRYjmV8Qg=
github.com/influxdata/influxdb v1.11.0/go.mod h1:V93tJcidY0Zh0LtSONZWnXXGDyt20dtVf+Ddp4EnhaA=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/jinzhu/configor v1.2.1 h1:OKk9dsR8i6HPOCZR8BcMtcEImAFjIhbJFZNyn5GCZko=
github.com/jinzhu/configor v1.2.1/go.mod h1:nX89/MOmDba7ZX7GCyU/VIaQ2Ar2aizBl2d3JLF/rDc=
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
@ -31,14 +29,10 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/nyaruka/phonenumbers v1.1.6 h1:DcueYq7QrOArAprAYNoQfDgp0KetO4LqtnBtQC6Wyes=
github.com/nyaruka/phonenumbers v1.1.6/go.mod h1:yShPJHDSH3aTKzCbXyVxNpbl2kA+F+Ne5Pun/MvFRos=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/sendgrid/rest v2.6.9+incompatible h1:1EyIcsNdn9KIisLW50MKwmSRSK+ekueiEMJ7NEoxJo0=
github.com/sendgrid/rest v2.6.9+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE=
github.com/sendgrid/sendgrid-go v3.12.0+incompatible h1:/N2vx18Fg1KmQOh6zESc5FJB8pYwt5QFBDflYPh1KVg=
@ -51,8 +45,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/xeronith/diamante v1.7.0 h1:/0iEPvZlvUGQuJSyFk+p3mC00i1kBnZyyun8PCcI4WE=
github.com/xeronith/diamante v1.7.0/go.mod h1:8eBxUVrSAajFctedef0WEaOGzrRSj3ZIyFn8bEwWmzQ=
github.com/xeronith/diamante v1.7.4 h1:V7llhK1fFt4jNH3t4OsEBx3vMCk27cQ3BWqPl2DekAg=
github.com/xeronith/diamante v1.7.4/go.mod h1:9Tm1tILSKRFRLqvGkG6fTNdLpQbsTZohTLD6xRoWkx8=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
@ -70,11 +64,11 @@ golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

Wyświetl plik

@ -30,7 +30,7 @@ func TestMain(main *testing.M) {
logger.SetLevel(logging.LEVEL_SUPPRESS_SYS_COMP)
// configuration
configuration := settings.NewTestConfiguration()
configuration.GetMySQLConfiguration().SetDatabase("greatape")
configuration.GetPostgreSQLConfiguration().SetDatabase("greatape")
// factories
operationsFactory := operations.NewFactory()
handlersFactory := handlers.NewFactory()