MainSCPiNet Help

4. SCPiNet

Découvrir le SCPiNet

Scpinet

Le Projet SCPiNet est un projet "d'intranet" complètement intégré dans le contexte RolePlay. Il a été prévu pour gérer et servir de biais d'information et de communication dans le Roleplay Arktis. Il est également intégré dans le jeu afin de rendre certainnes informations visible direction dans Arktis.

Inet ingame
Inet web

Historique de versions

  1. SCPiNet V1. Initié par BlackNiteHD. Cette version n'est jamais sortie en production.

  2. SCPiNet V1.1. Développée par BlackNiteHD. Cette version a servi en production mais a été changée pour le SCPiNet V2.

  3. SCPiNet V2. Développée par Gabidut76. Cette version est stoppée en production le 21 Décembre 2024. Pour revoir intégralement le fonctionnement interne de celle-ci

  4. SCPiNetRefracted. Développée par Gabidut76. Cette version est la version qui est utilisée actuellement.

Philosophie

Le SCPiNet avait pour vocation initiale de foncionner en monoscript (1 seul fichier responsable du système). Ce système étant relativement illisible a été modifié lors du passage au SCPiNetV2. Il est en suite passé sur un modèle MVC. Cependant un problème subsistait, l'apparition de dépendences circulaire était régulière.

circulardep.png

Il a donc été décidé de revoir intégralement le BackEnd pour passer sur un version 100% Orientée objet où chaque élément serait hérité d'un autre depuis un module primaire.

Actuellement, le SCPiNet fonctionne toujours sur le modèle MVC mais est à 90% converti en POO.

Partie technique

Sécurité de démarrage

Pour assurer un uptime constant, le système fonctionne via le module PM2 qui a pour charge de redémarrer le programme en cas d'interruption. Des sécurités interne ont également été mises en place tel que l'interception des unhandledRejection qui à la place de couper totalement le programme vont afficher l'erreur dans le logger. Une sécurité de démarrage est également lancée à chaque démarrage afin de vérifier l'intégrité du programme (dépendances NodeJS, mises à jour via GitHub automatisée, ...)

Modèle : MySQL & Sequelize Sequelize

La partie modèle du MVC est assurée par Sequelize, un module NodeJS. Un total de 24 modules sont chargés. Tous représentant une table MySQL.

accountsrole: intdeactivated: intmedical: jsonspecialisation: jsonmailsignature: longtextmailheader: longtextapps: jsonrapportshidden: jsonnotifications: jsonsettings: jsonid: intname: varchar(50)firstname: varchar(50)email: varchar(100)password: varchar(255)token: varchar(255)classdclassdNumber: textstatus: textisAlive: textlevel: textpoints: intmedicalPoints: textaddedAt: timestampname: textfirstname: textbirthdate: textnotes: longtextreason: textid: intdiapo_tvname: textlocation: textdisplay: textid: intdocumentscontent: textdate: dateiteration: intid: intcategory: varchar(255)title: varchar(255)thumbnail: varchar(255)experiencestitle: longtextmaterial: longtextpersonnel: longtextbut: longtextcontent: longtextprotocol: longtextdate: timestampticketmade: intparticipants: jsonid: intauthor: varchar(100)scp: varchar(255)evpcs: tinyint(1)state: varchar(100)mail_categoriesrelatedto: inticon: textcolor: textcontent: jsonorder: intid: intname: varchar(50)mailsfrom: jsonbcc: jsonto: jsonsubject: longtextobject: longtextdate: timestampread: jsonaccusrecept: jsonreplyto: intdeletedfor: jsonid: int unsignedplayer_rapportsrelatedPlayer: intcontent: longtextcreatedBy: intcreatedAt: datetimeupdateHistory: jsonid: intrapportType: varchar(255)player_rapports_typesdisplayname: textvisibleby: jsonid: intname: varchar(255)productsprice: intid: intitemname: varchar(200)rapportstitle: textcontent: longtexttime: timestampvisibility: jsonrapporttype: intisPinned: intid: intauthor: varchar(100)branch: varchar(100)code: varchar(100)relatedSCP: varchar(255)rapports_themesname: textaccessibleby: jsonrelation: textdefaultcontent: longtextid: introleiteration: intaccreditation: intid: intbranch: varchar(255)name: varchar(255)whitelist_name: varchar(100)class: varchar(255)censured: tinyint(1)scpcontent: longtextpcs: jsonisPartOfNewSystem: intid: int unsignedname: varchar(255)title: varchar(255)iteration: varchar(255)accreditation: varchar(255)class: varchar(255)menace: varchar(255)specialisationsid: intname: varchar(255)displayName: varchar(255)relatedBranch: varchar(255)stock_associationsorthoName: textregistryLinked: textparseDetails: jsonid: intstock_itemsregistryName: textlangName: textimageName: textcraftWay: textid: intstock_logsrelatedType: textaction: textquantity: textmaterial: textdetails: textlocation: textid: intstock_typesstockname: textrelatedBranch: textid: intticketsindex: bigint unsignedobject: textcontent: textimpact: textlocation: textdate: timestampstate: intauthor: varchar(255)view_accounts_detailsid: introle: intdeactivated: intmedical: jsonspecialisation: jsonmailsignature: longtextmailheader: longtextapps: jsonrapportshidden: jsonnotifications: jsonsettings: jsonrole_id: intiteration: intaccreditation: intspe_id: intname: varchar(50)firstname: varchar(50)email: varchar(100)password: varchar(255)token: varchar(255)branch: varchar(255)role_name: varchar(255)class: varchar(255)censured: tinyint(1)spe_name: varchar(255)spe_displayName: varchar(255)view_experiencesid: inttitle: longtextmaterial: longtextpersonnel: longtextbut: longtextcontent: longtextprotocol: longtextdate: timestampticketmade: intparticipants: jsonscp_content: longtextpcs: jsonauthor: varchar(100)scp: varchar(255)evpcs: tinyint(1)state: varchar(100)scp_title: varchar(255)iteration: varchar(255)accreditation: varchar(255)class: varchar(255)menace: varchar(255)view_player_rapportsid: intrelatedPlayer: intcontent: longtextcreatedBy: intcreatedAt: datetimeupdateHistory: jsonrelated_account_id: intrelated_account_role: intauthor_account_id: intauthor_account_role: intplayer_rapports_types_id: intplayer_rapports_types_displayname: textvisibleby: jsonrapportType: varchar(255)related_account_name: varchar(50)related_account_firstname: varchar(50)related_account_email: varchar(100)author_account_name: varchar(50)author_account_firstname: varchar(50)author_account_email: varchar(100)player_rapports_types_name: varchar(255)view_rapportsauthor_role: intid: inttitle: textcontent: longtexttime: timestampvisibility: jsonrapporttype: intauthor_name: varchar(50)author_firstname: varchar(50)author: varchar(100)branch: varchar(100)code: varchar(100)view_rapportypeid: inttitle: textcontent: longtexttime: timestampvisibility: jsonrapporttype: inttheme_name: texttheme_accessibility: jsontheme_relation: textauthor: varchar(100)branch: varchar(100)code: varchar(100)view_stock_associationsid: intorthoName: textregistryLinked: textparseDetails: jsonregistry_name: textlang_name: textimage_name: textcraftway: textview_stock_logsid: intrelatedType: textaction: textquantity: textmaterial: textdetails: textlocation: textorthoName: textregistryLinked: textparseDetails: jsonregistry_name: textlang_name: textimage_name: textcraftway: textview_ticketsauthor_role: intindex: bigint unsignedobject: textcontent: textimpact: textlocation: textdate: timestampstate: intauthor_name: varchar(50)author_firstname: varchar(50)author: varchar(255)writertitle: textcontent: textiteration: intid: bigint unsigneddigit: varchar(8)author: varchar(200)role:idauthor:emailscp:namerelatedPlayer:idcreatedBy:idrapporttype:idauthor:emailrole_id:idplayer_rapports_types_id:id

Chacune de ses table a donc été réimplémentée dans Sequelize. Par exemple :

const { DataTypes, Model} = require('sequelize'); module.exports.Mail = class Mail extends Model {} module.exports.load = (db) => { module.exports.Mail.init({ id: { type: DataTypes.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true }, from: { type: DataTypes.JSON, allowNull: true }, bcc: { type: DataTypes.JSON, allowNull: true }, to: { type: DataTypes.JSON, allowNull: true }, subject: { type: DataTypes.STRING, allowNull: true }, object: { type: DataTypes.STRING, allowNull: true }, date: { type: DataTypes.DATE, allowNull: true }, read: { type: DataTypes.JSON, allowNull: true }, accusrecept: { type: DataTypes.JSON, allowNull: true }, replyto: { type: DataTypes.STRING, allowNull: true }, deletedfor: { type: DataTypes.JSON, allowNull: true }, }, { sequelize: db, modelName: 'mails', timestamps: false, freezeTableName: true }) }

Il est donc possible ensuite possible d'intéragir avec l'objet en question ainsi :

await Mail.findAll();

Vue : ExpressLayouts & EJS Ejs

La partie rendu web est intégrée au projet (c'est l'une prévision future, passer sous React ou VueJS). Il a été prit la décision d'utiliser la librairie ExpressLayout pour se baser sur un layout principal (avec la barre de navigation, les boutons d'accès au profil ainsi que les feuilles de style.) Les informations dynamiques sont rendues via EJS, qui a une grande ressemblance à PHP pour l'intégration à l'HTML. Les informations et données plus complexes sont elles rendues par du JavaScript (couplé à JQuery) et interfacée via une API.

Le SCPiNet est également basé sur une version modifiée de Bootstrap pour un style plus "simple" à gérer.

database.png
(on peut voir ici l'utilisation des cartes de bootstrap, ainsi que les badges…)

Last modified: 23 janvier 2025