 //
 //
 
+import Foundation
 import Vapor
-import Foundation
+import FluentMySQL
+import HTTP
+import Fluent
 import TurnstileCrypto
 
 final class User: Model {

    }
    
    func makeNode(context: Context) throws -> Node {
        return try Node(node: [
            "id": id,
            "access_token": accessToken,
            "dribbble_id": dribbbleId,
            "dribbble_username": dribbbleUsername,
            "dribbble_url": dribbbleUrl,
            "dribbble_access_token": dribbbleAccessToken,
            "avatar_url": avatarUrl,
            "location": location,
            "website": website,
            "twitter": twitter,
            "followers_count": followersCount,
            "following_count": followingCount,
            "consented": consented,
            "created_at": createdAt,
            ])
    }
    
    static func prepare(_ database: Database) throws {

            
        case let accessToken as DribbbleAccessToken:
            
            let response = try Dribbble.getUserData(token: accessToken.string)
            
            guard let dribbId = response.data["id"]?.int,
                let dribbUsername = response.data["username"]?.string,
