This commit is contained in:
2025-11-02 01:25:30 +01:00
commit ed18be9fbd
17 changed files with 598 additions and 0 deletions

28
models/message.go Normal file
View File

@@ -0,0 +1,28 @@
package models
import (
"time"
"github.com/google/uuid"
)
// #[derive(Debug, Clone, FromRow, Serialize, Deserialize)]
//pub struct Message {
// pub id: Uuid,
// pub channel_id: Uuid,
// pub user_id: Uuid,
// pub content: String,
// pub created_at: DateTime<Utc>,
// pub edited_at: DateTime<Utc>,
// pub reply_to_id: Option<Uuid>,
//}
type Message struct {
ID uuid.UUID `gorm:"primaryKey" json:"id"`
ChannelID uuid.UUID `gorm:"index" json:"channel_id"`
UserID uuid.UUID `gorm:"index" json:"user_id"`
Content string `gorm:"not null" json:"content"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
EditedAt *time.Time `gorm:"default:null" json:"edited_at,omitempty"`
ReplyToID *uuid.UUID `gorm:"index" json:"reply_to_id,omitempty"`
}