mirror of
https://github.com/strapi/strapi.git
synced 2025-08-14 03:34:53 +00:00
Merge branch 'master' into improve/doc-plugin
This commit is contained in:
commit
f5512c8e4b
@ -44,13 +44,9 @@ module.exports = function (strapi) {
|
|||||||
|
|
||||||
// Connect to mongo database
|
// Connect to mongo database
|
||||||
if (_.isEmpty(username) || _.isEmpty(password)) {
|
if (_.isEmpty(username) || _.isEmpty(password)) {
|
||||||
instance.connect(`mongodb://${host}:${port}/${database}`, {
|
instance.connect(`mongodb://${host}:${port}/${database}`);
|
||||||
useMongoClient: true
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
instance.connect(`mongodb://${username}:${password}@${host}:${port}/${database}`, {
|
instance.connect(`mongodb://${username}:${password}@${host}:${port}/${database}`);
|
||||||
useMongoClient: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle error
|
// Handle error
|
||||||
|
@ -5,11 +5,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = mongoose => {
|
module.exports = mongoose => {
|
||||||
require('mongoose-double')(mongoose);
|
|
||||||
require('mongoose-float').loadType(mongoose);
|
require('mongoose-float').loadType(mongoose);
|
||||||
|
|
||||||
const SchemaTypes = mongoose.Schema.Types;
|
const SchemaTypes = mongoose.Schema.Types;
|
||||||
|
|
||||||
|
SchemaTypes.Decimal.prototype.cast = function (value) {
|
||||||
|
return value.toString();
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
convertType: mongooseType => {
|
convertType: mongooseType => {
|
||||||
switch (mongooseType.toLowerCase()) {
|
switch (mongooseType.toLowerCase()) {
|
||||||
@ -22,9 +25,9 @@ module.exports = mongoose => {
|
|||||||
case 'biginteger':
|
case 'biginteger':
|
||||||
return 'Number';
|
return 'Number';
|
||||||
case 'float':
|
case 'float':
|
||||||
return SchemaTypes.Float;
|
return 'Float';
|
||||||
case 'decimal':
|
case 'decimal':
|
||||||
return SchemaTypes.Double;
|
return 'Decimal';
|
||||||
case 'date':
|
case 'date':
|
||||||
case 'time':
|
case 'time':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
"main": "./lib",
|
"main": "./lib",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"mongoose": "^4.11.10",
|
"mongoose": "^5.0.0-rc1",
|
||||||
"mongoose-double": "0.0.1",
|
|
||||||
"mongoose-float": "^1.0.2",
|
"mongoose-float": "^1.0.2",
|
||||||
"pluralize": "^6.0.0",
|
"pluralize": "^6.0.0",
|
||||||
"strapi-utils": "3.0.0-alpha.7.3"
|
"strapi-utils": "3.0.0-alpha.7.3"
|
||||||
|
@ -159,7 +159,7 @@ export class Edit extends React.Component {
|
|||||||
|
|
||||||
if (isObject(e.target.value) && e.target.value._isAMomentObject === true) {
|
if (isObject(e.target.value) && e.target.value._isAMomentObject === true) {
|
||||||
formattedValue = moment(e.target.value, 'YYYY-MM-DD HH:mm:ss').format();
|
formattedValue = moment(e.target.value, 'YYYY-MM-DD HH:mm:ss').format();
|
||||||
} else if (['float', 'integer', 'bigint'].indexOf(currentSchema.fields[e.target.name].type) !== -1) {
|
} else if (['float', 'integer', 'biginteger', 'decimal'].indexOf(currentSchema.fields[e.target.name].type) !== -1) {
|
||||||
formattedValue = toNumber(e.target.value);
|
formattedValue = toNumber(e.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user