First setup of a go server

This commit is contained in:
2026-01-23 20:05:23 +01:00
parent 6202b585e7
commit 3f11bad8f6
8 changed files with 412 additions and 0 deletions

21
models/sheet.go Normal file
View File

@@ -0,0 +1,21 @@
package models
import (
"time"
"gorm.io/gorm"
)
type MusicSheet struct {
ID uint `json:"id" gorm:"primaryKey"`
Title string `json:"title" gorm:"not null"`
Composer string `json:"composer"`
Description string `json:"description"`
FilePath string `json:"file_path" gorm:"not null"`
FileSize int64 `json:"file_size"`
UserID uint `json:"user_id"`
User User `json:"user" gorm:"foreignKey:UserID"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

17
models/user.go Normal file
View File

@@ -0,0 +1,17 @@
package models
import (
"time"
"gorm.io/gorm"
)
type User struct {
ID uint `json:"id" gorm:"primaryKey"`
Username string `json:"username" gorm:"unique;not null"`
Email string `json:"email" gorm:"unique;not null"`
Password string `json:"-" gorm:"not null"` // Don't include in JSON responses
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}