mirror of
https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare.git
synced 2025-02-11 09:10:51 +01:00
* filtering publications with inactive publishers * filtering publications with inactive publishers * WIP: Generate publications at runtime. TODO: - change `MobilizonEvent.compute_status`'s contract and break everything - while we're at it we should remove `PublicationStatus.WAITING` - test `storage.query.create_publications_for_publishers` * cli: inspect_events: Unnest if-then-else. * publishers: abstract: Remove `EventPublication.make`. * fixed tests * split query.py file * added tests for get_unpublished_events * added tests * more tests * added start test * main: start: Remove filter_publications_with_inactive_publishers. Co-authored-by: Giacomo Leidi <goodoldpaul@autistici.org>
30 lines
736 B
Python
30 lines
736 B
Python
from enum import IntEnum
|
|
|
|
from tortoise import fields
|
|
from tortoise.models import Model
|
|
|
|
|
|
class PublicationStatus(IntEnum):
|
|
UNSAVED = 0
|
|
FAILED = 1
|
|
COMPLETED = 2
|
|
|
|
|
|
class Publication(Model):
|
|
id = fields.UUIDField(pk=True)
|
|
status = fields.IntEnumField(PublicationStatus)
|
|
|
|
# When a Publication's status is WAITING
|
|
# we don't need a timestamp nor a reason
|
|
timestamp = fields.DatetimeField(null=True)
|
|
reason = fields.TextField(null=True)
|
|
|
|
event = fields.ForeignKeyField("models.Event", related_name="publications")
|
|
publisher = fields.ForeignKeyField("models.Publisher", related_name="publications")
|
|
|
|
def __str__(self):
|
|
return f"{self.id}"
|
|
|
|
class Meta:
|
|
table = "publication"
|