Skip to content

Commit

Permalink
Upgraded code for Nim v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfilby committed Dec 28, 2023
1 parent c8a3d1d commit ca09eec
Show file tree
Hide file tree
Showing 61 changed files with 97 additions and 64 deletions.
3 changes: 2 additions & 1 deletion nexus.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.1.1"
version = "2.0.0"
author = "jfilby"
description = "Nexus Development Framework"
license = "Apache-2.0"
Expand All @@ -11,6 +11,7 @@ srcDir = "src"

requires "nim >= 1.6.0"
requires "argon2"
requires "db_connector"
requires "chronicles"
requires "jester"
requires "karax"
Expand Down
4 changes: 2 additions & 2 deletions src/nexus/cmd/service/generate/models/read_model_files.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ proc createBasicModelTypesFile*(

var typeStr =
"# Minimal model_types file (no models defined)with a DbContext definition\n" &
"import db_postgres\n" &
"import db_connector/db_postgres\n" &
"\n" &
"type\n" &
&" {module.nameInPascalCase}DbContext* = object\n" &
Expand Down Expand Up @@ -233,7 +233,7 @@ proc readModelFile(modelFiles: var seq[string],
modelModuleTypeTable: Table[string, string] # [ model.module, moduleType definition ]
fileModuleName = ""
moduleMinimumImports =
@[ "db_postgres",
@[ "db_connector/db_postgres",
"tables" ]

# Validate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ proc generateDataAccessFile*(
var
thirdPartySeqs: seq[string]
thirdPartyImports =
toOrderedSet( @[ "db_postgres",
toOrderedSet( @[ "db_connector/db_postgres",
"options",
"sequtils",
"strutils" ])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ proc generateDbContextProcs*(
moduleName = module.name

# Imports
var str = "import db_postgres, tables\n" &
var str = "import tables\n" &
"import db_connector/db_postgres\n" &
&"import {module.importPath}/types/model_types\n" &
"\n" &
"\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, os, strformat, strutils
import chronicles, os, strformat, strutils
import db_connector/db_postgres


proc bootstrapMigrationTables*(
Expand Down
6 changes: 3 additions & 3 deletions src/nexus/cmd/types/model_db_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ type

const
stdlibDbMySql = DbDriver(
driver: "stdlib/db_mysql",
driver: "db_connector/db_mysql",
minDbVersion: none(String),
package: none(String),
`import`: "db_mysql")


stdlibDbPostgres = DbDriver(
driver: "stdlib/db_postgres",
driver: "db_connector/db_postgres",
minDbVersion: none(String),
package: none(String),
`import`: "db_postgres")


stdlibDbSqlite = DbDriver(
driver: "stdlib/db_sqlite",
driver: "db_connector/db_sqlite",
minDbVersion: none(String),
package: none(String),
`import`: "db_sqlite")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times
import options, sequtils, strutils, times
import db_connector/db_postgres
import nexus/core/data_access/data_utils
import nexus/core/data_access/pg_try_insert_id
import nexus/core/types/model_types
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/cached_data_access/invite_cached_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times
import options, sequtils, strutils, times
import db_connector/db_postgres
import nexus/core/data_access/data_utils
import nexus/core/data_access/pg_try_insert_id
import nexus/core/types/model_types
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/data_access/account_data.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, options
import options
import db_connector/db_postgres


type
Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/data_access/account_user_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/data_access/account_user_role_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/data_access/account_user_token_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times
import db_connector/db_postgres, options, sequtils, strutils, times
import nexus/core/data_access/data_utils
import nexus/core/types/model_types

Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/data_access/data_utils.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, strutils, times
import chronicles, strutils, times
import db_connector/db_postgres


# Forward declarations
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/data_access/db_conn.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, locks, options, os, strformat, strutils
import locks, options, os, strformat, strutils
import db_connector/db_postgres


# DB open connection lock
Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/data_access/invite_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/data_access/nexus_setting_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core/types/model_types

Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/data_access/pg_try_insert_id.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# This is a custom verion of Nim's v1.2 db_postgres.tryInsertID that allows the ID field name to be specified
# The original version is found in: https://github.com/nim-lang/Nim/blob/devel/lib/impure/db_postgres.nim

import db_common, db_postgres, postgres, strutils
import db_common, postgres, strutils
import db_connector/db_postgres


proc dbFormat(formatstr: SqlQuery, args: varargs[string]): string =
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/account/login_action.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, json, options, strformat, tables, times
import chronicles, jester, json, options, strformat, tables, times
import db_connector/db_postgres
import docui/service/sdk/docui_elements
import docui/service/sdk/docui_types
import docui/service/sdk/docui_utils
Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/service/account/roles.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import db_postgres
import db_connector/db_postgres
import nexus/core/data_access/account_user_role_data
import nexus/core/types/model_types

Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/account/session.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Sessions are deprecated, replaced by JWT.
import chronicles, db_postgres, jester, marshal, options, random_key, streams
import chronicles, jester, marshal, options, random_key, streams
import db_connector/db_postgres
import nexus/core/data_access/session_data


Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/account/verify_account_fields.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, json, strformat, strutils, tables
import chronicles, json, strformat, strutils, tables
import db_connector/db_postgres
import docui/service/sdk/docui_elements
import docui/service/sdk/docui_types
import docui/service/sdk/docui_utils
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/account/verify_login_fields.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, json, options, tables
import chronicles, jester, json, options, tables
import db_connector/db_postgres
import docui/service/sdk/docui_elements
import docui/service/sdk/docui_types
import docui/service/sdk/docui_utils
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import db_postgres
import db_connector/db_postgres
import docui/service/sdk/docui_types
import docui/service/sdk/docui_utils
import nexus/core/types/model_types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, options, json, tables
import options, json, tables
import db_connector/db_postgres
import docui/service/sdk/docui_elements
import docui/service/sdk/docui_types
import docui/service/sdk/docui_utils
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/account/verify_sign_up_fields.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, json, tables
import json, tables
import db_connector/db_postgres
import docui/service/sdk/docui_elements
import docui/service/sdk/docui_types
import docui/service/sdk/docui_utils
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/invite/verify_invite_fields.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, strutils
import chronicles, strutils
import db_connector/db_postgres
import nexus/core/data_access/account_user_data
import nexus/core/data_access/invite_data
import nexus/core/service/account/verify_account_fields
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/service/module/db_context.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, tables
import tables
import db_connector/db_postgres
import nexus/core/types/model_types


Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/service/scheduled/daily.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import db_postgres
import db_connector/db_postgres
import nexus/core/service/account/jwt_utils


Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core/types/model_types.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, tables, times
import db_connector/db_postgres, options, tables, times


type
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/types/view_types.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, json, options, os, strutils
import chronicles, jester, json, options, os, strutils
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import docui/service/sdk/docui_types
import nexus/core/data_access/db_conn
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/account/login_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, json, options, strformat, strutils
import chronicles, jester, json, options, strformat, strutils
import db_connector/db_postgres
import tables, times
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/account/logout_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, htmlgen, jester, options
import htmlgen, jester, options
import db_connector/db_postgres
import nexus/core/data_access/db_conn
import nexus/core/service/account/jwt_utils
import nexus/core/types/context_type
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/account/my_account_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, options, strformat
import chronicles, jester, options, strformat
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
import nexus/core/data_access/db_conn
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/account/reset_password_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, options, strformat, uri
import chronicles, jester, options, strformat, uri
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
import nexus/core/data_access/db_conn
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/account/sign_up_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, options, strformat, times
import chronicles, jester, options, strformat, times
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
import nexus/core/data_access/account_user_role_data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, options
import chronicles, jester, options
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
import nexus/core/data_access/db_conn
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/account/sign_up_verify_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, jester, json, options, strformat
import chronicles, jester, json, options, strformat
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
import nexus/core/data_access/db_conn
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core/view/invite/invite_page.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, jester, options, strformat, times
import jester, options, strformat, times
import db_connector/db_postgres
import karax / [karaxdsl, vdom, vstyles]
import nexus/core/data_access/account_user_data
import nexus/core/data_access/db_conn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core_extras/types/model_types

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times
import db_connector/db_postgres, options, sequtils, strutils, times
import nexus/core/data_access/data_utils
import nexus/core_extras/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core_extras/data_access/list_item_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core_extras/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core_extras/data_access/menu_item_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/core_extras/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core_extras/data_access/temp_form_data_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times
import db_connector/db_postgres, options, sequtils, strutils, times
import nexus/core/data_access/data_utils
import nexus/core_extras/types/model_types

Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core_extras/data_access/temp_queue_data_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times
import db_connector/db_postgres, options, sequtils, strutils, times
import nexus/core/data_access/data_utils
import nexus/core_extras/types/model_types

Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core_extras/service/lists/load_lists.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, os, streams, strformat, times, yaml
import chronicles, os, streams, strformat, times, yaml
import db_connector/db_postgres
import nexus/core_extras/data_access/list_item_data
import nexus/core_extras/types/context_type
import nexus/core_extras/types/model_types
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core_extras/service/menus/load_menus.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chronicles, db_postgres, os, streams, strformat, times, yaml
import chronicles, os, streams, strformat, times, yaml
import db_connector/db_postgres
import nexus/core/service/format/type_utils
import nexus/core_extras/data_access/menu_item_data
import nexus/core_extras/service/lists/list_utils
Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core_extras/service/module/db_context.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, tables
import tables
import db_connector/db_postgres
import nexus/core_extras/types/model_types


Expand Down
3 changes: 2 additions & 1 deletion src/nexus/core_extras/service/user/admin_user.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import db_postgres, options, times
import options, times
import db_connector/db_postgres
import nexus/core/data_access/account_user_data
import nexus/core/data_access/account_user_role_data
import nexus/core/service/account/encrypt
Expand Down
2 changes: 1 addition & 1 deletion src/nexus/core_extras/types/model_types.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, tables, times
import db_connector/db_postgres, options, tables, times


type
Expand Down
2 changes: 1 addition & 1 deletion src/nexus/crm/data_access/mailing_list_data.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nexus generated file
import db_postgres, options, sequtils, strutils, times, uuids
import db_connector/db_postgres, options, sequtils, strutils, times, uuids
import nexus/core/data_access/data_utils
import nexus/crm/types/model_types

Expand Down
Loading

0 comments on commit ca09eec

Please sign in to comment.