Skip to content

Commit 072be0c

Browse files
Added Attachment to Message entity
1 parent 82c8102 commit 072be0c

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

api/pkg/entities/message.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,23 @@ func (s SIM) String() string {
8181
return string(s)
8282
}
8383

84+
type MessageAttachment struct {
85+
ContentType string `json:"content_type" example:"image/jpeg"`
86+
URL string `json:"url" example:"https://example.com/image.jpg"`
87+
}
88+
8489
// Message represents a message sent between 2 phone numbers
8590
type Message struct {
86-
ID uuid.UUID `json:"id" gorm:"primaryKey;type:uuid;" example:"32343a19-da5e-4b1b-a767-3298a73703cb"`
87-
RequestID *string `json:"request_id" example:"153554b5-ae44-44a0-8f4f-7bbac5657ad4" validate:"optional"`
88-
Owner string `json:"owner" example:"+18005550199"`
89-
UserID UserID `json:"user_id" gorm:"index:idx_messages__user_id" example:"WB7DRDWrJZRGbYrv2CKGkqbzvqdC"`
90-
Contact string `json:"contact" example:"+18005550100"`
91-
Content string `json:"content" example:"This is a sample text message"`
92-
Encrypted bool `json:"encrypted" example:"false" gorm:"default:false"`
93-
Type MessageType `json:"type" example:"mobile-terminated"`
94-
Status MessageStatus `json:"status" example:"pending"`
91+
ID uuid.UUID `json:"id" gorm:"primaryKey;type:uuid;" example:"32343a19-da5e-4b1b-a767-3298a73703cb"`
92+
RequestID *string `json:"request_id" example:"153554b5-ae44-44a0-8f4f-7bbac5657ad4" validate:"optional"`
93+
Owner string `json:"owner" example:"+18005550199"`
94+
UserID UserID `json:"user_id" gorm:"index:idx_messages__user_id" example:"WB7DRDWrJZRGbYrv2CKGkqbzvqdC"`
95+
Contact string `json:"contact" example:"+18005550100"`
96+
Content string `json:"content" example:"This is a sample text message"`
97+
Attachments []MessageAttachment `json:"attachments,omitempty" gorm:"type:json;serializer:json"`
98+
Encrypted bool `json:"encrypted" example:"false" gorm:"default:false"`
99+
Type MessageType `json:"type" example:"mobile-terminated"`
100+
Status MessageStatus `json:"status" example:"pending"`
95101
// SIM is the SIM card to use to send the message
96102
// * SMS1: use the SIM card in slot 1
97103
// * SMS2: use the SIM card in slot 2

0 commit comments

Comments
 (0)