test-repo/internal/app/models/models.go
2026-01-31 16:50:50 +03:00

32 lines
544 B
Go

package models
import "gorm.io/gorm"
type RevokedToken struct {
ID uint `gorm:"primaryKey"`
Token string `gorm:"unique"`
}
type User struct {
ID uint `gorm:"primaryKey"`
Username string `gorm:"unique"`
Password string
IsAdmin bool `gorm:"default:false"`
}
type Product struct {
ID uint `gorm:"primaryKey"`
Name string
Description string
Price float64
}
type Purchase struct {
gorm.Model
UserID uint
ProductID uint
Product Product `gorm:"foreignKey:ProductID"`
}
var _ = gorm.Model{}