REPORT de la branche 1.1 : 477->494
[euphorik.git] / modules / include / euphorik_bd.hrl
1 % coding: utf-8
2 % Copyright 2008 Grégory Burri
3 %
4 % This file is part of Euphorik.
5 %
6 % Euphorik is free software: you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation, either version 3 of the License, or
9 % (at your option) any later version.
10 %
11 % Euphorik is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 % GNU General Public License for more details.
15 %
16 % You should have received a copy of the GNU General Public License
17 % along with Euphorik.  If not, see <http://www.gnu.org/licenses/>.
18 %
19 % @author GBurri
20
21
22 % Version de la BD
23 -define(VERSION_BD, 3).
24 -define(TABLES, [counter, proprietes, minichat, reponse_minichat, user, ip_table, troll]).
25
26
27 % Pour générer des id
28 -record(counter,
29    {
30       key,
31       value
32    }).
33    
34    
35 % Mémorse toutes les propriétés, entre autre la version des données
36 -record(proprietes,
37    {
38       nom,
39       valeur
40    }).
41
42
43 % Contient tous les textes que peut envoyer le serveur vers client.
44 -record(texte,
45    {
46       id,
47       fr
48    }).
49
50
51 % décrit un enregistrement d'un message
52 -record(minichat,
53    {
54       id, % integer
55       auteur_id, % -> #user.id
56       date, % erlang:now()
57       pseudo, % chaine de caractère
58       contenu, % chaine de caractère
59       racine_id = undefined % la racine, par défaut correspond à l'id du message
60       status = normal % can be equal to normal, censored or deleted
61    }).
62    
63    
64 % type bag
65 % 'repondant' repond à 'cible'
66 -record(reponse_minichat,
67    {
68       repondant, % -> #minichat.id
69       cible % -> #minichat.id
70    }). 
71
72
73 -record(profile, % attention : pas une table !
74    {
75       pseudo = [], % string()
76       email = [], % string()
77       css = [], % string()
78       nick_format = nick, %atom(), peut valoir 'nick', 'login' ou 'nick_login'
79       view_times = true,
80       view_tooltips = true,
81       ostentatious_master = light, % peut valoir invisible, light ou heavy. seulement pour ek_master
82       chat_order = reverse, % peut valoir chrono ou reverse
83       conversations = [] % [{integer(), bool}], la liste des messages correspondant au conversation {racine, reduite?}
84    }).\r
85    \r
86    
87 -record(user,
88    {
89       id,
90       cookie, % string()
91       login = [], % string()
92       password = [], % string() (md5)
93       profile = #profile{},
94       date_creation, % erlang:now()
95       date_derniere_connexion, % erlang:now(), est mis à jour lors de n'importe quelle activitée (envoie de message par exemple)
96       indice_flood = 0, % integer() est incrémenté lorsque l'utilisateur envoie trop rapidement des messages.
97       ek_master = false,
98       last_ip = undefined % integer(), undefined si inconnu
99    }).
100
101
102 % identificateur : (ip)
103 -record(ip_table,
104    {
105       ip, % {integer(), integer(), integer(), integer()}
106       ban = undefined, % la date du dernier bannissement
107       ban_duration = 0, % le temps de ban en minute
108       nb_try_register = 0,
109       nb_try_login = 0, % pour l'instant pas utilisé
110       date_last_try_register,
111       date_last_try_login % pour l'instant pas utilisé
112    }).
113    
114    
115 -record(troll,
116    {
117       id,
118       id_user,\r
119       id_minichat = undefined, % l'id du message associé
120       date_create, % erlang:now()
121       date_post = undefined, % date à laquelle le troll est affiché sur la page principale. undefined initialement puis erlang:now() quand affiché
122       content % chaine de caractère
123    }).
124