This commit is contained in:
7
internal/dtos/request/entity.go
Normal file
7
internal/dtos/request/entity.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package request
|
||||
|
||||
type SearchEntityDto struct {
|
||||
Cursor string `json:"cursor" query:"cursor" validate:"omitempty,uuid"`
|
||||
Limit int `json:"limit" query:"limit" validate:"omitempty,min=1,max=100"`
|
||||
Name string `json:"name" query:"name" validate:"omitempty,max=255"`
|
||||
}
|
||||
10
internal/dtos/request/geometry.go
Normal file
10
internal/dtos/request/geometry.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package request
|
||||
|
||||
type SearchGeometryDto struct {
|
||||
MinLng *float64 `query:"min_lng" validate:"required,gte=-180,lte=180"`
|
||||
MinLat *float64 `query:"min_lat" validate:"required,gte=-90,lte=90"`
|
||||
MaxLng *float64 `query:"max_lng" validate:"required,gte=-180,lte=180"`
|
||||
MaxLat *float64 `query:"max_lat" validate:"required,gte=-90,lte=90"`
|
||||
TimePoint *int32 `json:"time" query:"time" validate:"omitempty,number"`
|
||||
EntityID *string `json:"entity_id" query:"entity_id" validate:"omitempty,uuid"`
|
||||
}
|
||||
@@ -5,13 +5,14 @@ import "time"
|
||||
type UpdateProfileDto struct {
|
||||
DisplayName *string `json:"display_name" validate:"omitempty,min=2,max=50"`
|
||||
FullName *string `json:"full_name" validate:"omitempty,min=2,max=100"`
|
||||
AvatarUrl *string `json:"avatar_url" validate:"omitempty,url,image_url"`
|
||||
AvatarUrl *string `json:"avatar_url" validate:"omitempty,image_url"`
|
||||
Bio *string `json:"bio" validate:"omitempty,max=255"`
|
||||
Location *string `json:"location" validate:"omitempty,max=100"`
|
||||
Website *string `json:"website" validate:"omitempty,url"`
|
||||
Website *string `json:"website" validate:"omitempty,optional_url"`
|
||||
CountryCode *string `json:"country_code" validate:"omitempty,len=2"`
|
||||
Phone *string `json:"phone" validate:"omitempty,min=8,max=20"`
|
||||
}
|
||||
|
||||
type ChangePasswordDto struct {
|
||||
OldPassword string `json:"old_password" validate:"required,min=8,max=64"`
|
||||
NewPassword string `json:"new_password" validate:"required,min=8,max=64,nefield=OldPassword"`
|
||||
@@ -26,6 +27,7 @@ type PaginationDto struct {
|
||||
Limit int `json:"limit" query:"limit" validate:"omitempty,min=1,max=100"`
|
||||
Order string `json:"order" query:"order" validate:"omitempty,oneof=asc desc"`
|
||||
}
|
||||
|
||||
type SearchUserDto struct {
|
||||
PaginationDto
|
||||
Sort string `json:"sort" query:"sort" validate:"omitempty,oneof=id created_at updated_at email is_deleted auth_provider"`
|
||||
|
||||
8
internal/dtos/request/wiki.go
Normal file
8
internal/dtos/request/wiki.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package request
|
||||
|
||||
type SearchWikiDto struct {
|
||||
Cursor string `json:"cursor" query:"cursor" validate:"omitempty,uuid"`
|
||||
Limit int `json:"limit" query:"limit" validate:"omitempty,min=1,max=100"`
|
||||
Title string `json:"title" query:"title" validate:"omitempty,max=1000"`
|
||||
EntityID string `json:"entity_id" query:"entity_id" validate:"omitempty,uuid"`
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package response
|
||||
|
||||
type AuthResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
RefreshToken string `json:"refresh_token,omitempty"`
|
||||
}
|
||||
|
||||
type VerifyTokenResponse struct {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
type CommonResponse struct {
|
||||
Status bool `json:"status"`
|
||||
Data any `json:"data"`
|
||||
Errors any `json:"errors"`
|
||||
Message string `json:"message"`
|
||||
Data any `json:"data,omitempty"`
|
||||
Errors any `json:"errors,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
type JWTClaims struct {
|
||||
@@ -29,10 +29,10 @@ type PaginationMeta struct {
|
||||
|
||||
type PaginatedResponse struct {
|
||||
Status bool `json:"status"`
|
||||
Message string `json:"message"`
|
||||
Data any `json:"data"`
|
||||
Errors any `json:"errors"`
|
||||
Pagination *PaginationMeta `json:"pagination"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Data any `json:"data,omitempty"`
|
||||
Errors any `json:"errors,omitempty"`
|
||||
Pagination *PaginationMeta `json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func BuildPaginatedResponse(data any, totalRecords int64, page int, limit int) *PaginatedResponse {
|
||||
|
||||
13
internal/dtos/response/entity.go
Normal file
13
internal/dtos/response/entity.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package response
|
||||
|
||||
import "time"
|
||||
|
||||
type EntityResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
ThumbnailUrl string `json:"thumbnail_url,omitempty"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
}
|
||||
26
internal/dtos/response/geometry.go
Normal file
26
internal/dtos/response/geometry.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Bbox struct {
|
||||
MinLng float64 `json:"min_lng"`
|
||||
MinLat float64 `json:"min_lat"`
|
||||
MaxLng float64 `json:"max_lng"`
|
||||
MaxLat float64 `json:"max_lat"`
|
||||
}
|
||||
|
||||
type GeometryResponse struct {
|
||||
ID string `json:"id"`
|
||||
GeoType string `json:"geo_type"`
|
||||
DrawGeometry json.RawMessage `json:"draw_geometry"`
|
||||
Binding json.RawMessage `json:"binding,omitempty"`
|
||||
TimeStart int32 `json:"time_start,omitempty"`
|
||||
TimeEnd int32 `json:"time_end,omitempty"`
|
||||
Bbox *Bbox `json:"bbox,omitempty"`
|
||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
}
|
||||
@@ -20,8 +20,8 @@ type MediaResponse struct {
|
||||
MimeType string `json:"mime_type"`
|
||||
Size int64 `json:"size"`
|
||||
FileMetadata json.RawMessage `json:"file_metadata"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type MediaSimpleResponse struct {
|
||||
@@ -31,5 +31,5 @@ type MediaSimpleResponse struct {
|
||||
MimeType string `json:"mime_type"`
|
||||
Size int64 `json:"size"`
|
||||
FileMetadata json.RawMessage `json:"file_metadata"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ type RoleSimpleResponse struct {
|
||||
type RoleResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
@@ -5,29 +5,29 @@ import "time"
|
||||
type UserResponse struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Profile *UserProfileSimpleResponse `json:"profile"`
|
||||
TokenVersion int32 `json:"token_version"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
Roles []*RoleSimpleResponse `json:"roles"`
|
||||
Profile *UserProfileSimpleResponse `json:"profile,omitempty"`
|
||||
TokenVersion int32 `json:"token_version,omitempty"`
|
||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
Roles []*RoleSimpleResponse `json:"roles,omitempty"`
|
||||
}
|
||||
|
||||
type UserSimpleResponse struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
DisplayName string `json:"display_name"`
|
||||
FullName string `json:"full_name"`
|
||||
AvatarUrl string `json:"avatar_url"`
|
||||
DisplayName string `json:"display_name,omitempty"`
|
||||
FullName string `json:"full_name,omitempty"`
|
||||
AvatarUrl string `json:"avatar_url,omitempty"`
|
||||
}
|
||||
|
||||
type UserProfileSimpleResponse struct {
|
||||
DisplayName string `json:"display_name"`
|
||||
FullName string `json:"full_name"`
|
||||
AvatarUrl string `json:"avatar_url"`
|
||||
Bio string `json:"bio"`
|
||||
Location string `json:"location"`
|
||||
Website string `json:"website"`
|
||||
CountryCode string `json:"country_code"`
|
||||
Phone string `json:"phone"`
|
||||
FullName string `json:"full_name,omitempty"`
|
||||
AvatarUrl string `json:"avatar_url,omitempty"`
|
||||
Bio string `json:"bio,omitempty"`
|
||||
Location string `json:"location,omitempty"`
|
||||
Website string `json:"website,omitempty"`
|
||||
CountryCode string `json:"country_code,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import "time"
|
||||
|
||||
type UserVerificationResponse struct {
|
||||
ID string `json:"id"`
|
||||
User *UserSimpleResponse `json:"user"`
|
||||
User *UserSimpleResponse `json:"user,omitempty"`
|
||||
VerifyType string `json:"verify_type"`
|
||||
Content string `json:"content"`
|
||||
Status string `json:"status"`
|
||||
Reviewer *UserSimpleResponse `json:"reviewer"`
|
||||
ReviewNote string `json:"review_note"`
|
||||
ReviewedAt *time.Time `json:"reviewed_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
Medias []*MediaSimpleResponse `json:"media"`
|
||||
Reviewer *UserSimpleResponse `json:"reviewer,omitempty"`
|
||||
ReviewNote string `json:"review_note,omitempty"`
|
||||
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
Medias []*MediaSimpleResponse `json:"media,omitempty"`
|
||||
}
|
||||
|
||||
12
internal/dtos/response/wiki.go
Normal file
12
internal/dtos/response/wiki.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package response
|
||||
|
||||
import "time"
|
||||
|
||||
type WikiResponse struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user