ken_nogi/NodeSrv/apps/org-master-sync/scripts/_tmp-delete-dup-users.js
Kenichiro NOGI ce58cb4be4 初回コミット: dev配下(NodeSrv/Pleasanter等)をGitea管理下に統合
GitHub(nextgroup2706/ken_nogi)は今後使わず自社Gitea運用に切替え。
NodeSrvは旧リポジトリの履歴を破棄しファイルのみ統合(Dokploy用サービスアカウントは
別途mygit-admin/NodeSrv.gitに履歴あり)。notepmエクスポート(12GB)とPleasanter
インストーラzip(208MB)はサイズが大きいため.gitignoreで除外。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 15:37:06 +09:00

24 lines
859 B
JavaScript

async function callApi({ baseUrl, apiKey, pathname, body }) {
const res = await fetch(baseUrl.replace(/\/$/, "") + pathname, {
method: "POST",
headers: { "Content-Type": "application/json; charset=utf-8" },
body: JSON.stringify({ ApiVersion: "1.1", ApiKey: apiKey, ...body }),
});
const data = await res.json();
if (!res.ok || data.StatusCode !== 200) {
throw new Error(`${pathname} failed: ${JSON.stringify(data)}`);
}
return data;
}
async function main() {
const baseUrl = process.env.PLEASANTER_BASE_URL;
const apiKey = process.env.PLEASANTER_API_KEY;
for (const userId of [594, 593]) {
const result = await callApi({ baseUrl, apiKey, pathname: `/api/users/${userId}/delete`, body: {} });
console.log(`UserId ${userId}:`, JSON.stringify(result));
}
}
main().catch(e => { console.error(e); process.exit(1); });