* chore: update onboarding workflow * dev: update user count tasks * fix: forgot password endpoint * dev: instance and onboarding updates * chore: update sign-in workflow for cloud and self-hosted instances (#2993) * chore: updated auth services * chore: new signin workflow updated * chore: updated content * chore: instance admin setup * dev: update instance verification task * dev: run the instance verification task every 4 hours * dev: update migrations * chore: update latest features image --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
# Module imports
|
|
from plane.license.models import Instance, InstanceAdmin, InstanceConfiguration
|
|
from plane.app.serializers import BaseSerializer
|
|
from plane.app.serializers import UserAdminLiteSerializer
|
|
from plane.license.utils.encryption import decrypt_data
|
|
|
|
class InstanceSerializer(BaseSerializer):
|
|
primary_owner_details = UserAdminLiteSerializer(source="primary_owner", read_only=True)
|
|
|
|
class Meta:
|
|
model = Instance
|
|
fields = "__all__"
|
|
read_only_fields = [
|
|
"id",
|
|
"instance_id",
|
|
"license_key",
|
|
"api_key",
|
|
"version",
|
|
"email",
|
|
"last_checked_at",
|
|
"is_setup_done",
|
|
]
|
|
|
|
|
|
class InstanceAdminSerializer(BaseSerializer):
|
|
user_detail = UserAdminLiteSerializer(source="user", read_only=True)
|
|
|
|
class Meta:
|
|
model = InstanceAdmin
|
|
fields = "__all__"
|
|
read_only_fields = [
|
|
"id",
|
|
"instance",
|
|
"user",
|
|
]
|
|
|
|
class InstanceConfigurationSerializer(BaseSerializer):
|
|
|
|
class Meta:
|
|
model = InstanceConfiguration
|
|
fields = "__all__"
|
|
|
|
def to_representation(self, instance):
|
|
data = super().to_representation(instance)
|
|
# Decrypt secrets value
|
|
if instance.is_encrypted and instance.value is not None:
|
|
data["value"] = decrypt_data(instance.value)
|
|
|
|
return data
|