Cleanup JSON field names for all types
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ func (ctrl *Auth) Login(ctx context.Context, r *server.AuthLoginRequest) (interf
|
||||
|
||||
return struct {
|
||||
JWT string
|
||||
User *types.User
|
||||
User *types.User `json:"user"`
|
||||
}{
|
||||
JWT: ctrl.svc.token.Encode(user),
|
||||
User: user,
|
||||
|
||||
@@ -17,8 +17,8 @@ type (
|
||||
Size uint `db:"size"`
|
||||
Mimetype string `db:"mimetype"`
|
||||
Name string `db:"name"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
|
||||
}
|
||||
)
|
||||
|
||||
+16
-14
@@ -7,21 +7,23 @@ import (
|
||||
|
||||
type (
|
||||
Channel struct {
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
Topic string `db:"topic"`
|
||||
Type ChannelType `db:"type"`
|
||||
Meta json.RawMessage `db:"meta"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Topic string `json:"topic" db:"topic"`
|
||||
Type ChannelType `json:"type" db:"type"`
|
||||
Meta json.RawMessage `json:"-" db:"meta"`
|
||||
|
||||
CreatorID uint64 `db:"rel_creator"`
|
||||
OrganisationID uint64 `db:"rel_organisation"`
|
||||
CreatorID uint64 `json:"creatorId" db:"rel_creator"`
|
||||
OrganisationID uint64 `json:"organisationId" db:"rel_organisation"`
|
||||
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
ArchivedAt *time.Time `json:"archived_at,omitempty" db:"archived_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
ArchivedAt *time.Time `json:"archivedAt,omitempty" db:"archived_at"`
|
||||
DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
|
||||
|
||||
LastMessageID uint64 `json:",omitempty" db:"rel_last_message"`
|
||||
|
||||
Member *ChannelMember `json:"-" db:"-"`
|
||||
}
|
||||
|
||||
ChannelMember struct {
|
||||
@@ -30,8 +32,8 @@ type (
|
||||
|
||||
Type ChannelMembershipType `db:"type"`
|
||||
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
}
|
||||
|
||||
ChannelFilter struct {
|
||||
@@ -48,5 +50,5 @@ const (
|
||||
|
||||
ChannelTypePublic ChannelType = "public"
|
||||
ChannelTypePrivate = "private"
|
||||
ChannelTypeDirect = "direct"
|
||||
ChannelTypeGroup = "group"
|
||||
)
|
||||
|
||||
@@ -6,15 +6,15 @@ import (
|
||||
|
||||
type (
|
||||
Message struct {
|
||||
ID uint64 `db:"id"`
|
||||
Type string `db:"type"`
|
||||
Message string `db:"message"`
|
||||
UserID uint64 `db:"rel_user"`
|
||||
ChannelID uint64 `db:"rel_channel"`
|
||||
ReplyTo uint64 `db:"reply_to"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
Type string `json:"type" db:"type"`
|
||||
Message string `json:"message" db:"message"`
|
||||
UserID uint64 `json:"userId" db:"rel_user"`
|
||||
ChannelID uint64 `json:"channelId" db:"rel_channel"`
|
||||
ReplyTo uint64 `json:"replyTo" db:"reply_to"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
|
||||
}
|
||||
|
||||
MessageFilter struct {
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
type (
|
||||
// Organisations - Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.
|
||||
Organisation struct {
|
||||
ID uint64 `db:"id"`
|
||||
FQN string `db:"fqn"`
|
||||
Name string `db:"name"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
ArchivedAt *time.Time `json:"archived_at,omitempty" db:"archived_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
FQN string `json:"fqn" db:"fqn"`
|
||||
Name string `json:"name" db:"name"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
ArchivedAt *time.Time `json:"archivedAt,omitempty" db:"archived_at"`
|
||||
DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
|
||||
}
|
||||
|
||||
OrganisationFilter struct {
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
|
||||
type (
|
||||
Reaction struct {
|
||||
ID uint64 `db:"id"`
|
||||
UserID uint64 `db:"rel_user"`
|
||||
MessageID uint64 `db:"rel_message"`
|
||||
ChannelID uint64 `db:"rel_channel"`
|
||||
Reaction string `db:"reaction"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
UserID uint64 `json:"userId" db:"rel_user"`
|
||||
MessageID uint64 `json:"messageId" db:"rel_message"`
|
||||
ChannelID uint64 `json:"channelId" db:"rel_channel"`
|
||||
Reaction string `json:"reaction" db:"reaction"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
}
|
||||
)
|
||||
|
||||
+7
-7
@@ -7,13 +7,13 @@ import (
|
||||
type (
|
||||
// Teams - An organisation may have many teams. Teams may have many channels available. Access to channels may be shared between teams.
|
||||
Team struct {
|
||||
ID uint64 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
Handle string `db:"handle"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
ArchivedAt *time.Time `json:"archived_at,omitempty" db:"archived_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Handle string `json:"handle" db:"handle"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
ArchivedAt *time.Time `json:"archivedAt,omitempty" db:"archived_at"`
|
||||
DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
|
||||
}
|
||||
|
||||
TeamFilter struct {
|
||||
|
||||
+7
-7
@@ -7,15 +7,15 @@ import (
|
||||
|
||||
type (
|
||||
User struct {
|
||||
ID uint64 `db:"id"`
|
||||
Username string `db:"username"`
|
||||
ID uint64 `json:"id" db:"id"`
|
||||
Username string `json:"username" db:"username"`
|
||||
Meta json.RawMessage `json:"-" db:"meta"`
|
||||
OrganisationID uint64 `db:"rel_organisation"`
|
||||
OrganisationID uint64 `json:"organisationId" db:"rel_organisation"`
|
||||
Password []byte `json:"-" db:"password"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
|
||||
SuspendedAt *time.Time `json:"suspended_at,omitempty" db:"suspended_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at"`
|
||||
SuspendedAt *time.Time `json:"suspendedAt,omitempty" db:"suspended_at"`
|
||||
DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
|
||||
}
|
||||
|
||||
UserFilter struct {
|
||||
|
||||
Reference in New Issue
Block a user