🚀 RELEASE: Version 2.0

This commit is contained in:
Divlo 2020-05-13 19:37:24 +02:00
parent 46dce42826
commit 008f518f96
12 changed files with 12 additions and 55 deletions

View File

@ -24,7 +24,7 @@ Si vous aimez le projet, vous pouvez aider à **le faire connaître** en utilisa
Les dernières versions publiées : [https://github.com/Divlo/FunctionProject/releases](https://github.com/Divlo/FunctionProject/releases) Les dernières versions publiées : [https://github.com/Divlo/FunctionProject/releases](https://github.com/Divlo/FunctionProject/releases)
Le projet est disponible sur [function.divlo.fr](https://function.divlo.fr/) (actuellement en version 1.0). Le projet est disponible sur [function.divlo.fr](https://function.divlo.fr/) (actuellement en version 2.0).
## 🚀 Open Source ## 🚀 Open Source

View File

@ -69,6 +69,7 @@ exports.getFunctionBySlug = (req, res, next) => {
if (!result) { if (!result) {
return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 }); return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 });
} }
try { result.utilizationForm = JSON.parse(result.utilizationForm); } catch {}
return res.status(200).json(result); return res.status(200).json(result);
}) })
.catch((error) => { .catch((error) => {
@ -185,7 +186,7 @@ exports.putFunctionForm = async (req, res, next) => {
if (!resultFunction) { if (!resultFunction) {
return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 }); return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 });
} }
resultFunction.utilizationForm = form; resultFunction.utilizationForm = JSON.stringify(form);
const result = await resultFunction.save(); const result = await resultFunction.save();
return res.status(200).json(result); return res.status(200).json(result);
} catch (error) { } catch (error) {

View File

@ -51,6 +51,7 @@ exports.getFunctionBySlug = (req, res, next) => {
if (!result) { if (!result) {
return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 }); return errorHandling(next, { message: "La fonction n'existe pas.", statusCode: 404 });
} }
try { result.utilizationForm = JSON.parse(result.utilizationForm); } catch {}
return res.status(200).json(result); return res.status(200).json(result);
}) })
.catch((error) => { .catch((error) => {

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('categorie', { module.exports = sequelize.define('categorie', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
allowNull: false, allowNull: false,

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('comment', { module.exports = sequelize.define('comment', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
message: { message: {
type: Sequelize.TEXT, type: Sequelize.TEXT,
allowNull: false allowNull: false

View File

@ -1,11 +1,4 @@
const Sequelize = require('sequelize'); const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('favorite', { module.exports = sequelize.define('favorite', {});
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
}
});

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('function', { module.exports = sequelize.define('function', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
title: { title: {
type: Sequelize.STRING, type: Sequelize.STRING,
allowNull: false, allowNull: false,
@ -34,7 +28,7 @@ module.exports = sequelize.define('function', {
allowNull: true allowNull: true
}, },
utilizationForm: { utilizationForm: {
type: Sequelize.JSON, type: Sequelize.TEXT,
allowNull: true allowNull: true
}, },
isOnline: { isOnline: {

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('quote', { module.exports = sequelize.define('quote', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
quote: { quote: {
type: Sequelize.STRING, type: Sequelize.STRING,
allowNull: false, allowNull: false,

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('short_link', { module.exports = sequelize.define('short_link', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
url: { url: {
type: Sequelize.TEXT, type: Sequelize.TEXT,
allowNull: false, allowNull: false,

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('task', { module.exports = sequelize.define('task', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
task: { task: {
type: Sequelize.STRING, type: Sequelize.STRING,
allowNull: false, allowNull: false,

View File

@ -2,12 +2,6 @@ const Sequelize = require('sequelize');
const sequelize = require('../assets/utils/database'); const sequelize = require('../assets/utils/database');
module.exports = sequelize.define('user', { module.exports = sequelize.define('user', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
allowNull: false, allowNull: false,

View File

@ -68,9 +68,13 @@ const newPassword = (props) => {
); );
} }
newPassword.getInitialProps = (context) => { export async function getServerSideProps(context) {
if (context.query.token != undefined) { if (context.query.token != undefined) {
return context.query; return {
props: {
token: context.query.token
}
};
} }
return redirect(context, '/404'); return redirect(context, '/404');
} }