Skip to content

Commit

Permalink
Merge pull request #24 from philippebeck/dev
Browse files Browse the repository at this point in the history
Release 1.0.8
  • Loading branch information
philippebeck authored Jan 3, 2024
2 parents 10a1458 + 4467081 commit cf74ece
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .env.compile
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ ROUTE_USER = "/users"
SQL_OK = "Connexion au serveur reussie !"
SQL_KO = "Connexion au serveur echouée !"

STRING_MAX = 200
STRING_MAX = 250
STRING_MIN = 2

TEXT_MAX = 10000
TEXT_MAX = 65000
TEXT_MIN = 5

USER_CREATED = "User created !"
Expand Down
4 changes: 2 additions & 2 deletions controller/ArticleCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ exports.checkArticleData = (name, text, alt, cat, res) => {
const IS_NAME_CHECKED = nem.checkRange(name, STRING_MIN, STRING_MAX);
const IS_TEXT_CHECKED = nem.checkRange(text, TEXT_MIN, TEXT_MAX);
const IS_ALT_CHECKED = nem.checkRange(alt, STRING_MIN, STRING_MAX);
const ID_CAT_CHECKED = nem.checkRange(cat, STRING_MIN, STRING_MAX);
const IS_CAT_CHECKED = nem.checkRange(cat, STRING_MIN, STRING_MAX);

if (!IS_NAME_CHECKED || !IS_TEXT_CHECKED || !IS_ALT_CHECKED || !ID_CAT_CHECKED) {
if (!IS_NAME_CHECKED || !IS_TEXT_CHECKED || !IS_ALT_CHECKED || !IS_CAT_CHECKED) {
return res.status(403).json({
message: CHECK_CAT || CHECK_NAME || CHECK_TEXT || CHECK_NAME
});
Expand Down
46 changes: 23 additions & 23 deletions data/DBTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,56 @@ USE nens;

CREATE TABLE Articles(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(200) NOT NULL UNIQUE,
name VARCHAR(250) NOT NULL UNIQUE,
text TEXT NOT NULL UNIQUE,
image VARCHAR(200) NOT NULL UNIQUE,
alt VARCHAR(200) NOT NULL,
image VARCHAR(250) NOT NULL UNIQUE,
alt VARCHAR(250) NOT NULL,
likes TEXT NOT NULL,
cat VARCHAR(20) NOT NULL,
cat VARCHAR(25) NOT NULL,
createdAt DATETIME NOT NULL,
updatedAt DATETIME NOT NULL)
ENGINE=INNODB DEFAULT CHARSET=utf8;

CREATE TABLE Galleries(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(200) NOT NULL UNIQUE,
author VARCHAR(200) NOT NULL,
cover VARCHAR(200) NOT NULL UNIQUE)
name VARCHAR(250) NOT NULL UNIQUE,
author VARCHAR(250) NOT NULL,
cover VARCHAR(250) NOT NULL UNIQUE)
ENGINE=INNODB DEFAULT CHARSET=utf8;

CREATE TABLE Images(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(200) NOT NULL UNIQUE,
description VARCHAR(200) NOT NULL,
name VARCHAR(250) NOT NULL UNIQUE,
description VARCHAR(250) NOT NULL,
galleryId SMALLINT UNSIGNED NOT NULL,
CONSTRAINT fk_galleryId FOREIGN KEY (galleryId) REFERENCES Galleries(id))
ENGINE=INNODB DEFAULT CHARSET=utf8;

CREATE TABLE Links(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(200) NOT NULL UNIQUE,
url VARCHAR(200) NOT NULL UNIQUE,
cat VARCHAR(20) NOT NULL)
name VARCHAR(250) NOT NULL UNIQUE,
url VARCHAR(250) NOT NULL UNIQUE,
cat VARCHAR(25) NOT NULL)
ENGINE=INNODB DEFAULT CHARSET=utf8;

CREATE TABLE Products(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(200) NOT NULL UNIQUE,
name VARCHAR(250) NOT NULL UNIQUE,
description TEXT NOT NULL UNIQUE,
image VARCHAR(200) NOT NULL UNIQUE,
alt VARCHAR(200) NOT NULL,
image VARCHAR(250) NOT NULL UNIQUE,
alt VARCHAR(250) NOT NULL,
price DECIMAL NOT NULL,
options TEXT NOT NULL,
cat VARCHAR(20) NOT NULL)
cat VARCHAR(25) NOT NULL)
ENGINE=INNODB DEFAULT CHARSET=utf8;

CREATE TABLE Users(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(200) NOT NULL UNIQUE,
email VARCHAR(200) NOT NULL UNIQUE,
image VARCHAR(200) NOT NULL UNIQUE,
pass VARCHAR(200) NOT NULL,
role VARCHAR(20) NOT NULL,
name VARCHAR(250) NOT NULL UNIQUE,
email VARCHAR(250) NOT NULL UNIQUE,
image VARCHAR(250) NOT NULL UNIQUE,
pass VARCHAR(250) NOT NULL,
role VARCHAR(25) NOT NULL,
createdAt DATETIME NOT NULL,
updatedAt DATETIME NOT NULL)
ENGINE=INNODB DEFAULT CHARSET=utf8;
Expand All @@ -63,8 +63,8 @@ CREATE TABLE Orders(
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
products TEXT NOT NULL,
total DECIMAL NOT NULL,
paymentId VARCHAR(200) NOT NULL UNIQUE,
status VARCHAR(20) NOT NULL,
paymentId VARCHAR(250) NOT NULL UNIQUE,
status VARCHAR(25) NOT NULL,
userId SMALLINT UNSIGNED NOT NULL,
createdAt DATETIME NOT NULL,
updatedAt DATETIME NOT NULL,
Expand Down
8 changes: 4 additions & 4 deletions model/ArticleModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (Sequelize, DataTypes) => {
autoIncrement: true
},
name: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
Expand All @@ -28,20 +28,20 @@ module.exports = (Sequelize, DataTypes) => {
unique: true
},
image: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
alt: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false
},
likes: {
type: DataTypes.TEXT,
defaultValue: "[]"
},
cat: {
type: DataTypes.STRING(20),
type: DataTypes.STRING(25),
allowNull: false
},
}, {
Expand Down
6 changes: 3 additions & 3 deletions model/GalleryModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ module.exports = (Sequelize, DataTypes) => {
autoIncrement: true
},
name: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
author: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false
},
cover: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
}
Expand Down
4 changes: 2 additions & 2 deletions model/ImageModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ module.exports = (Sequelize, DataTypes) => {
autoIncrement: true
},
name: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
description: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false
},
galleryId: {
Expand Down
6 changes: 3 additions & 3 deletions model/LinkModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ module.exports = (Sequelize, DataTypes) => {
autoIncrement: true
},
name: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
url: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
cat: {
type: DataTypes.STRING(20),
type: DataTypes.STRING(25),
allowNull: false
}
}, {
Expand Down
4 changes: 2 additions & 2 deletions model/OrderModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ module.exports = (Sequelize, DataTypes) => {
allowNull: false
},
paymentId: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
status: {
type: DataTypes.STRING(20),
type: DataTypes.STRING(25),
allowNull: false
},
userId: {
Expand Down
8 changes: 4 additions & 4 deletions model/ProductModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (Sequelize, DataTypes) => {
autoIncrement: true
},
name: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
Expand All @@ -28,12 +28,12 @@ module.exports = (Sequelize, DataTypes) => {
unique: true
},
image: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
alt: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false
},
price: {
Expand All @@ -45,7 +45,7 @@ module.exports = (Sequelize, DataTypes) => {
defaultValue: ""
},
cat: {
type: DataTypes.STRING(20),
type: DataTypes.STRING(25),
allowNull: false
}
}, {
Expand Down
10 changes: 5 additions & 5 deletions model/UserModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ module.exports = (Sequelize, DataTypes) => {
autoIncrement: true
},
name: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
email: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
image: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false,
unique: true
},
pass: {
type: DataTypes.STRING(200),
type: DataTypes.STRING(250),
allowNull: false
},
role: {
type: DataTypes.STRING(20),
type: DataTypes.STRING(25),
allowNull: false
},
}, {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nens",
"version": "1.0.7",
"version": "1.0.8",
"description": "API with Node, Express, NemJS & SQL",
"keywords": [
"api",
Expand Down

0 comments on commit cf74ece

Please sign in to comment.