From e48854c55b303339f6fe77be2a16544904122ac8 Mon Sep 17 00:00:00 2001 From: lbenedar Date: Tue, 7 Apr 2026 13:54:45 +0300 Subject: [PATCH] add db get queries --- db/migrations/000002_create_modules.up.sql | 8 +- db/migrations/000005_create_users.up.sql | 2 +- internal/foundry/models/db/errors.go | 1 + internal/foundry/models/db/foundry_state.go | 127 +++++++++++++++- internal/foundry/models/db/module.go | 152 ++++++++++++++++++- internal/foundry/models/db/system.go | 96 +++++++++++- internal/foundry/models/db/user.go | 159 +++++++++++++++++++- internal/foundry/models/db/world.go | 99 +++++++++++- internal/foundry/models/json/data.go | 4 + internal/foundry/models/json/users.go | 4 - 10 files changed, 623 insertions(+), 29 deletions(-) diff --git a/db/migrations/000002_create_modules.up.sql b/db/migrations/000002_create_modules.up.sql index aab5a74..008b8bd 100644 --- a/db/migrations/000002_create_modules.up.sql +++ b/db/migrations/000002_create_modules.up.sql @@ -13,20 +13,20 @@ CREATE TABLE IF NOT EXISTS modules ( CREATE TABLE IF NOT EXISTS modules_compatibility ( id INTEGER PRIMARY KEY AUTOINCREMENT, - model_id INTEGER UNIQUE, + module_id INTEGER UNIQUE, minimum VARCHAR(64) NOT NULL, verified VARCHAR(64) NOT NULL, maximum VARCHAR(64) NOT NULL, - FOREIGN KEY (model_id) REFERENCES modules(id) ON DELETE CASCADE + FOREIGN KEY (module_id) REFERENCES modules(id) ON DELETE CASCADE ); CREATE TABLE IF NOT EXISTS modules_languages ( id INTEGER PRIMARY KEY AUTOINCREMENT, - model_id INTEGER, + module_id INTEGER, language VARCHAR(256) NOT NULL, name VARCHAR(256) NOT NULL, path VARCHAR(256) NOT NULL, - FOREIGN KEY (model_id) REFERENCES modules(id) ON DELETE CASCADE + FOREIGN KEY (module_id) REFERENCES modules(id) ON DELETE CASCADE ); \ No newline at end of file diff --git a/db/migrations/000005_create_users.up.sql b/db/migrations/000005_create_users.up.sql index 350e377..84cb8c2 100644 --- a/db/migrations/000005_create_users.up.sql +++ b/db/migrations/000005_create_users.up.sql @@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS users_hotbar ( CREATE TABLE IF NOT EXISTS users_stats ( id INTEGER PRIMARY KEY AUTOINCREMENT, - user_id INTEGER, + user_id INTEGER UNIQUE, core_version TEXT NOT NULL, system_id VARCHAR(64) NOT NULL, system_version VARCHAR(64) NOT NULL, diff --git a/internal/foundry/models/db/errors.go b/internal/foundry/models/db/errors.go index aea69d7..b34a2d3 100644 --- a/internal/foundry/models/db/errors.go +++ b/internal/foundry/models/db/errors.go @@ -5,4 +5,5 @@ import "errors" var ( ErrorSetupMoreThanOne = errors.New("Passed more than one setupData") ErrorSetupNotFound = errors.New("Not found setup data from your request") + ErrorRecordNotFound = errors.New("Record not found") ) diff --git a/internal/foundry/models/db/foundry_state.go b/internal/foundry/models/db/foundry_state.go index 6d047b3..1109071 100644 --- a/internal/foundry/models/db/foundry_state.go +++ b/internal/foundry/models/db/foundry_state.go @@ -3,6 +3,7 @@ package db import ( "context" "database/sql" + "errors" "time" ) @@ -18,7 +19,7 @@ const ( ) type FoundryState struct { - Id int + Id int64 IsAdmin bool IsSetup bool Type StateType @@ -31,14 +32,14 @@ type FoundryState struct { } type Compatibility struct { - Id int + Id int64 Minimum string Verified string Maximum string } type Options struct { - Id int + Id int64 Language string } @@ -98,7 +99,7 @@ func (m FoundryStateModel) Insert(state *FoundryState) error { return nil } -func (m FoundryStateModel) InsertOptions(options *Options, stateId int) error { +func (m FoundryStateModel) InsertOptions(options *Options, stateId int64) error { query := ` INSERT INTO options (state_id, lang) VALUES ($1, $2) @@ -111,3 +112,121 @@ func (m FoundryStateModel) InsertOptions(options *Options, stateId int) error { return m.DB.QueryRowContext(ctx, query, args...).Scan(&options.Id) } + +func (m FoundryStateModel) Get(id int64) (*FoundryState, error) { + if id < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, created_at, is_admin, is_setup, state_type + FROM foundry_state + WHERE id = $1` + + var state FoundryState + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + err := m.DB.QueryRowContext(ctx, query, id).Scan( + &state.Id, + &state.CreatedAt, + &state.IsAdmin, + &state.IsSetup, + &state.Type, + ) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + state.Modules, err = m.GetModules(state.Id) + if err != nil { + return nil, err + } + state.Systems, err = m.GetSystems(state.Id) + if err != nil { + return nil, err + } + state.Worlds, err = m.GetWorlds(state.Id) + if err != nil { + return nil, err + } + state.Users, err = m.GetUsers(state.Id) + if err != nil { + return nil, err + } + + options, err := m.GetOptions(state.Id) + if err != nil { + return nil, err + } + state.Options = *options + + return &state, nil +} + +func (m FoundryStateModel) GetOptions(idState int64) (*Options, error) { + if idState < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, lang + FROM options + WHERE state_id = $1` + + var options Options + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + err := m.DB.QueryRowContext(ctx, query, idState).Scan( + &options.Id, + &options.Language, + ) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + return &options, nil +} + +func (m FoundryStateModel) GetIdByType(stateType StateType) (int64, error) { + if stateType < 0 { + return -1, ErrorRecordNotFound + } + + query := ` + SELECT id + FROM foundry_state + WHERE state_type = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + var id int64 + + err := m.DB.QueryRowContext(ctx, query, stateType).Scan(&id) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return -1, ErrorRecordNotFound + default: + return -1, err + } + } + + return id, nil +} diff --git a/internal/foundry/models/db/module.go b/internal/foundry/models/db/module.go index adfe618..f3055cf 100644 --- a/internal/foundry/models/db/module.go +++ b/internal/foundry/models/db/module.go @@ -2,11 +2,13 @@ package db import ( "context" + "database/sql" + "errors" "time" ) type Module struct { - Id int + Id int64 TextId string Title string Description string @@ -19,7 +21,7 @@ type Module struct { } type Language struct { - Id string + Id int64 Lang string Name string Path string @@ -31,7 +33,7 @@ func (modules Modules) GetById(id int) *Module { return &modules[id] } -func (m FoundryStateModel) InsertModule(module *Module, stateId int) error { +func (m FoundryStateModel) InsertModule(module *Module, stateId int64) error { query := ` INSERT INTO modules (state_id, text_id, title, description, url, version, availability) VALUES ($1, $2, $3, $4, $5, $6, $7) @@ -55,7 +57,7 @@ func (m FoundryStateModel) InsertModule(module *Module, stateId int) error { return m.InsertModuleCompatibility(&module.Compatibility, module.Id) } -func (m FoundryStateModel) InsertModuleCompatibility(compatibility *Compatibility, moduleId int) error { +func (m FoundryStateModel) InsertModuleCompatibility(compatibility *Compatibility, moduleId int64) error { query := ` INSERT INTO modules_compatibility (model_id, minumum, verified, maximum) VALUES ($1, $2, $3, $4) @@ -69,7 +71,7 @@ func (m FoundryStateModel) InsertModuleCompatibility(compatibility *Compatibilit return m.DB.QueryRowContext(ctx, query, args...).Scan(&compatibility.Id) } -func (m FoundryStateModel) InsertModuleLanguages(lang *Language, moduleId int) error { +func (m FoundryStateModel) InsertModuleLanguages(lang *Language, moduleId int64) error { query := ` INSERT INTO modules_compatibility (model_id, language, name, path) VALUES ($1, $2, $3, $4) @@ -82,3 +84,143 @@ func (m FoundryStateModel) InsertModuleLanguages(lang *Language, moduleId int) e return m.DB.QueryRowContext(ctx, query, args...).Scan(&lang.Id) } + +func (m FoundryStateModel) GetModules(idState int64) (Modules, error) { + if idState < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, created_at, text_id, title, description, url, version, availability + FROM modules + WHERE state_id = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + rows, err := m.DB.QueryContext(ctx, query, idState) + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + modules := make(Modules, 0, 1) + + for rows.Next() { + var module Module + err := rows.Scan( + &module.Id, + &module.CreatedAt, + &module.TextId, + &module.Title, + &module.Description, + &module.Url, + &module.Version, + &module.Availability, + ) + if err != nil { + return nil, err + } + module.Languages, err = m.GetModuleLanguages(module.Id) + if err != nil { + return nil, err + } + + compatibility, err := m.GetModuleCompatibility(module.Id) + if err != nil { + return nil, err + } + module.Compatibility = *compatibility + modules = append(modules, module) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return modules, nil +} + +func (m FoundryStateModel) GetModuleCompatibility(idModule int64) (*Compatibility, error) { + if idModule < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, minimum, verified, maximum + FROM modules_compatibility + WHERE module_id = $1` + + var compatibility Compatibility + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + err := m.DB.QueryRowContext(ctx, query, idModule).Scan( + &compatibility.Id, + &compatibility.Minimum, + &compatibility.Verified, + &compatibility.Maximum, + ) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + return &compatibility, nil +} + +func (m FoundryStateModel) GetModuleLanguages(idModule int64) ([]Language, error) { + if idModule < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, language, name, path + FROM modules_languages + WHERE module_id = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + rows, err := m.DB.QueryContext(ctx, query, idModule) + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + languages := make([]Language, 0, 1) + + for rows.Next() { + var lang Language + err := rows.Scan( + &lang.Id, + &lang.Lang, + &lang.Name, + &lang.Path, + ) + if err != nil { + return nil, err + } + languages = append(languages, lang) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return languages, nil +} diff --git a/internal/foundry/models/db/system.go b/internal/foundry/models/db/system.go index aca1f8d..25f549c 100644 --- a/internal/foundry/models/db/system.go +++ b/internal/foundry/models/db/system.go @@ -2,11 +2,13 @@ package db import ( "context" + "database/sql" + "errors" "time" ) type System struct { - Id int + Id int64 TextId string Title string Description string @@ -22,7 +24,7 @@ func (systems Systems) GetById(id int) *System { return &systems[id] } -func (m FoundryStateModel) InsertSystem(system *System, stateId int) error { +func (m FoundryStateModel) InsertSystem(system *System, stateId int64) error { query := ` INSERT INTO systems (state_id, text_id, title, description, url, download) VALUES ($1, $2, $3, $4, $5, $6)` @@ -39,7 +41,7 @@ func (m FoundryStateModel) InsertSystem(system *System, stateId int) error { return m.InsertModuleCompatibility(&system.Compatibility, system.Id) } -func (m FoundryStateModel) InsertSystenCompatibility(compatibility *Compatibility, systemId int) error { +func (m FoundryStateModel) InsertSystenCompatibility(compatibility *Compatibility, systemId int64) error { query := ` INSERT INTO systems_compatibility (system_id, minumum, verified, maximum) VALUES ($1, $2, $3, $4)` @@ -51,3 +53,91 @@ func (m FoundryStateModel) InsertSystenCompatibility(compatibility *Compatibilit return m.DB.QueryRowContext(ctx, query, args...).Scan(&compatibility.Id) } + +func (m FoundryStateModel) GetSystems(idState int64) (Systems, error) { + if idState < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, created_at, text_id, title, description, url, download + FROM systems + WHERE state_id = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + rows, err := m.DB.QueryContext(ctx, query, idState) + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + systems := make(Systems, 0, 1) + + for rows.Next() { + var system System + err := rows.Scan( + &system.Id, + &system.CreatedAt, + &system.TextId, + &system.Title, + &system.Description, + &system.Url, + &system.Download, + ) + if err != nil { + return nil, err + } + compatibility, err := m.GetModuleCompatibility(system.Id) + if err != nil { + return nil, err + } + system.Compatibility = *compatibility + systems = append(systems, system) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return systems, nil +} + +func (m FoundryStateModel) GetSystemCompatibility(idSystem int64) (*Compatibility, error) { + if idSystem < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, minimum, verified, maximum + FROM systems_compatibility + WHERE system_id = $1` + + var compatibility Compatibility + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + err := m.DB.QueryRowContext(ctx, query, idSystem).Scan( + &compatibility.Id, + &compatibility.Minimum, + &compatibility.Verified, + &compatibility.Maximum, + ) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + return &compatibility, nil +} diff --git a/internal/foundry/models/db/user.go b/internal/foundry/models/db/user.go index 922aae7..19fab87 100644 --- a/internal/foundry/models/db/user.go +++ b/internal/foundry/models/db/user.go @@ -2,11 +2,13 @@ package db import ( "context" + "database/sql" + "errors" "time" ) type User struct { - Id int + Id int64 Name string Role int Character string @@ -18,7 +20,7 @@ type User struct { } type UserStats struct { - Id int + Id int64 CoreVersion string SystemId string SystemVersion string @@ -33,7 +35,7 @@ func (users Users) GetById(id int) *User { return &users[id] } -func (m FoundryStateModel) InsertUser(user *User, stateId int) error { +func (m FoundryStateModel) InsertUser(user *User, stateId int64) error { query := ` INSERT INTO users (state_id, name, role, character, color, pronouns) VALUES ($1, $2, $3, $4, $5, $6) @@ -59,7 +61,7 @@ func (m FoundryStateModel) InsertUser(user *User, stateId int) error { return m.InsertUserStats(&user.Stats, user.Id) } -func (m FoundryStateModel) InsertUserHotbar(key string, value string, userId int) error { +func (m FoundryStateModel) InsertUserHotbar(key string, value string, userId int64) error { query := ` INSERT INTO users_hotbar (user_id, key, value) VALUES ($1, $2, $3)` @@ -76,7 +78,7 @@ func (m FoundryStateModel) InsertUserHotbar(key string, value string, userId int return nil } -func (m FoundryStateModel) InsertUserStats(stats *UserStats, userId int) error { +func (m FoundryStateModel) InsertUserStats(stats *UserStats, userId int64) error { query := ` INSERT INTO users_stats (user_id, core_version, system_id, system_version, created_time, modified_time, last_modified_by) VALUES ($1, $2, $3, $4, $5, $6, $7) @@ -89,3 +91,150 @@ func (m FoundryStateModel) InsertUserStats(stats *UserStats, userId int) error { return m.DB.QueryRowContext(ctx, query, args...).Scan(&stats.Id) } + +func (m FoundryStateModel) GetUsers(idState int64) (Users, error) { + if idState < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, created_at, name, role, character, color, pronouns + FROM users + WHERE state_id = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + rows, err := m.DB.QueryContext(ctx, query, idState) + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + users := make(Users, 0, 1) + + for rows.Next() { + var user User + err := rows.Scan( + &user.Id, + &user.CreatedAt, + &user.Name, + &user.Role, + &user.Character, + &user.Color, + &user.Pronouns, + ) + if err != nil { + return nil, err + } + user.Hotbar, err = m.GetUserHotbar(user.Id) + if err != nil { + return nil, err + } + userState, err := m.GetUserStats(user.Id) + if err != nil { + return nil, err + } + + user.Stats = *userState + users = append(users, user) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return users, nil +} + +func (m FoundryStateModel) GetUserHotbar(idUser int64) (map[string]string, error) { + if idUser < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT key, value + FROM users_hotbar + WHERE user_id = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + rows, err := m.DB.QueryContext(ctx, query, idUser) + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + hotbar := make(map[string]string) + for rows.Next() { + var key string + var val string + + err := rows.Scan( + &key, + &val, + ) + if err != nil { + return nil, err + } + + hotbar[key] = val + } + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + return hotbar, nil +} + +func (m FoundryStateModel) GetUserStats(idSystem int64) (*UserStats, error) { + if idSystem < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, core_version, system_id, system_version, created_time, modified_time, last_modified_by + FROM users_stats + WHERE user_id = $1` + + var userStats UserStats + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + err := m.DB.QueryRowContext(ctx, query, idSystem).Scan( + &userStats.Id, + &userStats.CoreVersion, + &userStats.SystemId, + &userStats.SystemVersion, + &userStats.CreatedTime, + &userStats.ModifiedTime, + &userStats.LastModifiedBy, + ) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + return &userStats, nil +} diff --git a/internal/foundry/models/db/world.go b/internal/foundry/models/db/world.go index 2be1c5a..6047ed9 100644 --- a/internal/foundry/models/db/world.go +++ b/internal/foundry/models/db/world.go @@ -2,11 +2,13 @@ package db import ( "context" + "database/sql" + "errors" "time" ) type World struct { - Id int + Id int64 TextId string Title string Description string @@ -26,7 +28,7 @@ func (worlds Worlds) GetById(id int) *World { return &worlds[id] } -func (m FoundryStateModel) InsertWorld(world *World, stateId int) error { +func (m FoundryStateModel) InsertWorld(world *World, stateId int64) error { query := ` INSERT INTO worlds (state_id, text_id, title, description, system, core_version, system_version, playtime, next_session) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) @@ -44,7 +46,7 @@ func (m FoundryStateModel) InsertWorld(world *World, stateId int) error { return m.InsertWorldCompatibility(&world.Compatibility, world.Id) } -func (m FoundryStateModel) InsertWorldCompatibility(compatibility *Compatibility, worldId int) error { +func (m FoundryStateModel) InsertWorldCompatibility(compatibility *Compatibility, worldId int64) error { query := ` INSERT INTO worlds_compatibility (world_id, minumum, verified, maximum) VALUES ($1, $2, $3, $4) @@ -58,6 +60,97 @@ func (m FoundryStateModel) InsertWorldCompatibility(compatibility *Compatibility return m.DB.QueryRowContext(ctx, query, args...).Scan(&compatibility.Id) } +func (m FoundryStateModel) GetWorlds(idState int64) (Worlds, error) { + if idState < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, created_at, text_id, title, description, system, core_version, system_version, playtime, next_session + FROM worlds + WHERE state_id = $1` + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + rows, err := m.DB.QueryContext(ctx, query, idState) + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + worlds := make(Worlds, 0, 1) + + for rows.Next() { + var world World + err := rows.Scan( + &world.Id, + &world.CreatedAt, + &world.TextId, + &world.Title, + &world.Description, + &world.System, + &world.CoreVersion, + &world.SystemVersion, + &world.PlayTime, + &world.NextSession, + ) + if err != nil { + return nil, err + } + compatibility, err := m.GetWorldsCompatibility(world.Id) + if err != nil { + return nil, err + } + world.Compatibility = *compatibility + worlds = append(worlds, world) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return worlds, nil +} + +func (m FoundryStateModel) GetWorldsCompatibility(idWorld int64) (*Compatibility, error) { + if idWorld < 1 { + return nil, ErrorRecordNotFound + } + + query := ` + SELECT id, minimum, verified, maximum + FROM worlds_compatibility + WHERE world_id = $1` + + var compatibility Compatibility + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + err := m.DB.QueryRowContext(ctx, query, idWorld).Scan( + &compatibility.Id, + &compatibility.Minimum, + &compatibility.Verified, + &compatibility.Maximum, + ) + + if err != nil { + switch { + case errors.Is(err, sql.ErrNoRows): + return nil, ErrorRecordNotFound + default: + return nil, err + } + } + + return &compatibility, nil +} + // func (worlds Worlds) GetSessionTime(worldName string) (*time.Time, error) { // if worldName == "" && len(worlds) != 1 { // return nil, ErrorSetupNotFound diff --git a/internal/foundry/models/json/data.go b/internal/foundry/models/json/data.go index 47e433b..6f0b0c3 100644 --- a/internal/foundry/models/json/data.go +++ b/internal/foundry/models/json/data.go @@ -139,6 +139,10 @@ func (state *FoundryState) GetWorlds() db.Worlds { } worldsCopy = append(worldsCopy, worldCopy) } + + if state.World != nil { + worldsCopy = append(worldsCopy, *state.GetWorld()) + } return worldsCopy } diff --git a/internal/foundry/models/json/users.go b/internal/foundry/models/json/users.go index 62299c3..4d0243b 100644 --- a/internal/foundry/models/json/users.go +++ b/internal/foundry/models/json/users.go @@ -39,7 +39,3 @@ type Users []User func (users Users) GetById(id int) *User { return &users[id] } - -func (state *FoundryState) GetUsers() *Users { - return &state.Users -}