feat(db): add attachment content type and status enums

This commit is contained in:
kk10
2026-11-02 21:50:29 +03:00
parent 983bbaa55e
commit 42ddd2cad9
5 changed files with 108 additions and 15 deletions
+7 -7
View File
@@ -30,10 +30,10 @@ SELECT
$3::uuid,
$4::text,
$5::text,
$6::text,
$6::attachment_content_type,
$7::int,
$8::text,
$9::text,
$9::attachment_status,
$10::text
WHERE EXISTS (
SELECT 1 FROM chat_members
@@ -49,10 +49,10 @@ type CreateAttachmentParams struct {
OwnerID uuid.UUID
S3Key string
Filename string
ContentType string
ContentType AttachmentContentType
SizeBytes int
Sha256 string
Status string
Status AttachmentStatus
ErrorCode string
}
@@ -147,15 +147,15 @@ type ListAttachmentsByIDsParams struct {
Ids []uuid.UUID
}
func (q *Queries) ListAttachmentsByIDs(ctx context.Context, arg ListAttachmentsByIDsParams) ([]string, error) {
func (q *Queries) ListAttachmentsByIDs(ctx context.Context, arg ListAttachmentsByIDsParams) ([]AttachmentStatus, error) {
rows, err := q.db.Query(ctx, listAttachmentsByIDs, arg.ChatID, arg.Ids)
if err != nil {
return nil, err
}
defer rows.Close()
items := []string{}
items := []AttachmentStatus{}
for rows.Next() {
var status string
var status AttachmentStatus
if err := rows.Scan(&status); err != nil {
return nil, err
}