Skip to content

Commit 78897c3

Browse files
committed
Prettier nonsense
1 parent 632523f commit 78897c3

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

src/metadata/FieldMetadata.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
const Suffixes = {
2-
'uuid': '_uuid',
3-
'enum': 'enum',
2+
uuid: '_uuid',
3+
enum: 'enum',
44
};
5-
const NonParamTypes = [
6-
'uuid',
7-
'date'
8-
];
5+
const NonParamTypes = ['uuid', 'date'];
96

10-
function createColName({ name, type }){
7+
function createColName({ name, type }) {
118
return name.toLowerCase() + (Suffixes[type] || '');
129
}
1310

@@ -18,10 +15,7 @@ class FieldMetadata {
1815
{
1916
colName: createColName(field),
2017
isParam: !NonParamTypes.includes(field.type),
21-
defaultValue: field.defaultValue ??
22-
field.type === 'boolean'
23-
? false
24-
: null
18+
defaultValue: field.defaultValue ?? field.type === 'boolean' ? false : null,
2519
},
2620
field
2721
);
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
const { DataTypes } = require('sequelize');
22

3-
const SequelizeKeys = [
4-
'allowNull',
5-
'primaryKey',
6-
'autoIncrement',
7-
'unique',
8-
];
3+
const SequelizeKeys = ['allowNull', 'primaryKey', 'autoIncrement', 'unique'];
94

10-
const pick = (obj, keys) => Object.fromEntries(
11-
keys
12-
.filter(key => key in obj)
13-
.map(key => [key, obj[key]])
14-
);
5+
const pick = (obj, keys) => Object.fromEntries(keys.filter((key) => key in obj).map((key) => [key, obj[key]]));
156

167
module.exports = function convertToSequelizeField(field) {
17-
const { name, type: typeName, enumValues } = field;
8+
const { name, type: typeName, enumValues } = field;
189

1910
let type = DataTypes[typeName.toUpperCase()];
2011

@@ -25,8 +16,8 @@ module.exports = function convertToSequelizeField(field) {
2516
const convertedField = {
2617
field: field.colName,
2718
type,
28-
...pick(field, SequelizeKeys)
19+
...pick(field, SequelizeKeys),
2920
};
3021

3122
return [name, convertedField];
32-
}
23+
};

0 commit comments

Comments
 (0)