forked from mirrors/homebox
fix linter errors
This commit is contained in:
parent
39d8ff03f8
commit
b33ef5f029
14 changed files with 44 additions and 307 deletions
|
@ -31,7 +31,7 @@ func userPool() func() {
|
|||
users = userOut
|
||||
|
||||
purge := func() {
|
||||
mockHandler.svc.Admin.DeleteAll(context.Background())
|
||||
_ = mockHandler.svc.Admin.DeleteAll(context.Background())
|
||||
}
|
||||
|
||||
return purge
|
||||
|
@ -43,7 +43,9 @@ func TestMain(m *testing.M) {
|
|||
repos, closeDb := mocks.GetEntRepos()
|
||||
mockHandler.svc = mocks.GetMockServices(repos)
|
||||
|
||||
defer closeDb()
|
||||
defer func() {
|
||||
_ = closeDb()
|
||||
}()
|
||||
|
||||
purge := userPool()
|
||||
defer purge()
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hay-kot/content/backend/internal/types"
|
||||
"github.com/hay-kot/content/backend/pkgs/automapper"
|
||||
"github.com/tkrajina/typescriptify-golang-structs/typescriptify"
|
||||
)
|
||||
|
||||
// generateMappers serialized the config file into a list of automapper struct
|
||||
func generateMappers() []automapper.AutoMapper {
|
||||
return []automapper.AutoMapper{}
|
||||
}
|
||||
|
||||
func generateTypeScript() {
|
||||
// Configuration
|
||||
converter := typescriptify.New()
|
||||
converter.CreateInterface = true
|
||||
converter.ManageType(uuid.UUID{}, typescriptify.TypeOptions{TSType: "string"})
|
||||
converter.ManageType(time.Time{}, typescriptify.TypeOptions{TSType: "Date", TSTransform: "new Date(__VALUE__)"})
|
||||
|
||||
// General
|
||||
public := []any{
|
||||
// Base Types
|
||||
types.ApiSummary{},
|
||||
|
||||
// User Types
|
||||
types.UserCreate{},
|
||||
types.UserIn{},
|
||||
types.UserUpdate{},
|
||||
|
||||
// Auth Types
|
||||
types.LoginForm{},
|
||||
types.TokenResponse{},
|
||||
}
|
||||
|
||||
for i := 0; i < len(public); i++ {
|
||||
converter.Add(public[i])
|
||||
}
|
||||
|
||||
// Creation
|
||||
converter.ConvertToFile("./generated-types.ts")
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
automappers := generateMappers()
|
||||
conf := automapper.DefaultConf()
|
||||
|
||||
automapper.Generate(automappers, conf)
|
||||
|
||||
generateTypeScript()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue