schemas

package
v0.0.0-...-6a61234 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvatarUrl

func AvatarUrl(user *ent.User) *string

func FullName

func FullName(user *ent.User) string

Types

type AcceptFriendRequestSchema

type AcceptFriendRequestSchema struct {
	Username string `json:"username" validate:"required" example:"john-doe"`
	Accepted bool   `json:"accepted" example:"true"`
}

type ChatResponseSchema

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

type ChatSchema

type ChatSchema struct {
	Edges         *ent.ChatEdges       `json:"edges,omitempty" swaggerignore:"true"`
	ID            uuid.UUID            `json:"id" example:"d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	Owner         UserDataSchema       `json:"owner"`
	Name          *string              `json:"name" example:"Correct Group"`
	Ctype         string               `json:"ctype" example:"DM"`
	Description   *string              `json:"description" example:"A nice group for tech enthusiasts"`
	LatestMessage *LatestMessageSchema `json:"latest_message"`
	Image         *string              `json:"image" example:"https://img.url"`
	CreatedAt     time.Time            `json:"created_at" example:"2024-01-14T19:00:02.613124+01:00"`
	UpdatedAt     time.Time            `json:"updated_at" example:"2024-01-14T19:00:02.613124+01:00"`
}

func (ChatSchema) Init

func (chat ChatSchema) Init() ChatSchema

type ChatsResponseDataSchema

type ChatsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []ChatSchema `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 []CitySchema `json:"data"`
}

RESPONSE SCHEMAS CITIES

func (CitiesResponseSchema) Init

type CitySchema

type CitySchema struct {
	Edges   *ent.CityEdges `json:"edges,omitempty" swaggerignore:"true"`
	ID      uuid.UUID      `json:"id" example:"d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	Name    string         `json:"name" example:"Lekki"`
	Region  *string        `json:"region" example:"Lagos"`
	Country string         `json:"country" example:"Nigeria"`
}

func (CitySchema) Init

func (city CitySchema) Init() CitySchema

type CommentInputSchema

type CommentInputSchema struct {
	Text string `json:"text" example:"Jesus is Lord"`
}

type CommentResponseSchema

type CommentResponseSchema struct {
	ResponseSchema
	Data CommentSchema `json:"data"`
}

type CommentSchema

type CommentSchema struct {
	ReplySchema
	Edges        *ent.CommentEdges `json:"edges,omitempty" swaggerignore:"true"`
	RepliesCount uint              `json:"replies_count" example:"50"`
}

func (CommentSchema) Init

func (comment CommentSchema) Init() CommentSchema

type CommentWithRepliesResponseDataSchema

type CommentWithRepliesResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []ReplySchema `json:"items"`
}

COMMENTS & REPLIES

func (CommentWithRepliesResponseDataSchema) Init

type CommentWithRepliesResponseSchema

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

type CommentWithRepliesSchema

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

type CommentsResponseDataSchema

type CommentsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []CommentSchema `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 GroupChatInputResponseDataSchema

type GroupChatInputResponseDataSchema struct {
	GroupChatSchema
	Image          *string                `json:"image,omitempty" swaggerignore:"true"` // Remove image during create & update
	FileUploadData *utils.SignatureFormat `json:"file_upload_data"`
}

func (GroupChatInputResponseDataSchema) Init

type GroupChatInputResponseSchema

type GroupChatInputResponseSchema struct {
	ResponseSchema
	Data GroupChatInputResponseDataSchema `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 GroupChatSchema

type GroupChatSchema struct {
	Edges       *ent.ChatEdges   `json:"edges,omitempty" swaggerignore:"true"`
	ID          uuid.UUID        `json:"id"`
	Name        string           `json:"name" example:"Correct Group"`
	Description *string          `json:"description" example:"Jesus is Lord"`
	Image       *string          `json:"image" example:"https://img.url"`
	Users       []UserDataSchema `json:"users"`
}

func (GroupChatSchema) Init

func (chat GroupChatSchema) Init() GroupChatSchema

type LatestMessageSchema

type LatestMessageSchema struct {
	Sender UserDataSchema `json:"sender"`
	Text   *string        `json:"text"`
	File   *string        `json:"file"`
}

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 MessageCreateResponseDataSchema

type MessageCreateResponseDataSchema struct {
	MessageSchema
	File           *string                `json:"file,omitempty" swaggerignore:"true"` // Remove image during create & update
	FileUploadData *utils.SignatureFormat `json:"file_upload_data"`
}

func (MessageCreateResponseDataSchema) Init

type MessageCreateResponseSchema

type MessageCreateResponseSchema struct {
	ResponseSchema
	Data MessageCreateResponseDataSchema `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 MessageSchema

type MessageSchema struct {
	Edges     *ent.MessageEdges `json:"edges,omitempty" swaggerignore:"true"`
	ID        uuid.UUID         `json:"id"`
	ChatID    uuid.UUID         `json:"chat_id"`
	Sender    UserDataSchema    `json:"sender"`
	Text      *string           `json:"text" example:"Jesus is Lord"`
	File      *string           `json:"file" example:"https://img.url"`
	CreatedAt time.Time         `json:"created_at" example:"2024-01-14T19:00:02.613124+01:00"`
	UpdatedAt time.Time         `json:"updated_at" example:"2024-01-14T19:00:02.613124+01:00"`
}

func (MessageSchema) Init

func (message MessageSchema) Init() MessageSchema

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 []MessageSchema `json:"items"`
}

func (MessagesResponseDataSchema) Init

type MessagesSchema

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

func (MessagesSchema) Init

func (data MessagesSchema) Init() MessagesSchema

type NotificationSchema

type NotificationSchema struct {
	Edges       *ent.NotificationEdges `json:"edges,omitempty" swaggerignore:"true"`
	ID          uuid.UUID              `json:"id"`
	Sender      *UserDataSchema        `json:"sender"`
	Ntype       string                 `json:"ntype" example:"REACTION"`
	Text        *string                `json:"text,omitempty" swaggerignore:"true"`
	Message     string                 `json:"message" example:"John Doe reacted to your post"`
	PostSlug    *string                `json:"post_slug" example:"john-doe-d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	CommentSlug *string                `json:"comment_slug" example:"john-doe-d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	ReplySlug   *string                `json:"reply_slug" example:"john-doe-d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	IsRead      bool                   `json:"is_read" example:"true"`
}

func (NotificationSchema) GetMessage

func (notification NotificationSchema) GetMessage() string

func (NotificationSchema) Init

func (notification NotificationSchema) Init(currentUserID *uuid.UUID) NotificationSchema

func (NotificationSchema) SetTargetSlug

func (notification NotificationSchema) SetTargetSlug() NotificationSchema

type NotificationsResponseDataSchema

type NotificationsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []NotificationSchema `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 PostInputResponseDataSchema

type PostInputResponseDataSchema struct {
	PostSchema
	Image          *string                `json:"image,omitempty" swaggerignore:"true"` // Remove image during create & update
	FileUploadData *utils.SignatureFormat `json:"file_upload_data"`
}

func (PostInputResponseDataSchema) Init

type PostInputResponseSchema

type PostInputResponseSchema struct {
	ResponseSchema
	Data PostInputResponseDataSchema `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 PostSchema `json:"data"`
}

type PostSchema

type PostSchema struct {
	Edges          *ent.PostEdges `json:"edges,omitempty" swaggerignore:"true"`
	Author         UserDataSchema `json:"author"`
	Text           string         `json:"text" example:"God Is Good"`
	Slug           string         `json:"slug" example:"john-doe-d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	ReactionsCount uint           `json:"reactions_count" example:"200"`
	CommentsCount  uint           `json:"comments_count" example:"35"`
	Image          *string        `json:"image" example:"https://img.url"`
	CreatedAt      time.Time      `json:"created_at" example:"2024-01-14T19:00:02.613124+01:00"`
	UpdatedAt      time.Time      `json:"updated_at" example:"2024-01-14T19:00:02.613124+01:00"`
}

func (PostSchema) Init

func (post PostSchema) Init() PostSchema

type PostsResponseDataSchema

type PostsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []PostSchema `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 ProfileSchema `json:"data"`
}

type ProfileSchema

type ProfileSchema struct {
	Edges     *ent.UserEdges `json:"edges,omitempty" swaggerignore:"true"`
	FirstName string         `json:"first_name" example:"John"`
	LastName  string         `json:"last_name" example:"Doe"`
	Username  string         `json:"username" example:"john-doe"`
	Email     string         `json:"email" example:"johndoe@email.com"`
	Avatar    *string        `json:"avatar" example:"https://img.com"`
	Bio       *string        `json:"bio" example:"Software Engineer | Go Fiber Developer"`
	Dob       *time.Time     `json:"dob"`
	City      *string        `json:"city" example:"Lekki"`
	CreatedAt *time.Time     `json:"created_at"`
	UpdatedAt *time.Time     `json:"updated_at"`
}

func (ProfileSchema) Init

func (user ProfileSchema) Init() ProfileSchema

type ProfileUpdateResponseDataSchema

type ProfileUpdateResponseDataSchema struct {
	ProfileSchema
	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"`
	City      *ent.City  `json:"-"`
}

type ProfilesResponseDataSchema

type ProfilesResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []ProfileSchema `json:"users"`
}

USERS

func (ProfilesResponseDataSchema) Init

type ProfilesResponseSchema

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

type ReactionInputSchema

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

type ReactionResponseSchema

type ReactionResponseSchema struct {
	ResponseSchema
	Data ReactionSchema `json:"data"`
}

type ReactionSchema

type ReactionSchema struct {
	Edges *ent.ReactionEdges `json:"edges,omitempty" swaggerignore:"true"`
	ID    uuid.UUID          `json:"id" example:"d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	User  UserDataSchema     `json:"user"`
	Rtype string             `json:"rtype" example:"LIKE"`
}

REACTION SCHEMA

func (ReactionSchema) Init

func (reaction ReactionSchema) Init() ReactionSchema

type ReactionsResponseDataSchema

type ReactionsResponseDataSchema struct {
	PaginatedResponseDataSchema
	Items []ReactionSchema `json:"reactions"`
}

REACTIONS

func (ReactionsResponseDataSchema) Init

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 ReplySchema `json:"data"`
}

type ReplySchema

type ReplySchema struct {
	Edges          *ent.ReplyEdges `json:"edges,omitempty" swaggerignore:"true"`
	Author         UserDataSchema  `json:"author"`
	Slug           string          `json:"slug" example:"john-doe-d10dde64-a242-4ed0-bd75-4c759644b3a6"`
	Text           string          `json:"text" example:"Jesus Is King"`
	ReactionsCount uint            `json:"reactions_count" example:"200"`
}

COMMENTS & REPLIES SCHEMA

func (ReplySchema) Init

func (reply ReplySchema) Init() ReplySchema

type ResponseSchema

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

func (ResponseSchema) Init

func (obj ResponseSchema) Init() ResponseSchema

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 SiteDetail

type SiteDetail struct {
	Name    string `json:"name" example:"SocialNet"`
	Email   string `json:"email" example:"johndoe@email.com"`
	Phone   string `json:"phone" example:"+2348133831036"`
	Address string `json:"address" example:"234, Lagos, Nigeria"`
	Fb      string `json:"fb" example:"https://facebook.com"`
	Tw      string `json:"tw" example:"https://twitter.com"`
	Wh      string `json:"wh" example:"https://wa.me/2348133831036"`
	Ig      string `json:"ig" example:"https://instagram.com"`
}

type SiteDetailResponseSchema

type SiteDetailResponseSchema struct {
	ResponseSchema
	Data 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 []*ent.User) []*UserDataSchema

func (UserDataSchema) Init

func (user UserDataSchema) Init(userObj *ent.User) UserDataSchema

type VerifyEmailRequestSchema

type VerifyEmailRequestSchema struct {
	Email string `json:"email" validate:"required,min=5,email" example:"johndoe@example.com"`
	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