summaryrefslogtreecommitdiff
path: root/internal/api/model/admin.go
blob: ada415546f1a3cf83f59b7a24e2312364a970349 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
   GoToSocial
   Copyright (C) 2021-2022 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 model

// AdminAccountInfo models the admin view of an account's details.
type AdminAccountInfo struct {
	// The ID of the account in the database.
	ID string `json:"id"`
	// The username of the account.
	Username string `json:"username"`
	// The domain of the account.
	Domain string `json:"domain"`
	// When the account was first discovered. (ISO 8601 Datetime)
	CreatedAt string `json:"created_at"`
	// The email address associated with the account.
	Email string `json:"email"`
	// The IP address last used to login to this account.
	IP string `json:"ip"`
	// The locale of the account. (ISO 639 Part 1 two-letter language code)
	Locale string `json:"locale"`
	// Invite request text
	InviteRequest string `json:"invite_request"`
	// The current role of the account.
	Role string `json:"role"`
	// Whether the account has confirmed their email address.
	Confirmed bool `json:"confirmed"`
	// Whether the account is currently approved.
	Approved bool `json:"approved"`
	// Whether the account is currently disabled.
	Disabled bool `json:"disabled"`
	// Whether the account is currently silenced
	Silenced bool `json:"silenced"`
	// Whether the account is currently suspended.
	Suspended bool `json:"suspended"`
	// User-level information about the account.
	Account *Account `json:"account"`
	// The ID of the application that created this account.
	CreatedByApplicationID string `json:"created_by_application_id,omitempty"`
	// The ID of the account that invited this user
	InvitedByAccountID string `json:"invited_by_account_id"`
}

// AdminReportInfo models the admin view of a report.
type AdminReportInfo struct {
	// The ID of the report in the database.
	ID string `json:"id"`
	// The action taken to resolve this report.
	ActionTaken string `json:"action_taken"`
	// An optional reason for reporting.
	Comment string `json:"comment"`
	// The time the report was filed. (ISO 8601 Datetime)
	CreatedAt string `json:"created_at"`
	// The time of last action on this report. (ISO 8601 Datetime)
	UpdatedAt string `json:"updated_at"`
	// The account which filed the report.
	Account *Account `json:"account"`
	// The account being reported.
	TargetAccount *Account `json:"target_account"`
	// The account of the moderator assigned to this report.
	AssignedAccount *Account `json:"assigned_account"`
	// The action taken by the moderator who handled the report.
	ActionTakenByAccount string `json:"action_taken_by_account"`
	// Statuses attached to the report, for context.
	Statuses []Status `json:"statuses"`
}

// AdminAccountActionRequest models the admin view of an account's details.
//
// swagger:ignore
type AdminAccountActionRequest struct {
	// Type of the account action. One of disable, silence, suspend.
	Type string `form:"type" json:"type" xml:"type"`
	// Text describing why an action was taken.
	Text string `form:"text" json:"text" xml:"text"`
	// ID of the account to be acted on.
	TargetAccountID string `form:"-" json:"-" xml:"-"`
}