Move user struct to own file, under Invidious namespace

This commit is contained in:
Samantaz Fox
2022-02-04 04:09:07 +01:00
parent fb36155022
commit c04f45d5e3
6 changed files with 34 additions and 33 deletions

View File

@@ -0,0 +1,27 @@
require "db"
struct Invidious::User
include DB::Serializable
property updated : Time
property notifications : Array(String)
property subscriptions : Array(String)
property email : String
@[DB::Field(converter: Invidious::User::PreferencesConverter)]
property preferences : Preferences
property password : String?
property token : String
property watched : Array(String)
property feed_needs_update : Bool?
module PreferencesConverter
def self.from_rs(rs)
begin
Preferences.from_json(rs.read(String))
rescue ex
Preferences.from_json("{}")
end
end
end
end