price calvulation

This commit is contained in:
2025-10-20 14:07:36 +03:30
parent 169617d8a3
commit 7c27712962
8 changed files with 65 additions and 8 deletions

View File

@@ -11,14 +11,14 @@ DB_NAME=Development
DB_USERNAME=postgres
DB_PASSWORD=pfLIVXupbDetvFMt2gUvxLXUL9b4HIOHaPcKXsBEZ1i8zl0iLUjmhUfXlGfJKcTV
ENV RUNNING_IN_DOCKER=
RUNNING_IN_DOCKER=0
CORS_ALLOWED_ORIGINS=http://localhost:8080,http://127.0.0.1:8080,http://127.0.0.1:3000,http://localhost:3000,http://192.168.88.130:3000,https://rasadyar.net,https://rasaddam-front.liara.run,https://dam.rasadyar.net,https://api.dam.rasadyar.com
REDIS_URL=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0
REDIS_URL=redis://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0
CELERY_BROKER_URL=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0
CELERY_RESULT_BACKEND=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0
CELERY_BROKER_URL=redis://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0
CELERY_RESULT_BACKEND=redis://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0
CELERY_CACHE_BACKEND=default
# Super user information

6
.idea/copilot.data.migration.agent.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

6
.idea/copilot.data.migration.ask.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AskMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

6
.idea/copilot.data.migration.edit.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EditMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

18
.idea/material_theme_project_new.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="5c10bf93:1969ffaa17c:-8000" />
<option name="version" value="6.16.2" />
</MTProjectMetadataState>
</option>
<option name="titleBarState">
<MTProjectTitleBarConfigState>
<option name="overrideColor" value="false" />
</MTProjectTitleBarConfigState>
</option>
</component>
</project>

3
.idea/misc.xml generated
View File

@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.10 (env)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (env)" project-jdk-type="Python SDK" />
</project>

View File

@@ -1,9 +1,8 @@
from apps.authentication.api.v1.serializers.serializer import OrganizationSerializer
from apps.authorization.api.v1 import serializers as authorize_serializers
from apps.product.web.api.v1.serializers import product_serializers
from rest_framework import serializers
from apps.livestock.web.api.v1.serializers import LiveStockTypeSerializer
from apps.product import models as product_models
from rest_framework import serializers
from apps.product.web.api.v1.serializers import product_serializers
class QuotaSerializer(serializers.ModelSerializer):
@@ -65,6 +64,19 @@ class QuotaSerializer(serializers.ModelSerializer):
{"name": limit.name, "id": limit.id} for limit in instance.limit_by_organizations.all()
]
# Build a simplified list of pricing items for API output:
# map `pricing_type_id` to `pricing_type` and keep `name` and `value`
items = [
{
"pricing_type": it["pricing_type_id"],
"name": it["name"],
"value": it["value"],
}
for it in instance.pricing_items.values("pricing_type_id", "name", "value")
]
representation["price_calculation_items"] = items
return representation
def update(self, instance, validated_data):