2020-02-18 21:43:30 +00:00
|
|
|
//
|
|
|
|
// User.swift
|
2022-08-07 13:31:15 +01:00
|
|
|
// Mixonomer
|
2020-02-18 21:43:30 +00:00
|
|
|
//
|
|
|
|
// Created by Andy Pack on 18/02/2020.
|
|
|
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import SwiftyJSON
|
|
|
|
|
2020-03-06 23:36:51 +00:00
|
|
|
enum UserType: String, Decodable {
|
2020-02-18 21:43:30 +00:00
|
|
|
case user = "user"
|
|
|
|
case admin = "admin"
|
|
|
|
}
|
|
|
|
|
2020-03-06 23:36:51 +00:00
|
|
|
class User: Identifiable, Decodable {
|
2020-02-18 21:43:30 +00:00
|
|
|
|
|
|
|
//MARK: Properties
|
|
|
|
|
|
|
|
var username: String
|
|
|
|
var email: String?
|
|
|
|
var type: UserType
|
|
|
|
|
|
|
|
var last_login: String
|
|
|
|
var spotify_linked: Bool
|
|
|
|
var lastfm_username: String?
|
|
|
|
|
|
|
|
//MARK: Initialization
|
|
|
|
|
|
|
|
init(username: String,
|
|
|
|
email: String?,
|
|
|
|
type: UserType = .user,
|
|
|
|
|
|
|
|
last_login: String,
|
|
|
|
spotify_linked: Bool,
|
|
|
|
lastfm_username: String?){
|
|
|
|
|
|
|
|
self.username = username
|
|
|
|
self.email = email
|
|
|
|
self.type = type
|
|
|
|
|
|
|
|
self.last_login = last_login
|
|
|
|
self.spotify_linked = spotify_linked
|
|
|
|
self.lastfm_username = lastfm_username
|
2020-03-06 23:36:51 +00:00
|
|
|
}
|
2020-02-18 21:43:30 +00:00
|
|
|
}
|
|
|
|
|