From: Fam Zheng <famz@redhat.com>
Every user can have a record in WatchedQuery. The query in this record
is going to be run against every new series, and if matched, the patches
will be added to the 'watched' queue, making this the 3rd specially
purposed queue.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
api/migrations/0044_watchedquery.py | 26 ++++++++++++++++++++++++++
api/models.py | 6 ++++++
2 files changed, 32 insertions(+)
create mode 100644 api/migrations/0044_watchedquery.py
diff --git a/api/migrations/0044_watchedquery.py b/api/migrations/0044_watchedquery.py
new file mode 100644
index 0000000..6568c13
--- /dev/null
+++ b/api/migrations/0044_watchedquery.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.16 on 2018-11-28 13:25
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('api', '0043_auto_20181120_0636'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='WatchedQuery',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('query', models.TextField(help_text='Watched query')),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='watched_queries', to=settings.AUTH_USER_MODEL)),
+ ],
+ ),
+ ]
diff --git a/api/models.py b/api/models.py
index c2cd2ac..e56f059 100644
--- a/api/models.py
+++ b/api/models.py
@@ -442,6 +442,7 @@ class Queue(models.Model):
# Special purposed queues:
# accept: When user marked series as "accepted"
# reject: When user marked series as "rejected"
+ # watched: When a series matches user's watched query
name = models.CharField(max_length=1024, help_text="Name of the queue")
class Meta:
@@ -767,3 +768,8 @@ class Module(models.Model):
def __str__(self):
return self.name
+
+class WatchedQuery(models.Model):
+ """ User watched query """
+ user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='watched_queries')
+ query = models.TextField(blank=False, help_text="Watched query")
--
2.17.2
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel