caTUstrophy / backend

Backend part for our catastrophe aid tool. Written in Go.
GNU General Public License v3.0
6 stars 3 forks source link

GET /me has PhoneNumbers with null instead of empty array #76

Closed neopostmodern closed 8 years ago

neopostmodern commented 8 years ago

As admin@example.org I did GET /me and got:

{
    "Groups": [
        {
            "ID": "8afdbde0-106f-4f56-8326-b099b13873f6",
            "Permissions": [
                {
                    "AccessRight": "superadmin"
                }
            ]
        },
        {
            "ID": "41e179b5-9a95-48ba-b435-90d70d410fff",
            "Permissions": [
                {
                    "AccessRight": "admin"
                }
            ]
        }
    ],
    "ID": "fccc2891-c7a7-4b85-8f58-fcb9d842201a",
    "Mail": "admin@example.org",
    "MailVerified": false,
    "Name": "admin",
    "PhoneNumbers": null,
    "PreferredName": "The Boss Around Here"
}

But it should be "PhoneNumbers": []!

neopostmodern commented 8 years ago

Maybe related, server log on POST

(...caTUstrophy/backend/endpoints-users.go:76) 
[2016-06-24 14:53:48]  [2.79ms]  SELECT count(*) FROM "users"  WHERE (mail = 'hyper@example.org')

(...caTUstrophy/backend/endpoints-users.go:119) 
[2016-06-24 14:53:48]  [0.90ms]  SELECT * FROM "groups"  WHERE (default_group = 'true') ORDER BY "groups"."id" ASC LIMIT 1

(...caTUstrophy/backend/endpoints-users.go:119) 
[2016-06-24 14:53:48]  [0.79ms]  SELECT * FROM "permissions" INNER JOIN "group_permissions" ON "group_permissions"."permission_id" = "permissions"."id" WHERE ("group_permissions"."group_id" IN ('172badef-dc97-4183-9e6d-88fdf59ecb3a'))

(...caTUstrophy/backend/endpoints-users.go:126) 
[2016-06-24 14:53:48]  pq: column "phone_numbers" of relation "users" does not exist 

(...caTUstrophy/backend/endpoints-users.go:126) 
[2016-06-24 14:53:48]  [0.68ms]  INSERT INTO "users" ("id","name","preferred_name","mail","mail_verified","phone_numbers","password_hash","enabled") VALUES ('ae06c36d-51ca-473d-abe6-dc6036605cb8','Hyper','','hyper@example.org','false','["+49 30 123123"]','$2a$10$mOUBN270e474/p.fofqv4.bUu2m4dwtG06t.nJ4ZkdZYw1IfLFEVK','true') RETURNING "users"."id"
[GIN] 2016/06/24 - 14:53:48 | 200 |   91.436565ms | 127.0.0.1 |   POST    /users

User is not created in database!

numbleroot commented 8 years ago

The last comment was due to not having executed ./backend with the trailing --init flag. Still, there was an error. Next commit will fix it.