From 528c6dff03a920e12debda8e3d92710d8c9ccfcf Mon Sep 17 00:00:00 2001
From: Spitfire
Date: Thu, 9 May 2024 13:57:35 -0600
Subject: [PATCH] character trait entries are now parsed
---
app/Http/Resources/CharacterTraitResource.php | 2 ++
resources/api-docs/1.0/characters.md | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/Http/Resources/CharacterTraitResource.php b/app/Http/Resources/CharacterTraitResource.php
index 0af0ca6883..a7e0a29d83 100644
--- a/app/Http/Resources/CharacterTraitResource.php
+++ b/app/Http/Resources/CharacterTraitResource.php
@@ -4,6 +4,7 @@
use App\Models\CharacterTrait;
use Illuminate\Http\Resources\Json\JsonResource;
+use App\Facades\Mentions;
class CharacterTraitResource extends JsonResource
{
@@ -21,6 +22,7 @@ public function toArray($request)
'id' => $resource->id,
'name' => $resource->name,
'entry' => $resource->entry,
+ 'entry_parsed' => $resource->entry ? Mentions::mapAny($resource) : null,
'section_id' => $resource->section_id,
'section' => $resource->section_id == CharacterTrait::SECTION_APPEARANCE ? 'appearance' : 'personality',
//'is_private' => (bool) $this->is_private,
diff --git a/resources/api-docs/1.0/characters.md b/resources/api-docs/1.0/characters.md
index 38c57a4366..1410ded053 100644
--- a/resources/api-docs/1.0/characters.md
+++ b/resources/api-docs/1.0/characters.md
@@ -62,6 +62,8 @@ The list of returned entities can be filtered. The available filters are [availa
"id": 33,
"name": "Goals",
"entry": "Become a Paladin.",
+ "entry": "Become a Paladin before [character:76]",
+ "entry_parsed": "Become a Paladin before Baldur Gates
",
"section": "personality",
"section_id": 1,
"default_order": 0
@@ -116,7 +118,8 @@ To get the details of a single character, use the following endpoint.
{
"id": 33,
"name": "Goals",
- "entry": "Become a Paladin.",
+ "entry": "Become a Paladin before [character:76]",
+ "entry_parsed": "Become a Paladin before Baldur Gates",
"section": "personality",
"section_id": 1,
"is_private": false,