You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
feat: add GORM integration with repository pattern
- Add GORM models in models/ directory with proper column tags - Create repository interfaces and implementations in core/repository/ - Add database package with MySQL and SQLite support - Add UUID ID utility for GORM models - Implement complete repository layer replacing SQL-based data access - Add database migrations and index creation - Support both MySQL and SQLite drivers with auto-migration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
21
models/user.go
Normal file
21
models/user.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package models
|
||||
|
||||
// User represents a user account
|
||||
type User struct {
|
||||
ID []byte `gorm:"type:BINARY(16);primaryKey"`
|
||||
Inserted uint64 `gorm:"column:inserted;not null"`
|
||||
Updated uint64 `gorm:"column:updated;not null"`
|
||||
FirstName string `gorm:"column:firstName;size:50;not null"`
|
||||
LastName string `gorm:"column:lastName;size:50;not null"`
|
||||
Email string `gorm:"column:email;size:100;not null;unique"`
|
||||
PasswordHash string `gorm:"column:passwordHash;size:100;not null"`
|
||||
AgreeToTerms bool `gorm:"column:agreeToTerms;not null"`
|
||||
PasswordReset string `gorm:"column:passwordReset;size:32;not null"`
|
||||
EmailVerified bool `gorm:"column:emailVerified;not null"`
|
||||
EmailVerifyCode string `gorm:"column:emailVerifyCode;size:32;not null"`
|
||||
SignupSource string `gorm:"column:signupSource;size:100;not null"`
|
||||
|
||||
UserOrgs []UserOrg `gorm:"foreignKey:UserID"`
|
||||
Sessions []Session `gorm:"foreignKey:UserID"`
|
||||
APIKeys []APIKey `gorm:"foreignKey:UserID"`
|
||||
}
|
||||
Reference in New Issue
Block a user