mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-21 02:03:14 +00:00
feat(api/db); add hash_id order field (#763)
This commit is contained in:
@ -263,7 +263,6 @@ class OrderAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
|
|||||||
order.status in [Order.Status.DIS, Order.Status.WFR]
|
order.status in [Order.Status.DIS, Order.Status.WFR]
|
||||||
and order.is_disputed
|
and order.is_disputed
|
||||||
):
|
):
|
||||||
|
|
||||||
order.maker.robot.earned_rewards = order.maker_bond.num_satoshis
|
order.maker.robot.earned_rewards = order.maker_bond.num_satoshis
|
||||||
order.maker.robot.save(update_fields=["earned_rewards"])
|
order.maker.robot.save(update_fields=["earned_rewards"])
|
||||||
order.taker.robot.earned_rewards = order.taker_bond.num_satoshis
|
order.taker.robot.earned_rewards = order.taker_bond.num_satoshis
|
||||||
@ -421,7 +420,7 @@ class UserRobotAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
|
|||||||
change_links = ["user"]
|
change_links = ["user"]
|
||||||
readonly_fields = ["avatar_tag"]
|
readonly_fields = ["avatar_tag"]
|
||||||
search_fields = ["user__username", "id"]
|
search_fields = ["user__username", "id"]
|
||||||
readonly_fields = ("public_key", "encrypted_private_key")
|
readonly_fields = ("hash_id", "public_key", "encrypted_private_key")
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Currency)
|
@admin.register(Currency)
|
||||||
|
19
api/migrations/0040_robot_hash_id.py
Normal file
19
api/migrations/0040_robot_hash_id.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 4.2.2 on 2023-07-18 17:15
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("api", "0039_alter_currency_currency"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="robot",
|
||||||
|
name="hash_id",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, default=None, max_length=64, null=True, unique=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
@ -12,6 +12,15 @@ from django.utils.html import mark_safe
|
|||||||
class Robot(models.Model):
|
class Robot(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
# Hash id (second sha256 of robot token)
|
||||||
|
hash_id = models.CharField(
|
||||||
|
max_length=64,
|
||||||
|
unique=True,
|
||||||
|
default=None,
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
)
|
||||||
|
|
||||||
# PGP keys, used for E2E chat encryption. Priv key is encrypted with user's passphrase (highEntropyToken)
|
# PGP keys, used for E2E chat encryption. Priv key is encrypted with user's passphrase (highEntropyToken)
|
||||||
public_key = models.TextField(
|
public_key = models.TextField(
|
||||||
# Actually only 400-500 characters for ECC, but other types might be longer
|
# Actually only 400-500 characters for ECC, but other types might be longer
|
||||||
|
Reference in New Issue
Block a user