54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
"""
|
|
System module serializers
|
|
"""
|
|
from rest_framework import serializers
|
|
from .models import AIPrompt, AuthorProfile, Strategy
|
|
|
|
|
|
class AIPromptSerializer(serializers.ModelSerializer):
|
|
"""Serializer for AI Prompts"""
|
|
|
|
prompt_type_display = serializers.CharField(source='get_prompt_type_display', read_only=True)
|
|
|
|
class Meta:
|
|
model = AIPrompt
|
|
fields = [
|
|
'id',
|
|
'prompt_type',
|
|
'prompt_type_display',
|
|
'prompt_value',
|
|
'default_prompt',
|
|
'is_active',
|
|
'updated_at',
|
|
'created_at',
|
|
]
|
|
read_only_fields = ['id', 'created_at', 'updated_at', 'default_prompt']
|
|
|
|
|
|
class AuthorProfileSerializer(serializers.ModelSerializer):
|
|
"""Serializer for AuthorProfile"""
|
|
|
|
class Meta:
|
|
model = AuthorProfile
|
|
fields = [
|
|
'id', 'name', 'description', 'tone', 'language',
|
|
'structure_template', 'is_active',
|
|
'created_at', 'updated_at'
|
|
]
|
|
read_only_fields = ['id', 'created_at', 'updated_at']
|
|
|
|
|
|
class StrategySerializer(serializers.ModelSerializer):
|
|
"""Serializer for Strategy"""
|
|
sector_name = serializers.CharField(source='sector.name', read_only=True)
|
|
|
|
class Meta:
|
|
model = Strategy
|
|
fields = [
|
|
'id', 'name', 'description', 'sector', 'sector_name',
|
|
'prompt_types', 'section_logic', 'is_active',
|
|
'created_at', 'updated_at'
|
|
]
|
|
read_only_fields = ['id', 'created_at', 'updated_at']
|
|
|