forked from mtusi2026/mtusi2026lab4
feat(db): add attachment content type and status enums
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user