2020-04-30 14:54:05 +01:00
|
|
|
from fireo.models import Model
|
|
|
|
from fireo.fields import TextField, DateTime, NumberField, ListField
|
2020-02-03 09:44:33 +00:00
|
|
|
|
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
class Tag(Model):
|
|
|
|
class Meta:
|
|
|
|
collection_name = 'tags'
|
2020-02-03 09:44:33 +00:00
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
tag_id = TextField(required=True)
|
|
|
|
name = TextField(required=True)
|
|
|
|
username = TextField(required=True)
|
2020-02-03 09:44:33 +00:00
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
tracks = ListField(default=[])
|
|
|
|
albums = ListField(default=[])
|
|
|
|
artists = ListField(default=[])
|
2020-02-03 09:44:33 +00:00
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
count = NumberField(default=0)
|
|
|
|
proportion = NumberField(default=0)
|
|
|
|
total_user_scrobbles = NumberField(default=0)
|
2020-02-03 09:44:33 +00:00
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
last_updated = DateTime()
|
2020-02-03 09:44:33 +00:00
|
|
|
|
|
|
|
def to_dict(self):
|
2020-04-30 14:54:05 +01:00
|
|
|
to_return = super().to_dict()
|
2020-02-03 09:44:33 +00:00
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
# remove unnecessary and sensitive fields
|
|
|
|
to_return.pop('id', None)
|
|
|
|
to_return.pop('key', None)
|
2020-02-03 09:44:33 +00:00
|
|
|
|
2020-04-30 14:54:05 +01:00
|
|
|
return to_return
|