mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 17:17:40 +03:00
Models now have proper types
This commit is contained in:
parent
e46663c438
commit
876154ff7c
@ -13,7 +13,7 @@ from peewee import (
|
||||
from playhouse.sqlite_ext import JSONField
|
||||
|
||||
|
||||
class Event(Model): # type: ignore[misc]
|
||||
class Event(Model):
|
||||
id = CharField(null=False, primary_key=True, max_length=30)
|
||||
label = CharField(index=True, max_length=20)
|
||||
sub_label = CharField(max_length=100, null=True)
|
||||
@ -51,7 +51,7 @@ class Event(Model): # type: ignore[misc]
|
||||
data = JSONField() # ex: tracked object box, region, etc.
|
||||
|
||||
|
||||
class Timeline(Model): # type: ignore[misc]
|
||||
class Timeline(Model):
|
||||
timestamp = DateTimeField()
|
||||
camera = CharField(index=True, max_length=20)
|
||||
source = CharField(index=True, max_length=20) # ex: tracked object, audio, external
|
||||
@ -60,13 +60,13 @@ class Timeline(Model): # type: ignore[misc]
|
||||
data = JSONField() # ex: tracked object id, region, box, etc.
|
||||
|
||||
|
||||
class Regions(Model): # type: ignore[misc]
|
||||
class Regions(Model):
|
||||
camera = CharField(null=False, primary_key=True, max_length=20)
|
||||
grid = JSONField() # json blob of grid
|
||||
last_update = DateTimeField()
|
||||
|
||||
|
||||
class Recordings(Model): # type: ignore[misc]
|
||||
class Recordings(Model):
|
||||
id = CharField(null=False, primary_key=True, max_length=30)
|
||||
camera = CharField(index=True, max_length=20)
|
||||
path = CharField(unique=True)
|
||||
@ -80,7 +80,7 @@ class Recordings(Model): # type: ignore[misc]
|
||||
regions = IntegerField(null=True)
|
||||
|
||||
|
||||
class Export(Model): # type: ignore[misc]
|
||||
class Export(Model):
|
||||
id = CharField(null=False, primary_key=True, max_length=30)
|
||||
camera = CharField(index=True, max_length=20)
|
||||
name = CharField(index=True, max_length=100)
|
||||
@ -90,7 +90,7 @@ class Export(Model): # type: ignore[misc]
|
||||
in_progress = BooleanField()
|
||||
|
||||
|
||||
class ReviewSegment(Model): # type: ignore[misc]
|
||||
class ReviewSegment(Model):
|
||||
id = CharField(null=False, primary_key=True, max_length=30)
|
||||
camera = CharField(index=True, max_length=20)
|
||||
start_time = DateTimeField()
|
||||
@ -100,7 +100,7 @@ class ReviewSegment(Model): # type: ignore[misc]
|
||||
data = JSONField() # additional data about detection like list of labels, zone, areas of significant motion
|
||||
|
||||
|
||||
class UserReviewStatus(Model): # type: ignore[misc]
|
||||
class UserReviewStatus(Model):
|
||||
user_id = CharField(max_length=30)
|
||||
review_segment = ForeignKeyField(ReviewSegment, backref="user_reviews")
|
||||
has_been_reviewed = BooleanField(default=False)
|
||||
@ -109,7 +109,7 @@ class UserReviewStatus(Model): # type: ignore[misc]
|
||||
indexes = ((("user_id", "review_segment"), True),)
|
||||
|
||||
|
||||
class Previews(Model): # type: ignore[misc]
|
||||
class Previews(Model):
|
||||
id = CharField(null=False, primary_key=True, max_length=30)
|
||||
camera = CharField(index=True, max_length=20)
|
||||
path = CharField(unique=True)
|
||||
@ -119,14 +119,14 @@ class Previews(Model): # type: ignore[misc]
|
||||
|
||||
|
||||
# Used for temporary table in record/cleanup.py
|
||||
class RecordingsToDelete(Model): # type: ignore[misc]
|
||||
class RecordingsToDelete(Model):
|
||||
id = CharField(null=False, primary_key=False, max_length=30)
|
||||
|
||||
class Meta:
|
||||
temporary = True
|
||||
|
||||
|
||||
class User(Model): # type: ignore[misc]
|
||||
class User(Model):
|
||||
username = CharField(null=False, primary_key=True, max_length=30)
|
||||
role = CharField(
|
||||
max_length=20,
|
||||
@ -136,7 +136,7 @@ class User(Model): # type: ignore[misc]
|
||||
notification_tokens = JSONField()
|
||||
|
||||
|
||||
class Trigger(Model): # type: ignore[misc]
|
||||
class Trigger(Model):
|
||||
camera = CharField(max_length=20)
|
||||
name = CharField()
|
||||
type = CharField(max_length=10)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user