This repository has been archived on 2024-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
musicapp/models/Tracks.moon
2019-06-14 17:39:51 -07:00

41 lines
891 B
Plaintext

import Model, enum from require "lapis.db.model"
class Tracks extends Model
next: =>
return Tracks\select("WHERE id > ? ORDER BY id ASC LIMIT 1", @id)[1]
previous: =>
return Tracks\select("WHERE id < ? ORDER BY id DESC LIMIT 1", @id)[1]
@statuses: enum {
new: 1 -- needs to be checked out / downloaded / bought
downloaded: 2 -- illegal
owned: 3 -- legal!
invalid: 4 -- needs to be deleted
ignored: 5 -- don't want it
imported: 6 -- needs to be checked out
}
@qualities: enum {
unavailable: 1 -- not in library
lossless: 2
high: 3
acceptable: 4
low: 5
unacceptable: 6
}
@fields = {
id: true
artist: true
title: true
link: true
status: true
art_url: true
file_url: true
file_size: true
album: true
genre: true
tags: true
quality: true
mood: true
}