schemas

package
v0.0.0-...-48bfdbc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptFriendRequestSchema

type AcceptFriendRequestSchema struct {
	SendFriendRequestSchema
	Accepted bool `json:"accepted" example:"true"`
}

type ChatResponseSchema

type ChatResponseSchema struct {
	ResponseSchema
	Data MessagesSchema `json:"data"`
}

type ChatsResponseDataSchema

type ChatsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Chat `json:"chats"`
}

RESPONSE SCHEMAS CHATS

func (ChatsResponseDataSchema) Init

type ChatsResponseSchema

type ChatsResponseSchema struct {
	ResponseSchema
	Data ChatsResponseDataSchema `json:"data"`
}

type CitiesResponseSchema

type CitiesResponseSchema struct {
	ResponseSchema
	Data []models.City `json:"data"`
}

RESPONSE SCHEMAS CITIES

func (CitiesResponseSchema) Init

type CommentInputSchema

type CommentInputSchema struct {
	Text string `json:"text" example:"Jesus is Lord"`
}
func (reply ReplySchema) Init() ReplySchema {
	// Set Related Data.
	reply.Author = reply.Author.Init(reply.Edges.Author)
	reply.ReactionsCount = uint(len(reply.Edges.Reactions))
	reply.Edges = nil // Omit edges
	return reply
}

type CommentResponseSchema

type CommentResponseSchema struct {
	ResponseSchema
	Data models.Comment `json:"data"`
}

type CommentWithRepliesResponseDataSchema

type CommentWithRepliesResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Reply `json:"items"`
}

COMMENTS & REPLIES

func (CommentWithRepliesResponseDataSchema) Init

type CommentWithRepliesResponseSchema

type CommentWithRepliesResponseSchema struct {
	ResponseSchema
	Data CommentWithRepliesSchema `json:"data"`
}

type CommentWithRepliesSchema

type CommentWithRepliesSchema struct {
	Comment models.Comment                       `json:"comment"`
	Replies CommentWithRepliesResponseDataSchema `json:"replies"`
}

type CommentsResponseDataSchema

type CommentsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Comment `json:"comments"`
}

func (CommentsResponseDataSchema) Init

type CommentsResponseSchema

type CommentsResponseSchema struct {
	ResponseSchema
	Data CommentsResponseDataSchema `json:"data"`
}

type DeleteUserSchema

type DeleteUserSchema struct {
	Password string `json:"password" validate:"required" example:"password"`
}

type EmailRequestSchema

type EmailRequestSchema struct {
	Email string `json:"email" validate:"required,min=5,email" example:"johndoe@email.com"`
}

type GroupChatCreateSchema

type GroupChatCreateSchema struct {
	Name           string   `json:"name" validate:"required,max=100" example:"Dopest Group"`
	Description    *string  `json:"description" validate:"omitempty,max=1000" example:"This is a group for bosses."`
	UsernamesToAdd []string `json:"usernames_to_add" validate:"required,min=1,max=99" example:"john-doe"`
	FileType       *string  `json:"file_type" validate:"omitempty,file_type_validator" example:"image/jpeg"`
}

type GroupChatInputResponseSchema

type GroupChatInputResponseSchema struct {
	ResponseSchema
	Data models.Chat `json:"data"`
}

type GroupChatInputSchema

type GroupChatInputSchema struct {
	Name              *string   `json:"name" validate:"omitempty,max=100" example:"Dopest Group"`
	Description       *string   `json:"description" validate:"omitempty,max=1000" example:"This is a group for bosses."`
	UsernamesToAdd    *[]string `json:"usernames_to_add" validate:"omitempty,min=1,max=99" example:"john-doe"`
	UsernamesToRemove *[]string `json:"usernames_to_remove" validate:"omitempty,min=1,max=99,usernames_to_update_validator" example:"john-doe"`
	FileType          *string   `json:"file_type" validate:"omitempty,file_type_validator" example:"image/jpeg"`
}

type LoginResponseSchema

type LoginResponseSchema struct {
	ResponseSchema
	Data TokensResponseSchema `json:"data"`
}

type LoginSchema

type LoginSchema struct {
	Email    string `json:"email" validate:"required,email" example:"johndoe@email.com"`
	Password string `json:"password" validate:"required" example:"password"`
}

type MessageCreateResponseSchema

type MessageCreateResponseSchema struct {
	ResponseSchema
	Data models.Message `json:"data"`
}

type MessageCreateSchema

type MessageCreateSchema struct {
	ChatID   *uuid.UUID `json:"chat_id" validate:"omitempty" example:"d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	Username *string    `json:"username,omitempty" validate:"required_without=ChatID" example:"john-doe"`
	Text     *string    `json:"text" validate:"required_without=FileType" example:"I am not in danger skyler, I am the danger"`
	FileType *string    `json:"file_type" validate:"omitempty,file_type_validator" example:"image/jpeg"`
}

type MessageUpdateSchema

type MessageUpdateSchema struct {
	Text     *string `json:"text" validate:"required_without=FileType" example:"The Earth is the Lord's and the fullness thereof"`
	FileType *string `json:"file_type" validate:"omitempty,file_type_validator" example:"image/jpeg"`
}

type MessagesResponseDataSchema

type MessagesResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Message `json:"items"`
}

func (MessagesResponseDataSchema) Init

type MessagesSchema

type MessagesSchema struct {
	Chat     models.Chat                `json:"chat"`
	Messages MessagesResponseDataSchema `json:"messages"`
	Users    []models.UserDataSchema    `json:"users"`
}

func (MessagesSchema) Init

func (data MessagesSchema) Init() MessagesSchema

type NotificationsResponseDataSchema

type NotificationsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Notification `json:"notifications"`
}

NOTIFICATIONS

func (NotificationsResponseDataSchema) Init

type NotificationsResponseSchema

type NotificationsResponseSchema struct {
	ResponseSchema
	Data NotificationsResponseDataSchema `json:"data"`
}

type PaginatedResponseDataSchema

type PaginatedResponseDataSchema struct {
	PerPage     uint `json:"per_page" example:"100"`
	CurrentPage uint `json:"current_page" example:"1"`
	LastPage    uint `json:"last_page" example:"100"`
}

type PostInputResponseSchema

type PostInputResponseSchema struct {
	ResponseSchema
	Data models.Post `json:"data"`
}

type PostInputSchema

type PostInputSchema struct {
	Text     string  `json:"text" validate:"required" example:"God is good"`
	FileType *string `json:"file_type" example:"image/jpeg" validate:"omitempty,file_type_validator"`
}

type PostResponseSchema

type PostResponseSchema struct {
	ResponseSchema
	Data models.Post `json:"data"`
}

type PostsResponseDataSchema

type PostsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Post `json:"posts"`
}

RESPONSE SCHEMAS POSTS

func (PostsResponseDataSchema) Init

type PostsResponseSchema

type PostsResponseSchema struct {
	ResponseSchema
	Data PostsResponseDataSchema `json:"data"`
}

type ProfileResponseSchema

type ProfileResponseSchema struct {
	ResponseSchema
	Data models.User `json:"data"`
}

type ProfileUpdateResponseDataSchema

type ProfileUpdateResponseDataSchema struct {
	models.User
	FileUploadData *utils.SignatureFormat `json:"file_upload_data"`
}

func (ProfileUpdateResponseDataSchema) Init

type ProfileUpdateResponseSchema

type ProfileUpdateResponseSchema struct {
	ResponseSchema
	Data ProfileUpdateResponseDataSchema `json:"data"`
}

type ProfileUpdateSchema

type ProfileUpdateSchema struct {
	FirstName *string    `json:"first_name" validate:"omitempty,max=50,min=1" example:"John"`
	LastName  *string    `json:"last_name" validate:"omitempty,max=50,min=1" example:"Doe"`
	Bio       *string    `json:"bio" validate:"omitempty,max=200" example:"Software Engineer | Go Fiber Developer"`
	Dob       *time.Time `json:"dob" validate:"omitempty" example:"2001-01-16T00:00:00.106416+01:00"`
	CityID    *uuid.UUID `json:"city_id" validate:"omitempty" example:"d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	FileType  *string    `json:"file_type" example:"image/jpeg" validate:"omitempty,file_type_validator"`
}

func (ProfileUpdateSchema) SetValues

func (p ProfileUpdateSchema) SetValues(user *models.User) *models.User

type ProfilesResponseDataSchema

type ProfilesResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.User `json:"users"`
}

USERS

func (ProfilesResponseDataSchema) Init

type ProfilesResponseSchema

type ProfilesResponseSchema struct {
	ResponseSchema
	Data ProfilesResponseDataSchema `json:"data"`
}

type ReactionInputSchema

type ReactionInputSchema struct {
	Rtype choices.ReactionChoice `json:"rtype" validate:"required,reaction_type_validator" example:"LIKE"`
}

// REACTION SCHEMA

type ReactionResponseSchema

type ReactionResponseSchema struct {
	ResponseSchema
	Data models.Reaction `json:"data"`
}

type ReactionsResponseDataSchema

type ReactionsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []models.Reaction `json:"reactions"`
}

REACTIONS

type ReactionsResponseSchema

type ReactionsResponseSchema struct {
	ResponseSchema
	Data ReactionsResponseDataSchema `json:"data"`
}

type ReadNotificationSchema

type ReadNotificationSchema struct {
	MarkAllAsRead bool       `json:"mark_all_as_read" example:"false"`
	ID            *uuid.UUID `json:"id" validate:"required_if=MarkAllAsRead false,omitempty" example:"d10dde64-a242-4ed0-bd75-4c759644b3a6"`
}

type RefreshTokenSchema

type RefreshTokenSchema struct {
	Refresh string `` /* 172-byte string literal not displayed */
}

type RegisterResponseSchema

type RegisterResponseSchema struct {
	ResponseSchema
	Data EmailRequestSchema `json:"data"`
}

RESPONSE BODY SCHEMAS

type RegisterUser

type RegisterUser struct {
	FirstName      string `json:"first_name" validate:"required,max=50" example:"John"`
	LastName       string `json:"last_name" validate:"required,max=50" example:"Doe"`
	Email          string `json:"email" validate:"required,min=5,email" example:"johndoe@email.com"`
	Password       string `json:"password" validate:"required,min=8,max=50" example:"strongpassword"`
	TermsAgreement bool   `json:"terms_agreement" validate:"eq=true"`
}

REQUEST BODY SCHEMAS

type ReplyResponseSchema

type ReplyResponseSchema struct {
	ResponseSchema
	Data models.Reply `json:"data"`
}

type ResponseSchema

type ResponseSchema struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"Data fetched/created/updated/deleted"`
}

type SendFriendRequestSchema

type SendFriendRequestSchema struct {
	Username string `json:"username" validate:"required" example:"john-doe"`
}

type SetNewPasswordSchema

type SetNewPasswordSchema struct {
	VerifyEmailRequestSchema
	Password string `json:"password" validate:"required,min=8,max=50" example:"newstrongpassword"`
}

type SiteDetailResponseSchema

type SiteDetailResponseSchema struct {
	ResponseSchema
	Data models.SiteDetail `json:"data"`
}

type TokensResponseSchema

type TokensResponseSchema struct {
	Access  string `json:"access"`
	Refresh string `json:"refresh"`
}

type UserDataSchema

type UserDataSchema struct {
	Name     string  `json:"name" example:"John Doe"`
	Username string  `json:"username" example:"john-doe"`
	Avatar   *string `json:"avatar" example:"https://img.url"`
}

func ConvertUsers

func ConvertUsers(users []models.User) []UserDataSchema

func (UserDataSchema) Init

func (user UserDataSchema) Init(userObj models.User) UserDataSchema

type VerifyEmailRequestSchema

type VerifyEmailRequestSchema struct {
	EmailRequestSchema
	Otp uint32 `json:"otp" validate:"required" example:"123456"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL