Tugas tabel

This commit is contained in:
farrel
2026-09-28 18:27:16 +07:00
parent c7e17bf89e
commit f40a0ab1fd
17 changed files with 862 additions and 35 deletions
+28
View File
@@ -0,0 +1,28 @@
package models
import (
"time"
)
// User merepresentasikan tabel users di database
type User struct {
ID string `json:"id"` // UUID, server-generated
Username string `json:"username"` // unique, case-sensitive, 3-32 chars
PasswordHash string `json:"-"` // never returned in any response
}
// Session merepresentasikan tabel sessions di database
type Session struct {
Token string `json:"token"` // server-generated, unique bearer token
UserID string `json:"user_id"` // foreign key ke users.id
CreatedAt time.Time `json:"created_at"` // informational only
}
// Snippet merepresentasikan tabel snippets di database
// UserID disimpan di DB tapi tidak di-serialize ke JSON response
type Snippet struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
UserID string `json:"-"` // internal only, not in JSON response
}