diff options
author | ilyayudovin <ilyayudovin123.@mail.com> | 2020-06-09 13:14:57 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123.@mail.com> | 2020-06-09 13:14:57 +0300 |
commit | aa01e258948a13abafa7c441a7b82e5c2fb676b9 (patch) | |
tree | b12c66b01786823671118be8f660c9fb1562abf4 | |
parent | 977992eb70a0ca3b702e116b628d37ac75e667d1 (diff) | |
download | which-api-aa01e258948a13abafa7c441a7b82e5c2fb676b9.tar.gz |
feat: create user service
-rw-r--r-- | .idea/misc.xml | 6 | ||||
-rw-r--r-- | .idea/modules.xml | 8 | ||||
-rw-r--r-- | .idea/vcs.xml | 6 | ||||
-rw-r--r-- | .idea/which-api.iml | 12 | ||||
-rw-r--r-- | .idea/workspace.xml | 253 | ||||
-rw-r--r-- | UserService.ts | 22 | ||||
-rw-r--r-- | app.ts | 12 | ||||
-rw-r--r-- | package.json | 12 |
8 files changed, 328 insertions, 3 deletions
diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="JavaScriptSettings"> + <option name="languageLevel" value="ES6" /> + </component> +</project>
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..cd677c8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/which-api.iml" filepath="$PROJECT_DIR$/.idea/which-api.iml" /> + </modules> + </component> +</project>
\ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>
\ No newline at end of file diff --git a/.idea/which-api.iml b/.idea/which-api.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/which-api.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="WEB_MODULE" version="4"> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/.tmp" /> + <excludeFolder url="file://$MODULE_DIR$/temp" /> + <excludeFolder url="file://$MODULE_DIR$/tmp" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..32fe5f1 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,253 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <list default="true" id="016dd94d-f6c3-409d-ae0c-e7a6cb4028d2" name="Default Changelist" comment=""> + <change beforePath="$PROJECT_DIR$/app.ts" beforeDir="false" afterPath="$PROJECT_DIR$/app.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" /> + </list> + <ignored path="$PROJECT_DIR$/.tmp/" /> + <ignored path="$PROJECT_DIR$/temp/" /> + <ignored path="$PROJECT_DIR$/tmp/" /> + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <option name="SHOW_DIALOG" value="false" /> + <option name="HIGHLIGHT_CONFLICTS" value="true" /> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> + <option name="LAST_RESOLUTION" value="IGNORE" /> + </component> + <component name="FUSProjectUsageTrigger"> + <session id="-1345840066"> + <usages-collector id="statistics.lifecycle.project"> + <counts> + <entry key="project.closed" value="4" /> + <entry key="project.open.time.4" value="2" /> + <entry key="project.open.time.5" value="1" /> + <entry key="project.open.time.6" value="1" /> + <entry key="project.opened" value="4" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.extensions.open"> + <counts> + <entry key="json" value="1" /> + <entry key="ts" value="4" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.types.open"> + <counts> + <entry key="JSON" value="1" /> + <entry key="TypeScript" value="4" /> + </counts> + </usages-collector> + <usages-collector id="statistics.js.language.service.starts"> + <counts> + <entry key="TypeScriptServerServiceImpl" value="4" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.extensions.edit"> + <counts> + <entry key="ts" value="519" /> + </counts> + </usages-collector> + <usages-collector id="statistics.file.types.edit"> + <counts> + <entry key="TypeScript" value="519" /> + </counts> + </usages-collector> + </session> + </component> + <component name="FileEditorManager"> + <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/app.ts"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="264"> + <caret line="54" column="3" selection-start-line="54" selection-start-column="3" selection-end-line="54" selection-end-column="3" /> + <folding> + <element signature="e#0#44#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/PollService.ts"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="368"> + <caret line="26" selection-start-line="26" selection-end-line="26" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/UserService.ts"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="357"> + <caret line="21" column="1" lean-forward="true" selection-start-line="21" selection-start-column="1" selection-end-line="21" selection-end-column="1" /> + </state> + </provider> + </entry> + </file> + </leaf> + </component> + <component name="FileTemplateManagerImpl"> + <option name="RECENT_TEMPLATES"> + <list> + <option value="TypeScript File" /> + </list> + </option> + </component> + <component name="Git.Settings"> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> + </component> + <component name="IdeDocumentHistory"> + <option name="CHANGED_PATHS"> + <list> + <option value="$PROJECT_DIR$/PollService.ts" /> + <option value="$PROJECT_DIR$/UserService.ts" /> + <option value="$PROJECT_DIR$/app.ts" /> + </list> + </option> + </component> + <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" /> + <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER"> + <package-json value="$PROJECT_DIR$/package.json" /> + </component> + <component name="JsGulpfileManager"> + <detection-done>true</detection-done> + <sorting>DEFINITION_ORDER</sorting> + </component> + <component name="NodeModulesDirectoryManager"> + <handled-path value="$PROJECT_DIR$/node_modules" /> + </component> + <component name="NodePackageJsonFileManager"> + <packageJsonPaths> + <path value="$PROJECT_DIR$/package.json" /> + </packageJsonPaths> + </component> + <component name="ProjectFrameBounds" extendedState="7"> + <option name="x" value="-279" /> + <option name="y" value="5" /> + <option name="width" value="965" /> + <option name="height" value="1105" /> + </component> + <component name="ProjectView"> + <navigator proportions="" version="1"> + <foldersAlwaysOnTop value="true" /> + </navigator> + <panes> + <pane id="Scope" /> + <pane id="ProjectPane"> + <subPane> + <expand> + <path> + <item name="which-api" type="b2602c69:ProjectViewProjectNode" /> + <item name="which-api" type="462c0819:PsiDirectoryNode" /> + </path> + </expand> + <select /> + </subPane> + </pane> + </panes> + </component> + <component name="PropertiesComponent"> + <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> + <property name="nodejs_npm_path_reset_for_default_project" value="true" /> + <property name="nodejs_package_manager_path" value="npm" /> + <property name="ts.external.directory.path" value="D:\WebStorm\WebStorm 2018.2.3\plugins\JavaScriptLanguage\jsLanguageServicesImpl\external" /> + </component> + <component name="RunDashboard"> + <option name="ruleStates"> + <list> + <RuleState> + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> + </RuleState> + <RuleState> + <option name="name" value="StatusDashboardGroupingRule" /> + </RuleState> + </list> + </option> + </component> + <component name="SvnConfiguration"> + <configuration /> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"> + <changelist id="016dd94d-f6c3-409d-ae0c-e7a6cb4028d2" name="Default Changelist" comment="" /> + <created>1591631223047</created> + <option name="number" value="Default" /> + <option name="presentableId" value="Default" /> + <updated>1591631223047</updated> + <workItem from="1591631225538" duration="1703000" /> + <workItem from="1591633754704" duration="1857000" /> + <workItem from="1591652893245" duration="833000" /> + <workItem from="1591654710078" duration="1166000" /> + </task> + <servers /> + </component> + <component name="TimeTrackingManager"> + <option name="totallyTimeSpent" value="5559000" /> + </component> + <component name="ToolWindowManager"> + <frame x="-7" y="-7" width="1550" height="838" extended-state="6" /> + <layout> + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.050892267" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info id="npm" order="2" side_tool="true" /> + <window_info id="Favorites" order="3" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="0" /> + <window_info anchor="bottom" id="Find" order="1" /> + <window_info anchor="bottom" id="Run" order="2" /> + <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="6" /> + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> + <window_info anchor="bottom" id="Version Control" order="8" show_stripe_button="false" /> + <window_info anchor="bottom" id="TypeScript" order="9" weight="0.32907802" /> + <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" /> + <window_info active="true" anchor="bottom" id="Terminal" order="11" visible="true" weight="0.3503546" /> + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + </layout> + </component> + <component name="TypeScriptGeneratedFilesManager"> + <option name="version" value="1" /> + </component> + <component name="VcsContentAnnotationSettings"> + <option name="myLimit" value="2678400000" /> + </component> + <component name="editorHistoryManager"> + <entry file="file://$PROJECT_DIR$/package.json"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="170"> + <caret line="10" column="19" selection-start-line="10" selection-start-column="19" selection-end-line="10" selection-end-column="19" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/UserService.ts"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="357"> + <caret line="21" column="1" lean-forward="true" selection-start-line="21" selection-start-column="1" selection-end-line="21" selection-end-column="1" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/PollService.ts"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="368"> + <caret line="26" selection-start-line="26" selection-end-line="26" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/app.ts"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="264"> + <caret line="54" column="3" selection-start-line="54" selection-start-column="3" selection-end-line="54" selection-end-column="3" /> + <folding> + <element signature="e#0#44#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </component> +</project>
\ No newline at end of file diff --git a/UserService.ts b/UserService.ts new file mode 100644 index 0000000..0cbb649 --- /dev/null +++ b/UserService.ts @@ -0,0 +1,22 @@ +interface User { + info : { + name: string; + age: number; + nationality: string; + sex: string; + } +} + +export class UserService { + users: User[] = []; + + async find (){ + return this.users; + } + + async create(data: Pick<User, 'info'>){ + const user: User = {...data}; + this.users.push(user); + return user; + } +}
\ No newline at end of file @@ -4,6 +4,7 @@ import express from '@feathersjs/express'; import socketio from '@feathersjs/socketio'; import { PollService } from './PollService'; +import {UserService} from "./UserService"; const app = express(feathers()); @@ -15,7 +16,7 @@ app.configure(socketio()); app.use(express.errorHandler()); app.use('/polls', new PollService()); - +app.use('/users', new UserService()); // Add any new real-time connection to the `everybody` channel app.on('connection', connection => @@ -43,3 +44,12 @@ app.service('polls').create({ } } }); + +app.service('users').create({ + info: { + name: 'John Doe', + age: 20, + nationality: 'Belarus', + sex: 'male' + } +}); diff --git a/package.json b/package.json index 8a8afee..758cb99 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "@oneflow/which-api", "version": "1.0.0", - "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" @@ -14,5 +13,14 @@ "@feathersjs/feathers": "^4.5.3", "@feathersjs/socketio": "^4.5.4", "@feathersjs/transport-commons": "^4.5.3" - } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/eug-vs/which-api.git" + }, + "bugs": { + "url": "https://github.com/eug-vs/which-api/issues" + }, + "homepage": "https://github.com/eug-vs/which-api#readme", + "description": "" } |