-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses dictionary structure to store records in the database
- Loading branch information
1 parent
30e3bde
commit 2fcd9d3
Showing
31 changed files
with
446 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { factory } from './factory' | ||
export { primaryKey } from './primaryKey' | ||
export { oneOf } from './relations/oneOf' | ||
export { manyOf } from './relations/manyOf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ModelDictionary } from '../glossary' | ||
|
||
const DEFAULT_PRIMARY_KEY = 'id' | ||
|
||
export function getPrimaryKeyByDeclaration( | ||
declaration: ModelDictionary, | ||
): string { | ||
const customPrimaryKey = Object.entries(declaration).reduce<string>( | ||
(acc, [key, value]) => { | ||
return acc | ||
}, | ||
null, | ||
) | ||
|
||
return customPrimaryKey || DEFAULT_PRIMARY_KEY | ||
} |
Oops, something went wrong.