From cff605bcfb12a5dd275537323bc9ea16a23aa1b2 Mon Sep 17 00:00:00 2001
From: meskio <meskio@sindominio.net>
Date: Sun, 11 Oct 2020 14:19:35 +0200
Subject: [PATCH] Add phone number to members

---
 api/member.go     | 1 +
 setup.sh          | 4 ++--
 src/MemberList.js | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/api/member.go b/api/member.go
index e52b327..353e92d 100644
--- a/api/member.go
+++ b/api/member.go
@@ -16,6 +16,7 @@ type Member struct {
 	Num        int    `json:"num" gorm:"unique;index"`
 	Name       string `json:"name" gorm:"unique;index"`
 	Email      string `json:"email"`
+	Phone      string `json:"phone"`
 	Balance    int    `json:"balance"`
 	Role       string `json:"role"`
 	PassHash   []byte `json:"-"`
diff --git a/setup.sh b/setup.sh
index 1214cc9..abace7d 100755
--- a/setup.sh
+++ b/setup.sh
@@ -4,8 +4,8 @@ TOKEN="$1"
 ADDR="localhost:8080"
 
 # set up members
-curl -H "x-authentication: $TOKEN" -X "POST" -d '{"num": 900, "name": "admin", "email": "admin@example.com", "password": "admin", "role": "admin", "balance": 10000}' $ADDR/api/member
-curl -H "x-authentication: $TOKEN" -X "POST" -d '{"num": 901, "name": "socia", "email": "socia@example.com", "password": "socia", "balance": 10000}' $ADDR/api/member
+curl -H "x-authentication: $TOKEN" -X "POST" -d '{"num": 900, "name": "admin", "email": "admin@example.com", "phone": "654321123", "password": "admin", "role": "admin", "balance": 10000}' $ADDR/api/member
+curl -H "x-authentication: $TOKEN" -X "POST" -d '{"num": 901, "name": "socia", "email": "socia@example.com", "phone": "678900123", "password": "socia", "balance": 10000}' $ADDR/api/member
 
 # set up products
 curl -H "x-authentication: $TOKEN" -X "POST" -d '{"code": 234, "name": "aceite", "price": 1700, "stock": 35}' $ADDR/api/product
diff --git a/src/MemberList.js b/src/MemberList.js
index 7300c02..ebd52ee 100644
--- a/src/MemberList.js
+++ b/src/MemberList.js
@@ -18,6 +18,7 @@ class MemberList extends React.Component {
           <td>{member.num}</td>
           <td>{member.name}</td>
           <td>{member.email}</td>
+          <td>{member.phone}</td>
           <td>{printMoney(member.balance)} €</td>
         </tr>
       );
@@ -34,6 +35,7 @@ class MemberList extends React.Component {
               <th>Numero</th>
               <th>Nombre</th>
               <th>Email</th>
+              <th>Telefono</th>
               <th>Saldo</th>
             </tr>
           </thead>
-- 
GitLab