Deploy with Docker Compose / deploy (push) Successful in 58s
Admins can flag a chat message as private so only other admin connections receive it, and can delete any message. Admin status is read from the auth cookies on the WebSocket upgrade request. Co-Authored-By: Claude Fable 5.1 <[email protected]>
129 lines
4.7 KiB
Go
129 lines
4.7 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Username string `gorm:"uniqueIndex" json:"username"`
|
|
Password []byte `json:"-"`
|
|
Admin bool `json:"admin"`
|
|
}
|
|
|
|
type Post struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Title string `gorm:"not null" json:"title"`
|
|
AuthorID uint `json:"-"`
|
|
Author *User `gorm:"foreignKey:AuthorID" json:"author"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
type Message struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
Content string `json:"text"`
|
|
AuthorID uint `json:"authorId"`
|
|
FileURL string `json:"fileUrl,omitempty"`
|
|
Private bool `gorm:"not null;default:false" json:"private"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
}
|
|
|
|
type Activity struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
Link *string `json:"link"`
|
|
}
|
|
|
|
type Favorite struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
Link *string `json:"link"`
|
|
}
|
|
|
|
type Rowing struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Date time.Time `json:"date"`
|
|
Time uint64 `json:"time"`
|
|
Distance uint64 `json:"distance"`
|
|
TimePer500m float64 `json:"timePer500m"`
|
|
Calories float64 `json:"calories"`
|
|
}
|
|
|
|
type Bookmark struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Category string `gorm:"not null" json:"category"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
Link string `gorm:"not null" json:"link"`
|
|
}
|
|
|
|
type JobAppReference struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Category string `gorm:"not null" json:"category"`
|
|
Label string `gorm:"not null" json:"label"`
|
|
Value string `gorm:"not null" json:"value"`
|
|
SortOrder int `gorm:"default:0" json:"sortOrder"`
|
|
}
|
|
|
|
type ProcessedEmail struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
GraphMessageID string `gorm:"uniqueIndex;not null" json:"graphMessageId"`
|
|
Subject string `gorm:"not null" json:"subject"`
|
|
Action string `gorm:"not null" json:"action"`
|
|
JobAppID *uint `json:"jobAppId"`
|
|
}
|
|
|
|
type Place struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
Title string `gorm:"not null" json:"title"`
|
|
Location *string `json:"location"`
|
|
Notes *string `json:"notes"`
|
|
ImageURL *string `json:"imageUrl"`
|
|
Category *string `json:"category"`
|
|
Cost *string `json:"cost"`
|
|
Priority int `gorm:"default:0" json:"priority"`
|
|
Done bool `gorm:"default:false" json:"done"`
|
|
}
|
|
|
|
type JobApplication struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
|
|
JobTitle string `gorm:"not null" json:"jobTitle"`
|
|
Company string `gorm:"not null" json:"company"`
|
|
Location *string `json:"location"`
|
|
URL *string `json:"url"`
|
|
Status string `gorm:"not null" json:"status"`
|
|
Notes *string `json:"notes"`
|
|
AppliedAt *time.Time `json:"appliedAt"`
|
|
}
|