mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-08 11:04:43 +00:00
Migration
This commit is contained in:
30
api/migrations/0047_notification.py
Normal file
30
api/migrations/0047_notification.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Generated by Django 5.0.6 on 2024-06-09 10:21
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0046_alter_currency_currency'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Notification',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('reference', models.UUIDField(default=uuid.uuid4, editable=False)),
|
||||||
|
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
|
||||||
|
('title', models.CharField(default=None, max_length=120)),
|
||||||
|
('description', models.CharField(blank=True, default=None, max_length=120)),
|
||||||
|
('order', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='api.order')),
|
||||||
|
('user', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -4,5 +4,14 @@ from .market_tick import MarketTick
|
|||||||
from .onchain_payment import OnchainPayment
|
from .onchain_payment import OnchainPayment
|
||||||
from .order import Order
|
from .order import Order
|
||||||
from .robot import Robot
|
from .robot import Robot
|
||||||
|
from .notification import Notification
|
||||||
|
|
||||||
__all__ = ["Currency", "LNPayment", "MarketTick", "OnchainPayment", "Order", "Robot"]
|
__all__ = [
|
||||||
|
"Currency",
|
||||||
|
"LNPayment",
|
||||||
|
"MarketTick",
|
||||||
|
"OnchainPayment",
|
||||||
|
"Order",
|
||||||
|
"Robot",
|
||||||
|
"Notification",
|
||||||
|
]
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decouple import config
|
from decouple import config
|
||||||
from django.contrib.auth.models import User, Order
|
from django.contrib.auth.models import User
|
||||||
|
from api.models import Order
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
@ -25,8 +26,8 @@ class Notification(models.Model):
|
|||||||
reference = models.UUIDField(default=custom_uuid, editable=False)
|
reference = models.UUIDField(default=custom_uuid, editable=False)
|
||||||
created_at = models.DateTimeField(default=timezone.now)
|
created_at = models.DateTimeField(default=timezone.now)
|
||||||
|
|
||||||
user = models.ForeignKey(User, on_delete=models.SET_NULL, default=None)
|
user = models.ForeignKey(User, on_delete=models.CASCADE, default=None)
|
||||||
order = models.ForeignKey(Order, on_delete=models.SET_NULL, default=None)
|
order = models.ForeignKey(Order, on_delete=models.CASCADE, default=None)
|
||||||
|
|
||||||
# notification details
|
# notification details
|
||||||
title = models.CharField(max_length=120, null=False, default=None)
|
title = models.CharField(max_length=120, null=False, default=None)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
from secrets import token_urlsafe
|
from secrets import token_urlsafe
|
||||||
|
|
||||||
from decouple import config
|
from decouple import config
|
||||||
|
from api.models import (
|
||||||
from api.models import Order
|
Order,
|
||||||
from api.models import Notification
|
Notification,
|
||||||
|
)
|
||||||
from api.utils import get_session
|
from api.utils import get_session
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user