🚀 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)
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

View File

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

View File

@ -51,6 +51,7 @@ exports.getFunctionBySlug = (req, res, next) => {
if (!result) {
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);
})
.catch((error) => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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