Documentation ¶
Index ¶
Constants ¶
const MicroserviceTextChatPath = "http://microservice-text-chat:9090"
const MicroserviceUserPath = "http://microservice-user:9090"
Variables ¶
var ErrorInvalidRelationshipType = fmt.Errorf("invalid RelationshipType")
ErrorInvalidRelationshipType : Invalid RelationshipType specific error
var ErrorRelationshipExist = fmt.Errorf("a relationship with these two users already exists")
ErrorRelationshipExist : Invalid Relationship specific error
var ErrorRelationshipNotFound = fmt.Errorf("Relationship not found")
ErrorRelationshipNotFound : Relationship specific errors
var ErrorSameUserID = fmt.Errorf("can't create a relationship with two users with the same userID")
ErrorSameUserID : Invalid Relationship specific error
var ErrorUserNotFound = fmt.Errorf("UserID doesn't exist")
ErrorUserNotFound : User specific errors
Functions ¶
This section is empty.
Types ¶
type DetailedRelationship ¶
type DetailedRelationship struct { ID string `json:"id" bson:"_id"` User DetailedUser `json:"user"` ConversationID string `json:"conversation_id" bson:"conversation_id"` CreatedOn string `json:"created_on" bson:"created_on"` UpdatedOn string `json:"updated_on" bson:"created_on"` }
Detailed Relationship defines the structure for an API relationship with detailed user.
type DetailedRelationships ¶
type DetailedRelationships []*DetailedRelationship
Detailed Relationships is a collection of Detailed Relationship
type DetailedUser ¶
type DetailedUser struct { ID string `json:"id" bson:"_id"` Username string `json:"username"` Status string `json:"status"` RelationshipType RelationshipType `json:"relationship_type" bson:"relationship_type"` }
Detailed User in a relationship
type Relationship ¶
type Relationship struct { ID string `json:"id" bson:"_id"` User1 User `json:"user_1" bson:"user_1"` User2 User `json:"user_2" bson:"user_2"` ConversationID string `json:"conversation_id" bson:"conversation_id"` CreatedOn string `json:"created_on" bson:"created_on"` UpdatedOn string `json:"updated_on" bson:"updated_on"` }
Relationship defines the structure for an API relationship.
func (*Relationship) ValidateRelationship ¶
func (relationship *Relationship) ValidateRelationship() error
ValidateRelationship a relationship with json validation
type RelationshipType ¶
type RelationshipType string
RelationshipType of a relationship
const ( None RelationshipType = "None" // user has no intrinsic relationship Friend RelationshipType = "Friend" // user is a friend Blocked RelationshipType = "Blocked" // user is blocked PendingIncoming RelationshipType = "PendingIncoming" // user has a pending incoming friend request to connected user PendingOutgoing RelationshipType = "PendingOutgoing" // current user has a pending outgoing friend request to user )
relationship type of a friend request
type Relationships ¶
type Relationships []*Relationship
Relationships is a collection of Relationship
type User ¶
type User struct { UserID string `json:"user_id" bson:"user_id" validate:"required"` RelationshipType RelationshipType `json:"relationship_type" bson:"relationship_type" validate:"required,isRelationshipType"` }
User in a relationship