Skip to content

Commit

Permalink
Merge pull request #2 from SecJS/feat/len-release-v1
Browse files Browse the repository at this point in the history
feat: release v1.0.0
  • Loading branch information
jlenon7 authored Mar 20, 2022
2 parents 37cdb17 + 4cab4e7 commit d82eb52
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ npm install @secjs/orm

### Configuring @secjs/database

> To use @secjs/orm you need to set up @secjs/database first and connect it to Database. [Go to @secjs/database documentation]("https://github.com/SecJS/Database#readme")
> To use @secjs/orm you need to set up @secjs/database first and connect it to Database.
#### [Go to @secjs/database documentation]("https://github.com/SecJS/Database#readme")

### Model

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-explicit-any": "off",
"prettier/prettier": "error",
"no-use-before-define": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
Expand Down
10 changes: 5 additions & 5 deletions src/Types/ModelPropsJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

import { ModelPropsRecord } from './ModelPropsRecord'

/**
* Json from generic Type properties
*/
export type ModelPropsJson<Type> = RecursiveJson<ModelPropsRecord<Type>>

/**
* Return the key type if extends string | boolean | number | Date.
* Else will return again ModelPropsJson for key type
Expand All @@ -18,8 +23,3 @@ export type RecursiveJson<Type> = {
? Type[Key]
: ModelPropsJson<Type[Key]>
}

/**
* Json from generic Type properties
*/
export type ModelPropsJson<Type> = RecursiveJson<ModelPropsRecord<Type>>
4 changes: 1 addition & 3 deletions src/Utils/ModelFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ModelFactory<Class extends typeof Model> {
private readonly definition: () => Promise<any>
private readonly returning: string

private _count: number = 1
private _count = 1

constructor(
model: typeof Model,
Expand Down Expand Up @@ -134,8 +134,6 @@ export class ModelFactory<Class extends typeof Model> {

if (column.isPrimary) {
data[column.propertyName] = Number.randomIntFromInterval(0, 100000)

return
}
})

Expand Down
12 changes: 4 additions & 8 deletions src/Utils/ModelQueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ export class ModelQueryBuilder<Class extends typeof Model> {
// Set the default value of the column only if it does not exist in createObject, and it's not a PK
if (!c.isPrimary && !createObject[c.columnName]) {
createObject[c.columnName] = c.defaultValue

return
}
})

Expand Down Expand Up @@ -175,8 +173,6 @@ export class ModelQueryBuilder<Class extends typeof Model> {
// Set updatedAt only if it does not exist in updateObject
if (c.isUpdatedAt && !updateObject[c.columnName]) {
updateObject[c.columnName] = new Date()

return
}
})

Expand Down Expand Up @@ -334,7 +330,7 @@ export class ModelQueryBuilder<Class extends typeof Model> {
}

if (Is.Object(statement)) {
let newStatement: any = {}
const newStatement: any = {}

Object.keys(statement).forEach(key => {
newStatement[reverseDictionary[key] || key] = statement[key]
Expand Down Expand Up @@ -370,7 +366,7 @@ export class ModelQueryBuilder<Class extends typeof Model> {
}

if (Is.Object(statement)) {
let newStatement: any = {}
const newStatement: any = {}

Object.keys(statement).forEach(key => {
newStatement[reverseDictionary[key] || key] = statement[key]
Expand Down Expand Up @@ -406,7 +402,7 @@ export class ModelQueryBuilder<Class extends typeof Model> {
}

if (Is.Object(statement)) {
let newStatement: any = {}
const newStatement: any = {}

Object.keys(statement).forEach(key => {
newStatement[reverseDictionary[key] || key] = statement[key]
Expand Down Expand Up @@ -442,7 +438,7 @@ export class ModelQueryBuilder<Class extends typeof Model> {
}

if (Is.Object(statement)) {
let newStatement: any = {}
const newStatement: any = {}

Object.keys(statement).forEach(key => {
newStatement[reverseDictionary[key] || key] = statement[key]
Expand Down

0 comments on commit d82eb52

Please sign in to comment.