'use strict';
import { apiCreatedResponse, apiOkResponse } from '../../meta/server/web/responses.js';
import { getUserSettingByUserId } from '../users/user-settings/user-setting-db.js';
import { apiNotFoundError } from '../../../fd-toolbox/server/web/errors.js';
import { responseMessages } from '../../../fd-toolbox/server/web/response-messages.js';
import { userSettingProps } from '../../meta/core/resources/users/props/user-setting-props.js';
import { createUserWithSettings, editUser } from '../users/edit-other-users.js';
import { parseJsonBodyFromRequest } from '../../../fd-toolbox/lib/utils.js';

var __defProp=Object['defineProperty'],__name=(_0x391896,_0x37bf70)=>__defProp(_0x391896,'name',{'value':_0x37bf70,'configurable':!![]});async function otheruserPostRoute(_0x1d34c0){const _0x586ca9=await parseJsonBodyFromRequest(_0x1d34c0);return await createUserWithSettings(_0x586ca9),apiCreatedResponse(_0x586ca9);}__name(otheruserPostRoute,'otheruserPostRoute');async function otheruserPutRoute(_0x2a4cc0){const _0x4d77ef=await parseJsonBodyFromRequest(_0x2a4cc0),_0x1fcbde=await editUser(_0x4d77ef);return apiOkResponse(_0x1fcbde);}__name(otheruserPutRoute,'otheruserPutRoute');async function otheruserGetRoute(_0x17a9fa){const _0x4844a5=new URL(_0x17a9fa['url'])['searchParams']['get'](userSettingProps['userId']);if(!_0x4844a5)throw apiNotFoundError(responseMessages['notFoundError']);const _0x4a5183=await getUserSettingByUserId(_0x4844a5);if(!_0x4a5183)throw apiNotFoundError(responseMessages['notFoundError']);return apiOkResponse(_0x4a5183);}__name(otheruserGetRoute,'otheruserGetRoute');

export { otheruserGetRoute, otheruserPostRoute, otheruserPutRoute };
