working pretty alright!

This commit is contained in:
tsmethurst 2021-09-07 18:17:12 +02:00
commit 7e80eafaea
20 changed files with 744 additions and 187 deletions

View file

@ -28,7 +28,6 @@ type Account struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Username string `json:"username"`
Domain string `json:"domain,omitempty" bun:",nullzero"`
Locked bool `json:"locked"`

View file

@ -23,8 +23,7 @@ import "time"
type Block struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt *time.Time `json:"createdAt"`
URI string `json:"uri"`
AccountID string `json:"accountId"`
TargetAccountID string `json:"targetAccountId"`

View file

@ -1,3 +1,32 @@
/*
GoToSocial
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package trans
import "time"
type DomainBlock struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"`
CreatedByAccountID string `json:"createdByAccountID"`
PrivateComment string `json:"privateComment,omitempty"`
PublicComment string `json:"publicComment,omitempty"`
Obfuscate bool `json:"obfuscate"`
SubscriptionID string `json:"subscriptionID,omitempty"`
}

View file

@ -23,8 +23,7 @@ import "time"
type Follow struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt *time.Time `json:"createdAt"`
URI string `json:"uri"`
AccountID string `json:"accountId"`
TargetAccountID string `json:"targetAccountId"`

View file

@ -0,0 +1,30 @@
/*
GoToSocial
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package trans
import "time"
type FollowRequest struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"`
URI string `json:"uri"`
AccountID string `json:"accountId"`
TargetAccountID string `json:"targetAccountId"`
}

View file

@ -0,0 +1,42 @@
/*
GoToSocial
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package trans
import (
"time"
)
type Instance struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"`
Domain string `json:"domain"`
Title string `json:"title,omitempty" bun:",nullzero"`
URI string `json:"uri"`
SuspendedAt *time.Time `json:"suspendedAt,omitempty" bun:",nullzero"`
DomainBlockID string `json:"domainBlockID,omitempty" bun:",nullzero"`
ShortDescription string `json:"shortDescription,omitempty" bun:",nullzero"`
Description string `json:"description,omitempty" bun:",nullzero"`
Terms string `json:"terms,omitempty" bun:",nullzero"`
ContactEmail string `json:"contactEmail,omitempty" bun:",nullzero"`
ContactAccountUsername string `json:"contactAccountUsername,omitempty" bun:",nullzero"`
ContactAccountID string `json:"contactAccountID,omitempty" bun:",nullzero"`
Reputation int64 `json:"reputation"`
Version string `json:"version,omitempty" bun:",nullzero"`
}

View file

@ -25,9 +25,14 @@ type TransType string
// Type of the trans entry. Describes how it should be read from file.
const (
TransAccount TransType = "account"
TransBlock TransType = "block"
TransFollow TransType = "follow"
TransAccount TransType = "account"
TransBlock TransType = "block"
TransDomainBlock TransType = "domainBlock"
TransEmailDomainBlock TransType = "emailDomainBlock"
TransFollow TransType = "follow"
TransFollowRequest TransType = "followRequest"
TransInstance TransType = "instance"
TransUser TransType = "user"
)
type TransEntry map[string]interface{}

View file

@ -0,0 +1,49 @@
/*
GoToSocial
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package trans
import (
"time"
)
type User struct {
Type TransType `json:"type" bun:"-"`
ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"`
Email string `json:"email,omitempty" bun:",nullzero"`
AccountID string `json:"accountID"`
EncryptedPassword string `json:"encryptedPassword"`
CurrentSignInAt *time.Time `json:"currentSignInAt,omitempty" bun:",nullzero"`
LastSignInAt *time.Time `json:"lastSignInAt,omitempty" bun:",nullzero"`
InviteID string `json:"inviteID,omitempty" bun:",nullzero"`
ChosenLanguages []string `json:"chosenLanguages,omitempty" bun:",nullzero"`
FilteredLanguages []string `json:"filteredLanguage,omitempty" bun:",nullzero"`
Locale string `json:"locale" bun:",nullzero"`
LastEmailedAt time.Time `json:"lastEmailedAt,omitempty" bun:",nullzero"`
ConfirmationToken string `json:"confirmationToken,omitempty" bun:",nullzero"`
ConfirmationSentAt *time.Time `json:"confirmationTokenSentAt,omitempty" bun:",nullzero"`
ConfirmedAt *time.Time `json:"confirmedAt,omitempty" bun:",nullzero"`
UnconfirmedEmail string `json:"unconfirmedEmail,omitempty" bun:",nullzero"`
Moderator bool `json:"moderator"`
Admin bool `json:"admin"`
Disabled bool `json:"disabled"`
Approved bool `json:"approved"`
ResetPasswordToken string `json:"resetPasswordToken,omitempty" bun:",nullzero"`
ResetPasswordSentAt *time.Time `json:"resetPasswordSentAt,omitempty" bun:",nullzero"`
}