│ ├── Character.php
│ ├── Unit.php
│ ├── Member.php
│ ├── Event.php
│ └── Log.php
│ ├── users/ # 各ユーザーごとのディレクトリ
│ │ ├── users.json # ユーザ情報の管理用ファイル
│ │ ├── user_abc123user_{uid}/ # ユーザごとの個別データ
│ │ │ ├── characters.json
│ │ │ ├── units.json
│ │ │ ├── user_events.json # 一般アカウント用イベントデータ
│ │ │ ├── character_log.json
│ │ │ ├── invites.json
│ │ │ └── unit_log.json
│ │ └── ...
*members(メンバー):
**character_id(キャラクターID)※
**owner_gid:キャラクター保有アカウントのgid
**position(役職):役職(フリーテキスト)
**level(レベル):スキルlevel(数字入力)**status:承認状況*AL(平均レベル):技能の平均レベル(数字入力)
*leader_id(リーダー):リーダーキャラID(メンバーから選択)
*creator(ユニット作成者):ユニット作成者のアカウントID
*works_list.json:ワークス名一覧
*local_list.json:地方名一覧
=テストしたAPI=
==①―A アカウントA登録 & cookie保存==
curl -X POST http://localhost/api/user/register \
-H "Content-Type: application/json" \
-d '{"display":"ユーザA","id":"userA","pass":"passA"}' \
-c cookieA.txt
==①―B アカウントB登録==
curl -X POST http://localhost/api/user/register \
-H "Content-Type: application/json" \
-d '{"display":"ユーザB","id":"userB","pass":"passB"}' \
-c cookieB.txt
==② アカウントAでログイン==
curl -X POST http://localhost/api/user/login \
-H "Content-Type: application/json" \
-d '{"id":"userA","pass":"passA"}' \
-b cookieA.txt -c cookieA.txt
==③ キャラA作成 & ユニット作成==
===キャラA===
curl -X POST http://localhost/api/char/create \
-H "Content-Type: application/json" \
-b cookieA.txt -c cookieA.txt \
-d '{"name":"キャラA","sheetUrl":"https://sheet/a","description":"Aのキャラ","tags":"test"}'
# 返り値の "id" を控える → 例: CHAR_A_ID
===ユニットA===
curl -X POST http://localhost/api/unit/create \
-H "Content-Type: application/json" \
-b cookieA.txt -c cookieA.txt \
-d '{"name":"ユニットA","description":"テストユニット"}'
# 返り値の "id" を控える → 例: UNIT_ID
==④ アカウントBでログイン & キャラB作成==
curl -X POST http://localhost/api/user/login \
-H "Content-Type: application/json" \
-d '{"id":"userB","pass":"passB"}' \
-b cookieB.txt -c cookieB.txt
curl -X POST http://localhost/api/char/create \
-H "Content-Type: application/json" \
-b cookieB.txt -c cookieB.txt \
-d '{"name":"キャラB","sheetUrl":"https://sheet/b","description":"Bのキャラ","tags":"test"}'
# 返り値 "id" → CHAR_B_ID
==⑤ アカウントAでユニットに自キャラA即時追加==
(招待を経由しないパターン確認)
curl -X POST http://localhost/api/member/invite \
-H "Content-Type: application/json" \
-b cookieA.txt -c cookieA.txt \
-d '{"unitOwnerGid":"9139e4d21e497f51",
"unitId":"1890fa5d",
"charOwnerGid":"9139e4d21e497f51",
"charId":"b944034b"}'
==⑥ アカウントA → アカウントB キャラBを招待==
curl -X POST http://localhost/api/member/invite \
-H "Content-Type: application/json" \
-b cookieA.txt -c cookieA.txt \
-d '{"unitOwnerGid":"9139e4d21e497f51",
"unitId":"1890fa5d",
"charOwnerGid":"2f11472dba7fc9a7",
"charId":"f2de295c"}'
==⑦ アカウントBで招待承認==
curl -X GET http://localhost/api/member/invites \
-b cookieB.txt
curl -X POST http://localhost/api/member/accept \
-H "Content-Type: application/json" \
-b cookieB.txt -c cookieB.txt \
-d '{"unitOwnerGid":"9139e4d21e497f51",
"unitId":"1890fa5d",
"charOwnerGid":"2f11472dba7fc9a7",
"charId":"f2de295c"}'
==⑧ 最終確認:ユニット詳細 & キャラ所属確認==
===ユニットAには2キャラ入ってAL計算されている?===
curl -X GET "http://localhost/api/unit/detail?gid=9139e4d21e497f51&unitId=1890fa5d" -b cookieB.txt -c cookieB.txt
===キャラBに unit_memberships が反映されている?===
curl -X GET "http://localhost/api/character/detail?gid=2f11472dba7fc9a7&charId=f2de295c" -b cookieB.txt -c cookieB.txt
==今後ためす==
curl -X POST http://localhost/api/unit/delete \
-H "Content-Type: application/json" \
-b cookie.txt \
-d '{
"id": "ユニットID"
}'
curl -X POST http://localhost/api/user/delete -b cookie.txt -c cookie.txt