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