mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
zerver: Add PushDevice model.
This commit adds a `PushDevice` model where each row corresponds to an account on an install of the app that has attempted to register with the bouncer to receive mobile push notifications. This is the core server table storing registrations that are potentially registered with the mobile push notifications bouncer service.
This commit is contained in:
committed by
Tim Abbott
parent
3c6a3b0d77
commit
6a4b06b6f4
58
zerver/migrations/0730_pushdevice.py
Normal file
58
zerver/migrations/0730_pushdevice.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# Generated by Django 5.2.3 on 2025-07-13 03:14
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("zerver", "0729_externalauthid"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="PushDevice",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
(
|
||||
"token_kind",
|
||||
models.CharField(choices=[("apns", "APNs"), ("fcm", "FCM")], max_length=4),
|
||||
),
|
||||
("push_account_id", models.BigIntegerField()),
|
||||
("push_public_key", models.TextField()),
|
||||
("bouncer_device_id", models.BigIntegerField(null=True)),
|
||||
(
|
||||
"error_code",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("INVALID_BOUNCER_PUBLIC_KEY", "Invalid Bouncer Public Key"),
|
||||
("BAD_REQUEST", "Invalid Encrypted Push Registration"),
|
||||
("REQUEST_EXPIRED", "Request Expired"),
|
||||
],
|
||||
max_length=100,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"constraints": [
|
||||
models.UniqueConstraint(
|
||||
fields=("user", "push_account_id"),
|
||||
name="unique_push_device_user_push_account_id",
|
||||
)
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user