mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: add user management viewset and sync module to API routes
This commit is contained in:
31
sync/models.py
Normal file
31
sync/models.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from django.db import models
|
||||
|
||||
class ChangeLog(models.Model):
|
||||
MODEL_CHOICES = [
|
||||
('Product', 'Product'),
|
||||
('Comanda', 'Comanda'),
|
||||
('Order', 'Order'),
|
||||
('Client', 'Client'),
|
||||
('Categories', 'Categories'),
|
||||
('Mesa', 'Mesa'),
|
||||
('Payments', 'Payments'),
|
||||
]
|
||||
ACTION_CHOICES = [
|
||||
('SAVE', 'Save'),
|
||||
('DELETE', 'Delete'),
|
||||
]
|
||||
|
||||
model_name = models.CharField(max_length=50, choices=MODEL_CHOICES)
|
||||
object_id = models.IntegerField()
|
||||
action = models.CharField(max_length=10, choices=ACTION_CHOICES)
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ['timestamp']
|
||||
indexes = [
|
||||
models.Index(fields=['timestamp']),
|
||||
models.Index(fields=['model_name', 'object_id']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.model_name} {self.object_id} {self.action} at {self.timestamp}"
|
||||
Reference in New Issue
Block a user