TrackerNetwork / DestinyStatus

Destiny Status code base
https://destinystatus.com
MIT License
101 stars 29 forks source link

hasMany accounts #92

Closed iBotPeaches closed 7 years ago

iBotPeaches commented 7 years ago

During my development, I made Bungie object as hasOne to Accounts. However, signing in with my account now yields

{
    "Response": {
        "destinyMemberships": [{
            "iconPath": "/img/theme/destiny/icons/icon_xbl.png",
            "membershipType": 1,
            "membershipId": "4611686018430553461",
            "displayName": "iBot"
        }, {
            "iconPath": "",
            "membershipType": 4,
            "membershipId": "4611686018467388682",
            "displayName": "iBot#11125"
        }],
        "bungieNetUser": {
            "membershipId": "3836713",
            "uniqueName": "iBotPeachess",
            "displayName": "iBotPeaches",
            "profilePicture": 70521,
            "profileTheme": 18,
            "userTitle": 0,
            "successMessageFlags": "59",
            "isDeleted": false,
            "about": "112346535434889804882",
            "firstAccess": "2013-01-14T00:55:14.413Z",
            "lastUpdate": "2017-08-29T12:37:06.577Z",
            "context": {
                "isFollowing": false,
                "ignoreStatus": {
                    "isIgnored": false,
                    "ignoreFlags": 0
                }
            },
            "xboxDisplayName": "iBot",
            "showActivity": true,
            "locale": "en",
            "localeInheritDefault": true,
            "showGroupMessaging": true,
            "profilePicturePath": "/img/profile/avatars/themaestro.jpg",
            "profileThemeName": "d2cover",
            "userTitleDisplay": "Newbie",
            "statusText": "ed2385b1",
            "statusDate": "2016-06-05T11:29:09.424Z",
            "blizzardDisplayName": "BT160523"
        }
    },
    "ErrorCode": 1,
    "ThrottleSeconds": 0,
    "ErrorStatus": "Success",
    "Message": "Ok",
    "MessageData": {}
}

Which is 2 destiny accounts. Our system only processes the first, so lets drop account_id from Bungie and add bungie_id to accounts table. It has to be nullable, since that table is being processed and filled by the D1 site as well.

If a sync (sign in) happens, associate and move on.