This commit is contained in:
tsmethurst 2021-09-07 18:18:21 +02:00
commit 28f89891d6
9 changed files with 47 additions and 47 deletions

View file

@ -40,18 +40,18 @@ func adminCommands() []*cli.Command {
Usage: "create a new account", Usage: "create a new account",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: config.EmailFlag, Name: config.EmailFlag,
Usage: config.EmailUsage, Usage: config.EmailUsage,
Required: true, Required: true,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: config.PasswordFlag, Name: config.PasswordFlag,
Usage: config.PasswordUsage, Usage: config.PasswordUsage,
Required: true, Required: true,
}, },
}, },
@ -64,8 +64,8 @@ func adminCommands() []*cli.Command {
Usage: "confirm an existing account manually, thereby skipping email confirmation", Usage: "confirm an existing account manually, thereby skipping email confirmation",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
}, },
@ -78,8 +78,8 @@ func adminCommands() []*cli.Command {
Usage: "promote an account to admin", Usage: "promote an account to admin",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
}, },
@ -92,8 +92,8 @@ func adminCommands() []*cli.Command {
Usage: "demote an account from admin to normal user", Usage: "demote an account from admin to normal user",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
}, },
@ -106,8 +106,8 @@ func adminCommands() []*cli.Command {
Usage: "prevent an account from signing in or posting etc, but don't delete anything", Usage: "prevent an account from signing in or posting etc, but don't delete anything",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
}, },
@ -120,8 +120,8 @@ func adminCommands() []*cli.Command {
Usage: "completely remove an account and all of its posts, media, etc", Usage: "completely remove an account and all of its posts, media, etc",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
}, },
@ -134,13 +134,13 @@ func adminCommands() []*cli.Command {
Usage: "set a new password for the given account", Usage: "set a new password for the given account",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.UsernameFlag, Name: config.UsernameFlag,
Usage: config.UsernameUsage, Usage: config.UsernameUsage,
Required: true, Required: true,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: config.PasswordFlag, Name: config.PasswordFlag,
Usage: config.PasswordUsage, Usage: config.PasswordUsage,
Required: true, Required: true,
}, },
}, },
@ -155,8 +155,8 @@ func adminCommands() []*cli.Command {
Usage: "export data from the database to file at the given path", Usage: "export data from the database to file at the given path",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: config.TransPathFlag, Name: config.TransPathFlag,
Usage: config.TransPathUsage, Usage: config.TransPathUsage,
Required: true, Required: true,
}, },
}, },

View file

@ -37,7 +37,7 @@ const (
PasswordFlag = "password" PasswordFlag = "password"
PasswordUsage = "the password to set for this account" PasswordUsage = "the password to set for this account"
TransPathFlag = "path" TransPathFlag = "path"
TransPathUsage = "the path of the file to import from/export to" TransPathUsage = "the path of the file to import from/export to"
) )

View file

@ -36,7 +36,7 @@ type importer struct {
func NewImporter(db db.DB, log *logrus.Logger) Importer { func NewImporter(db db.DB, log *logrus.Logger) Importer {
return &importer{ return &importer{
db: db, db: db,
log: log, log: log,
} }
} }

View file

@ -21,10 +21,10 @@ package trans
import "time" import "time"
type Block struct { type Block struct {
Type TransType `json:"type" bun:"-"` Type TransType `json:"type" bun:"-"`
ID string `json:"id"` ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"` CreatedAt *time.Time `json:"createdAt"`
URI string `json:"uri"` URI string `json:"uri"`
AccountID string `json:"accountId"` AccountID string `json:"accountId"`
TargetAccountID string `json:"targetAccountId"` TargetAccountID string `json:"targetAccountId"`
} }

View file

@ -21,10 +21,10 @@ package trans
import "time" import "time"
type Follow struct { type Follow struct {
Type TransType `json:"type" bun:"-"` Type TransType `json:"type" bun:"-"`
ID string `json:"id"` ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"` CreatedAt *time.Time `json:"createdAt"`
URI string `json:"uri"` URI string `json:"uri"`
AccountID string `json:"accountId"` AccountID string `json:"accountId"`
TargetAccountID string `json:"targetAccountId"` TargetAccountID string `json:"targetAccountId"`
} }

View file

@ -21,10 +21,10 @@ package trans
import "time" import "time"
type FollowRequest struct { type FollowRequest struct {
Type TransType `json:"type" bun:"-"` Type TransType `json:"type" bun:"-"`
ID string `json:"id"` ID string `json:"id"`
CreatedAt *time.Time `json:"createdAt"` CreatedAt *time.Time `json:"createdAt"`
URI string `json:"uri"` URI string `json:"uri"`
AccountID string `json:"accountId"` AccountID string `json:"accountId"`
TargetAccountID string `json:"targetAccountId"` TargetAccountID string `json:"targetAccountId"`
} }

View file

@ -29,7 +29,7 @@ type Instance struct {
Domain string `json:"domain"` Domain string `json:"domain"`
Title string `json:"title,omitempty" bun:",nullzero"` Title string `json:"title,omitempty" bun:",nullzero"`
URI string `json:"uri"` URI string `json:"uri"`
SuspendedAt *time.Time `json:"suspendedAt,omitempty" bun:",nullzero"` SuspendedAt *time.Time `json:"suspendedAt,omitempty" bun:",nullzero"`
DomainBlockID string `json:"domainBlockID,omitempty" bun:",nullzero"` DomainBlockID string `json:"domainBlockID,omitempty" bun:",nullzero"`
ShortDescription string `json:"shortDescription,omitempty" bun:",nullzero"` ShortDescription string `json:"shortDescription,omitempty" bun:",nullzero"`
Description string `json:"description,omitempty" bun:",nullzero"` Description string `json:"description,omitempty" bun:",nullzero"`

View file

@ -29,21 +29,21 @@ type User struct {
Email string `json:"email,omitempty" bun:",nullzero"` Email string `json:"email,omitempty" bun:",nullzero"`
AccountID string `json:"accountID"` AccountID string `json:"accountID"`
EncryptedPassword string `json:"encryptedPassword"` EncryptedPassword string `json:"encryptedPassword"`
CurrentSignInAt *time.Time `json:"currentSignInAt,omitempty" bun:",nullzero"` CurrentSignInAt *time.Time `json:"currentSignInAt,omitempty" bun:",nullzero"`
LastSignInAt *time.Time `json:"lastSignInAt,omitempty" bun:",nullzero"` LastSignInAt *time.Time `json:"lastSignInAt,omitempty" bun:",nullzero"`
InviteID string `json:"inviteID,omitempty" bun:",nullzero"` InviteID string `json:"inviteID,omitempty" bun:",nullzero"`
ChosenLanguages []string `json:"chosenLanguages,omitempty" bun:",nullzero"` ChosenLanguages []string `json:"chosenLanguages,omitempty" bun:",nullzero"`
FilteredLanguages []string `json:"filteredLanguage,omitempty" bun:",nullzero"` FilteredLanguages []string `json:"filteredLanguage,omitempty" bun:",nullzero"`
Locale string `json:"locale" bun:",nullzero"` Locale string `json:"locale" bun:",nullzero"`
LastEmailedAt time.Time `json:"lastEmailedAt,omitempty" bun:",nullzero"` LastEmailedAt time.Time `json:"lastEmailedAt,omitempty" bun:",nullzero"`
ConfirmationToken string `json:"confirmationToken,omitempty" bun:",nullzero"` ConfirmationToken string `json:"confirmationToken,omitempty" bun:",nullzero"`
ConfirmationSentAt *time.Time `json:"confirmationTokenSentAt,omitempty" bun:",nullzero"` ConfirmationSentAt *time.Time `json:"confirmationTokenSentAt,omitempty" bun:",nullzero"`
ConfirmedAt *time.Time `json:"confirmedAt,omitempty" bun:",nullzero"` ConfirmedAt *time.Time `json:"confirmedAt,omitempty" bun:",nullzero"`
UnconfirmedEmail string `json:"unconfirmedEmail,omitempty" bun:",nullzero"` UnconfirmedEmail string `json:"unconfirmedEmail,omitempty" bun:",nullzero"`
Moderator bool `json:"moderator"` Moderator bool `json:"moderator"`
Admin bool `json:"admin"` Admin bool `json:"admin"`
Disabled bool `json:"disabled"` Disabled bool `json:"disabled"`
Approved bool `json:"approved"` Approved bool `json:"approved"`
ResetPasswordToken string `json:"resetPasswordToken,omitempty" bun:",nullzero"` ResetPasswordToken string `json:"resetPasswordToken,omitempty" bun:",nullzero"`
ResetPasswordSentAt *time.Time `json:"resetPasswordSentAt,omitempty" bun:",nullzero"` ResetPasswordSentAt *time.Time `json:"resetPasswordSentAt,omitempty" bun:",nullzero"`
} }

View file

@ -33,7 +33,7 @@ type TransTestSuite struct {
func (suite *TransTestSuite) SetupTest() { func (suite *TransTestSuite) SetupTest() {
suite.db = testrig.NewTestDB() suite.db = testrig.NewTestDB()
suite.log = testrig.NewTestLog() suite.log = testrig.NewTestLog()
testrig.StandardDBSetup(suite.db, nil) testrig.StandardDBSetup(suite.db, nil)
} }