Mise à jour de routes et models
This commit is contained in:
+10
-10
@@ -16,11 +16,11 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
}
|
||||
Article.init({
|
||||
article_id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
||||
article_slug: { type: DataTypes.STRING, allowNull: false },
|
||||
article_title: { type: DataTypes.STRING, allowNull: false },
|
||||
article_description: { type: DataTypes.TEXT },
|
||||
article_body: { type: DataTypes.TEXT, allowNull: false }
|
||||
articleId: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
||||
slug: { type: DataTypes.STRING, allowNull: false },
|
||||
title: { type: DataTypes.STRING, allowNull: false },
|
||||
description: { type: DataTypes.TEXT },
|
||||
body: { type: DataTypes.TEXT, allowNull: false }
|
||||
}, {
|
||||
sequelize,
|
||||
timestamps: false,
|
||||
@@ -36,11 +36,11 @@ module.exports = (sequelize, DataTypes) => {
|
||||
|
||||
Article.prototype.toJSONFor = function () {
|
||||
return {
|
||||
id: this.article_id,
|
||||
slug: this.article_slug,
|
||||
title: this.article_title,
|
||||
description: this.article_description,
|
||||
body: this.article_body
|
||||
articleId: this.articleId,
|
||||
slug: this.slug,
|
||||
title: this.title,
|
||||
description: this.description,
|
||||
body: this.body
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
}
|
||||
Comment.init({
|
||||
comment_id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
||||
comment_body: { type: DataTypes.TEXT, allowNull: false }
|
||||
commentId: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
||||
body: { type: DataTypes.TEXT, allowNull: false }
|
||||
}, {
|
||||
sequelize,
|
||||
timestamps: false,
|
||||
@@ -26,8 +26,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
|
||||
Comment.prototype.toJSONFor = function () {
|
||||
return {
|
||||
id: this.comment_id,
|
||||
body: this.comment_body
|
||||
commentId: this.commentId,
|
||||
body: this.body
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+2
-3
@@ -13,7 +13,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
}
|
||||
Tag.init({
|
||||
tag_name: { type: DataTypes.STRING, allowNull: false, primaryKey: true }
|
||||
name: { type: DataTypes.STRING, primaryKey: true, allowNull: false }
|
||||
}, {
|
||||
sequelize,
|
||||
timestamps: false,
|
||||
@@ -25,8 +25,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
|
||||
Tag.prototype.toJSONFor = function () {
|
||||
return {
|
||||
id: this.tag_id,
|
||||
name: this.tag_name
|
||||
name: this.name
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+17
-26
@@ -17,19 +17,15 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
}
|
||||
User.init({
|
||||
user_id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false},
|
||||
user_username: {type: DataTypes.STRING, allowNull: false},
|
||||
user_lastname: {type: DataTypes.STRING},
|
||||
user_firstname: {type: DataTypes.STRING},
|
||||
user_email: {type: DataTypes.STRING},
|
||||
user_adresse: {type: DataTypes.STRING},
|
||||
user_ville: {type: DataTypes.STRING},
|
||||
user_region: {type: DataTypes.STRING},
|
||||
user_cp: {type: DataTypes.STRING},
|
||||
user_pays: {type: DataTypes.STRING},
|
||||
user_tel: {type: DataTypes.STRING},
|
||||
user_mobile: {type: DataTypes.STRING},
|
||||
user_role: {type: DataTypes.INTEGER}
|
||||
userId: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false},
|
||||
email: {type: DataTypes.STRING, allowNull: false, unique: true},
|
||||
username: {type: DataTypes.STRING, allowNull: false, unique: true},
|
||||
firstname: {type: DataTypes.STRING},
|
||||
lastname: {type: DataTypes.STRING},
|
||||
bio: {type: DataTypes.TEXT, allowNull: true},
|
||||
image: {type: DataTypes.TEXT, allowNull: true},
|
||||
role: {type: DataTypes.STRING},
|
||||
password: {type: DataTypes.STRING, allowNull: false}
|
||||
}, {
|
||||
sequelize,
|
||||
timestamps: false,
|
||||
@@ -55,19 +51,14 @@ module.exports = (sequelize, DataTypes) => {
|
||||
|
||||
User.prototype.toJSONFor = function () {
|
||||
return {
|
||||
id: this.mbr_id,
|
||||
username: this.mbr_pseudo,
|
||||
lastname: this.mbr_nom,
|
||||
firstname: this.mbr_prenom,
|
||||
email: this.mbr_email,
|
||||
adresse: this.mbr_adresse,
|
||||
ville: this.mbr_ville,
|
||||
region: this.mbr_region,
|
||||
cp: this.mbr_cp,
|
||||
pays: this.mbr_pays,
|
||||
tel: this.mbr_tel,
|
||||
mobile: this.mbr_mobile,
|
||||
statut: this.mbr_statut
|
||||
userId: this.userId,
|
||||
email: this.email,
|
||||
username: this.username,
|
||||
firstname: this.firstname,
|
||||
lastname: this.lastname,
|
||||
bio: this.bio,
|
||||
image: this.image,
|
||||
role: this.role
|
||||
};
|
||||
};
|
||||
return User;
|
||||
|
||||
Reference in New Issue
Block a user