feat: implement lab4 persistent attachments and replicated API

This commit is contained in:
Fedoroff
2026-11-11 21:45:09 +03:00
parent ec540a1a72
commit 827d9c577d
44 changed files with 3507 additions and 31 deletions
+22
View File
@@ -0,0 +1,22 @@
package model
import (
"github.com/google/uuid"
"time"
)
type Attachment struct {
ID uuid.UUID `json:"id"`
ChatID uuid.UUID `json:"chat_id"`
OwnerID uuid.UUID `json:"owner_id"`
Filename string `json:"filename"`
ContentType string `json:"content_type"`
SizeBytes int64 `json:"size_bytes"`
SHA256 string `json:"sha256"`
Status string `json:"status"`
Variants []any `json:"variants"`
ErrorCode *string `json:"error_code"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ObjectKey string `json:"-"`
}
+14
View File
@@ -0,0 +1,14 @@
package model
import (
"time"
"github.com/google/uuid"
)
type Chat struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
MemberIDs []uuid.UUID `json:"member_ids"`
CreatedAt time.Time `json:"created_at"`
}
+16
View File
@@ -0,0 +1,16 @@
package model
import (
"time"
"github.com/google/uuid"
)
type Message struct {
ID uuid.UUID `json:"id"`
ChatID uuid.UUID `json:"chat_id"`
SenderID uuid.UUID `json:"sender_id"`
Text string `json:"text"`
CreatedAt time.Time `json:"created_at"`
AttachmentIDs []uuid.UUID `json:"attachment_ids"`
}
+13
View File
@@ -0,0 +1,13 @@
package model
import (
"github.com/google/uuid"
"time"
)
type User struct {
ID uuid.UUID `json:"id"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
CreatedAt time.Time `json:"created_at"`
}