Compare commits
	
		
			No commits in common. "master" and "master" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										45
									
								
								.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,45 @@
 | 
				
			|||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
					    env: {
 | 
				
			||||||
 | 
					        browser: true,
 | 
				
			||||||
 | 
					        commonjs: true,
 | 
				
			||||||
 | 
					        es2021: true,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    extends: [
 | 
				
			||||||
 | 
					        'airbnb-base',
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    parserOptions: {
 | 
				
			||||||
 | 
					        ecmaVersion: 12,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    rules: {
 | 
				
			||||||
 | 
					        indent: ['error', 4],
 | 
				
			||||||
 | 
					        semi: ['warn', 'never'],
 | 
				
			||||||
 | 
					        'object-curly-newline': ['warn', {
 | 
				
			||||||
 | 
					            ObjectExpression: 'always',
 | 
				
			||||||
 | 
					            ObjectPattern: {
 | 
				
			||||||
 | 
					                multiline: true,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            ImportDeclaration: 'never',
 | 
				
			||||||
 | 
					            ExportDeclaration: {
 | 
				
			||||||
 | 
					                multiline: true, minProperties: 3,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        }],
 | 
				
			||||||
 | 
					        'consistent-return': [0],
 | 
				
			||||||
 | 
					        'prefer-const': [0],
 | 
				
			||||||
 | 
					        'no-unused-vars': [0],
 | 
				
			||||||
 | 
					        'no-console': [0],
 | 
				
			||||||
 | 
					        'global-require': [0],
 | 
				
			||||||
 | 
					        'no-plusplus': [0],
 | 
				
			||||||
 | 
					        'no-underscore-dangle': [0],
 | 
				
			||||||
 | 
					        'import/no-dynamic-require': [0],
 | 
				
			||||||
 | 
					        'no-shadow': ['warn'],
 | 
				
			||||||
 | 
					        'no-restricted-syntax': ['warn'],
 | 
				
			||||||
 | 
					        'max-len': ['warn'],
 | 
				
			||||||
 | 
					        'linebreak-style': [0],
 | 
				
			||||||
 | 
					        'prefer-destructuring': [0],
 | 
				
			||||||
 | 
					        'imoprt-order': [0],
 | 
				
			||||||
 | 
					        'no-param-reassign': [1],
 | 
				
			||||||
 | 
					        'no-await-in-loop': [1],
 | 
				
			||||||
 | 
					        'no-return-assign': [1],
 | 
				
			||||||
 | 
					        'spaced-comment': [1],
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						@ -1,5 +1,3 @@
 | 
				
			|||||||
node_modules/
 | 
					node_modules/
 | 
				
			||||||
.env
 | 
					.env
 | 
				
			||||||
.idea
 | 
					.idea
 | 
				
			||||||
coverage/
 | 
					 | 
				
			||||||
server/log/
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
    port: process.env.PORT ?? 8044,
 | 
					    port: 8044,
 | 
				
			||||||
    mongoAddr: process.env.MONGO_ADDR || 'localhost',
 | 
					    mongoAddr: process.env.MONGO_ADDR || 'localhost',
 | 
				
			||||||
    mongoPort: 27017,
 | 
					    mongoPort: 27017,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
FROM node:20
 | 
					FROM node:18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN mkdir -p /usr/src/app/server/log/
 | 
					RUN mkdir -p /usr/src/app/server/
 | 
				
			||||||
WORKDIR /usr/src/app/
 | 
					WORKDIR /usr/src/app/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY ./server /usr/src/app/server
 | 
					COPY ./server /usr/src/app/server
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						@ -1,7 +1,7 @@
 | 
				
			|||||||
pipeline {
 | 
					pipeline {
 | 
				
			||||||
  agent {
 | 
					  agent {
 | 
				
			||||||
    docker {
 | 
					    docker {
 | 
				
			||||||
      image 'node:20'
 | 
					      image 'node:18'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -10,7 +10,7 @@ pipeline {
 | 
				
			|||||||
      steps {
 | 
					      steps {
 | 
				
			||||||
        sh 'node -v'
 | 
					        sh 'node -v'
 | 
				
			||||||
        sh 'npm -v'
 | 
					        sh 'npm -v'
 | 
				
			||||||
        sh 'npm ci'
 | 
					        sh 'npm install'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -22,15 +22,15 @@ pipeline {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    stage('test') {
 | 
					    stage('test') {
 | 
				
			||||||
      steps {
 | 
					      steps {
 | 
				
			||||||
        sh 'npm run test'
 | 
					        sh 'npm run test:start'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    stage('archiving') {
 | 
					    stage('clean-all') {
 | 
				
			||||||
      steps {
 | 
					      steps {
 | 
				
			||||||
        script {
 | 
					        sh 'rm -rf .[!.]*'
 | 
				
			||||||
            archiveArtifacts artifacts: 'coverage/*/**'
 | 
					        sh 'rm -rf ./*'
 | 
				
			||||||
        }
 | 
					        sh 'ls -a'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -3,4 +3,4 @@
 | 
				
			|||||||
docker stop ms-mongo
 | 
					docker stop ms-mongo
 | 
				
			||||||
docker volume remove ms_volume
 | 
					docker volume remove ms_volume
 | 
				
			||||||
docker volume create ms_volume
 | 
					docker volume create ms_volume
 | 
				
			||||||
docker run --rm -v ms_volume:/data/db --name ms-mongo -p 27017:27017 -d mongo:8.0.3
 | 
					docker run --rm -v ms_volume:/data/db --name ms-mongo -p 27017:27017 -d mongo:4.4.13
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,19 @@
 | 
				
			|||||||
version: "3"
 | 
					version: "3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
volumes:
 | 
					volumes:
 | 
				
			||||||
    ms_volume8:
 | 
					    ms_volume:
 | 
				
			||||||
    ms_logs:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
    mongoDb:
 | 
					    mongoDb:
 | 
				
			||||||
        image: mongo:8.0.3
 | 
					        image: mongo:4.4.13
 | 
				
			||||||
        volumes:
 | 
					        volumes:
 | 
				
			||||||
            - ms_volume8:/data/db
 | 
					            - ms_volume:/data/db
 | 
				
			||||||
        restart: always
 | 
					        restart: always
 | 
				
			||||||
        # ports:
 | 
					        # ports:
 | 
				
			||||||
        #     - 27017:27017
 | 
					        #     - 27017:27017
 | 
				
			||||||
    multy-stubs:
 | 
					    multy-stubs:
 | 
				
			||||||
        # build: .
 | 
					        build: .
 | 
				
			||||||
        image: bro.js/ms/bh:$TAG
 | 
					 | 
				
			||||||
        restart: always
 | 
					        restart: always
 | 
				
			||||||
        volumes:
 | 
					 | 
				
			||||||
            - ms_logs:/usr/src/app/server/log
 | 
					 | 
				
			||||||
        ports:
 | 
					        ports:
 | 
				
			||||||
            - 8044:8044
 | 
					            - 8044:8044
 | 
				
			||||||
        environment:
 | 
					        environment:
 | 
				
			||||||
 | 
				
			|||||||
@ -1,16 +0,0 @@
 | 
				
			|||||||
import globals from "globals";
 | 
					 | 
				
			||||||
import pluginJs from "@eslint/js";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default [
 | 
					 | 
				
			||||||
  { ignores: ['server/routers/old/*'] },
 | 
					 | 
				
			||||||
  { files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } },
 | 
					 | 
				
			||||||
  { languageOptions: { globals: globals.node } },
 | 
					 | 
				
			||||||
  pluginJs.configs.recommended,
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    rules: {
 | 
					 | 
				
			||||||
      semi: ['warn', 'never'],
 | 
					 | 
				
			||||||
      'no-unused-vars': [0],
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
];
 | 
					 | 
				
			||||||
							
								
								
									
										201
									
								
								jest.config.js
									
									
									
									
									
								
							
							
						
						@ -1,201 +0,0 @@
 | 
				
			|||||||
/**
 | 
					 | 
				
			||||||
 * For a detailed explanation regarding each configuration property, visit:
 | 
					 | 
				
			||||||
 * https://jestjs.io/docs/configuration
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** @type {import('jest').Config} */
 | 
					 | 
				
			||||||
const config = {
 | 
					 | 
				
			||||||
  // All imported modules in your tests should be mocked automatically
 | 
					 | 
				
			||||||
  // automock: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Stop running tests after `n` failures
 | 
					 | 
				
			||||||
  // bail: 0,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The directory where Jest should store its cached dependency information
 | 
					 | 
				
			||||||
  // cacheDirectory: "C:\\Users\\alex\\AppData\\Local\\Temp\\jest",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Automatically clear mock calls, instances, contexts and results before every test
 | 
					 | 
				
			||||||
  clearMocks: true,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Indicates whether the coverage information should be collected while executing the test
 | 
					 | 
				
			||||||
  collectCoverage: true,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of glob patterns indicating a set of files for which coverage information should be collected
 | 
					 | 
				
			||||||
  collectCoverageFrom: [
 | 
					 | 
				
			||||||
    "<rootDir>/server/routers/**/*.js"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The directory where Jest should output its coverage files
 | 
					 | 
				
			||||||
  coverageDirectory: "coverage",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of regexp pattern strings used to skip coverage collection
 | 
					 | 
				
			||||||
  coveragePathIgnorePatterns: [
 | 
					 | 
				
			||||||
    "\\\\node_modules\\\\",
 | 
					 | 
				
			||||||
    "<rootDir>/server/routers/old"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Indicates which provider should be used to instrument code for coverage
 | 
					 | 
				
			||||||
  coverageProvider: "v8",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A list of reporter names that Jest uses when writing coverage reports
 | 
					 | 
				
			||||||
  // coverageReporters: [
 | 
					 | 
				
			||||||
  //   "json",
 | 
					 | 
				
			||||||
  //   "text",
 | 
					 | 
				
			||||||
  //   "lcov",
 | 
					 | 
				
			||||||
  //   "clover"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An object that configures minimum threshold enforcement for coverage results
 | 
					 | 
				
			||||||
  // coverageThreshold: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A path to a custom dependency extractor
 | 
					 | 
				
			||||||
  // dependencyExtractor: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Make calling deprecated APIs throw helpful error messages
 | 
					 | 
				
			||||||
  // errorOnDeprecated: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The default configuration for fake timers
 | 
					 | 
				
			||||||
  // fakeTimers: {
 | 
					 | 
				
			||||||
  //   "enableGlobally": false
 | 
					 | 
				
			||||||
  // },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Force coverage collection from ignored files using an array of glob patterns
 | 
					 | 
				
			||||||
  // forceCoverageMatch: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A path to a module which exports an async function that is triggered once before all test suites
 | 
					 | 
				
			||||||
  // globalSetup: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A path to a module which exports an async function that is triggered once after all test suites
 | 
					 | 
				
			||||||
  // globalTeardown: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A set of global variables that need to be available in all test environments
 | 
					 | 
				
			||||||
  // globals: {},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
 | 
					 | 
				
			||||||
  // maxWorkers: "50%",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of directory names to be searched recursively up from the requiring module's location
 | 
					 | 
				
			||||||
  // moduleDirectories: [
 | 
					 | 
				
			||||||
  //   "node_modules"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of file extensions your modules use
 | 
					 | 
				
			||||||
  // moduleFileExtensions: [
 | 
					 | 
				
			||||||
  //   "js",
 | 
					 | 
				
			||||||
  //   "mjs",
 | 
					 | 
				
			||||||
  //   "cjs",
 | 
					 | 
				
			||||||
  //   "jsx",
 | 
					 | 
				
			||||||
  //   "ts",
 | 
					 | 
				
			||||||
  //   "tsx",
 | 
					 | 
				
			||||||
  //   "json",
 | 
					 | 
				
			||||||
  //   "node"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
 | 
					 | 
				
			||||||
  // moduleNameMapper: {},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
 | 
					 | 
				
			||||||
  // modulePathIgnorePatterns: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Activates notifications for test results
 | 
					 | 
				
			||||||
  // notify: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An enum that specifies notification mode. Requires { notify: true }
 | 
					 | 
				
			||||||
  // notifyMode: "failure-change",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A preset that is used as a base for Jest's configuration
 | 
					 | 
				
			||||||
  // preset: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Run tests from one or more projects
 | 
					 | 
				
			||||||
  // projects: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Use this configuration option to add custom reporters to Jest
 | 
					 | 
				
			||||||
  // reporters: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Automatically reset mock state before every test
 | 
					 | 
				
			||||||
  // resetMocks: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Reset the module registry before running each individual test
 | 
					 | 
				
			||||||
  // resetModules: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A path to a custom resolver
 | 
					 | 
				
			||||||
  // resolver: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Automatically restore mock state and implementation before every test
 | 
					 | 
				
			||||||
  // restoreMocks: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The root directory that Jest should scan for tests and modules within
 | 
					 | 
				
			||||||
  // rootDir: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A list of paths to directories that Jest should use to search for files in
 | 
					 | 
				
			||||||
  // roots: [
 | 
					 | 
				
			||||||
  //   "<rootDir>"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Allows you to use a custom runner instead of Jest's default test runner
 | 
					 | 
				
			||||||
  // runner: "jest-runner",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The paths to modules that run some code to configure or set up the testing environment before each test
 | 
					 | 
				
			||||||
  // setupFiles: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A list of paths to modules that run some code to configure or set up the testing framework before each test
 | 
					 | 
				
			||||||
  // setupFilesAfterEnv: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The number of seconds after which a test is considered as slow and reported as such in the results.
 | 
					 | 
				
			||||||
  // slowTestThreshold: 5,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A list of paths to snapshot serializer modules Jest should use for snapshot testing
 | 
					 | 
				
			||||||
  // snapshotSerializers: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The test environment that will be used for testing
 | 
					 | 
				
			||||||
  // testEnvironment: "jest-environment-node",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Options that will be passed to the testEnvironment
 | 
					 | 
				
			||||||
  // testEnvironmentOptions: {},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Adds a location field to test results
 | 
					 | 
				
			||||||
  // testLocationInResults: false,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The glob patterns Jest uses to detect test files
 | 
					 | 
				
			||||||
  // testMatch: [
 | 
					 | 
				
			||||||
  //   "**/__tests__/**/*.[jt]s?(x)",
 | 
					 | 
				
			||||||
  //   "**/?(*.)+(spec|test).[tj]s?(x)"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
 | 
					 | 
				
			||||||
  // testPathIgnorePatterns: [
 | 
					 | 
				
			||||||
  //   "\\\\node_modules\\\\"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // The regexp pattern or array of patterns that Jest uses to detect test files
 | 
					 | 
				
			||||||
  // testRegex: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // This option allows the use of a custom results processor
 | 
					 | 
				
			||||||
  // testResultsProcessor: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // This option allows use of a custom test runner
 | 
					 | 
				
			||||||
  // testRunner: "jest-circus/runner",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // A map from regular expressions to paths to transformers
 | 
					 | 
				
			||||||
  // transform: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
 | 
					 | 
				
			||||||
  // transformIgnorePatterns: [
 | 
					 | 
				
			||||||
  //   "\\\\node_modules\\\\",
 | 
					 | 
				
			||||||
  //   "\\.pnp\\.[^\\\\]+$"
 | 
					 | 
				
			||||||
  // ],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
 | 
					 | 
				
			||||||
  // unmockedModulePathPatterns: undefined,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Indicates whether each individual test should be reported during the run
 | 
					 | 
				
			||||||
  verbose: true,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
 | 
					 | 
				
			||||||
  // watchPathIgnorePatterns: [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Whether to use watchman for file crawling
 | 
					 | 
				
			||||||
  // watchman: true,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module.exports = config;
 | 
					 | 
				
			||||||
							
								
								
									
										7308
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
							
								
								
									
										49
									
								
								package.json
									
									
									
									
									
								
							
							
						
						@ -1,10 +1,10 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "multi-stub",
 | 
					  "name": "multi-stub",
 | 
				
			||||||
  "version": "1.2.1",
 | 
					  "version": "1.0.1",
 | 
				
			||||||
  "description": "",
 | 
					  "description": "",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "start": "cross-env PORT=8033 npx nodemon ./server",
 | 
					    "start": "npx nodemon ./server",
 | 
				
			||||||
    "up:prod": "cross-env NODE_ENV=\"production\" node ./server",
 | 
					    "up:prod": "cross-env NODE_ENV=\"production\" node ./server",
 | 
				
			||||||
    "deploy:d:stop": "docker compose down",
 | 
					    "deploy:d:stop": "docker compose down",
 | 
				
			||||||
    "deploy:d:build": "docker compose build",
 | 
					    "deploy:d:build": "docker compose build",
 | 
				
			||||||
@ -12,7 +12,8 @@
 | 
				
			|||||||
    "redeploy": "npm run deploy:d:stop && npm run deploy:d:build && npm run deploy:d:up",
 | 
					    "redeploy": "npm run deploy:d:stop && npm run deploy:d:build && npm run deploy:d:up",
 | 
				
			||||||
    "eslint": "npx eslint ./server",
 | 
					    "eslint": "npx eslint ./server",
 | 
				
			||||||
    "eslint:fix": "npx eslint ./server --fix",
 | 
					    "eslint:fix": "npx eslint ./server --fix",
 | 
				
			||||||
    "test": "jest"
 | 
					    "test": "echo \"test complete\"",
 | 
				
			||||||
 | 
					    "test:start": "start-server-and-test up:prod 8044 test"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
@ -23,38 +24,30 @@
 | 
				
			|||||||
  "license": "MIT",
 | 
					  "license": "MIT",
 | 
				
			||||||
  "homepage": "https://bitbucket.org/online-mentor/multi-stub#readme",
 | 
					  "homepage": "https://bitbucket.org/online-mentor/multi-stub#readme",
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "ai": "^4.1.13",
 | 
					 | 
				
			||||||
    "axios": "^1.7.7",
 | 
					 | 
				
			||||||
    "bcrypt": "^5.1.0",
 | 
					    "bcrypt": "^5.1.0",
 | 
				
			||||||
    "body-parser": "^1.19.0",
 | 
					    "body-parser": "^1.19.0",
 | 
				
			||||||
    "cookie-parser": "^1.4.5",
 | 
					    "cookie-parser": "^1.4.5",
 | 
				
			||||||
    "cors": "^2.8.5",
 | 
					    "cors": "^2.8.5",
 | 
				
			||||||
    "cross-env": "^7.0.3",
 | 
					    "cross-env": "^7.0.3",
 | 
				
			||||||
    "crypto-js": "^4.2.0",
 | 
					    "crypto-js": "^4.1.1",
 | 
				
			||||||
    "dotenv": "^16.4.7",
 | 
					    "dotenv": "^16.3.1",
 | 
				
			||||||
    "express": "5.0.1",
 | 
					    "express": "^4.18.2",
 | 
				
			||||||
    "express-jwt": "^8.5.1",
 | 
					    "express-jwt": "^8.4.1",
 | 
				
			||||||
    "express-session": "^1.18.1",
 | 
					    "express-session": "^1.17.3",
 | 
				
			||||||
    "jsdom": "^25.0.1",
 | 
					    "jsdom": "^22.1.0",
 | 
				
			||||||
    "jsonwebtoken": "^9.0.2",
 | 
					    "jsonwebtoken": "^8.5.1",
 | 
				
			||||||
    "mongodb": "^6.12.0",
 | 
					    "mongodb": "^3.6.8",
 | 
				
			||||||
    "mongoose": "^8.9.2",
 | 
					    "mysql": "^2.18.1",
 | 
				
			||||||
    "mongoose-sequence": "^6.0.1",
 | 
					 | 
				
			||||||
    "morgan": "^1.10.0",
 | 
					 | 
				
			||||||
    "multer": "^1.4.5-lts.1",
 | 
					 | 
				
			||||||
    "pbkdf2-password": "^1.2.1",
 | 
					    "pbkdf2-password": "^1.2.1",
 | 
				
			||||||
    "rotating-file-stream": "^3.2.5",
 | 
					    "socket.io": "^4.7.1",
 | 
				
			||||||
    "socket.io": "^4.8.1",
 | 
					    "start-server-and-test": "^1.13.1",
 | 
				
			||||||
    "uuid": "^11.0.3"
 | 
					    "uuid": "^9.0.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@eslint/js": "^9.17.0",
 | 
					    "@types/node": "18.17.1",
 | 
				
			||||||
    "@types/node": "22.10.2",
 | 
					    "eslint": "8.46.0",
 | 
				
			||||||
    "eslint": "^9.17.0",
 | 
					    "eslint-config-airbnb-base": "15.0.0",
 | 
				
			||||||
    "globals": "^15.14.0",
 | 
					    "eslint-plugin-import": "2.28.0",
 | 
				
			||||||
    "jest": "^29.7.0",
 | 
					    "nodemon": "3.0.1"
 | 
				
			||||||
    "mockingoose": "^2.16.2",
 | 
					 | 
				
			||||||
    "nodemon": "3.1.9",
 | 
					 | 
				
			||||||
    "supertest": "^7.0.0"
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,16 +0,0 @@
 | 
				
			|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
exports[`todo list app get list 1`] = `
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  "body": [
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "_id": "670f69b5796ce7a9069da2f7",
 | 
					 | 
				
			||||||
      "created": "2024-10-16T07:22:29.042Z",
 | 
					 | 
				
			||||||
      "id": "670f69b5796ce7a9069da2f7",
 | 
					 | 
				
			||||||
      "items": [],
 | 
					 | 
				
			||||||
      "title": "qqq",
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "success": true,
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
`;
 | 
					 | 
				
			||||||
@ -1,34 +0,0 @@
 | 
				
			|||||||
const { describe, it, expect } = require('@jest/globals')
 | 
					 | 
				
			||||||
const request = require('supertest')
 | 
					 | 
				
			||||||
const express = require('express')
 | 
					 | 
				
			||||||
const mockingoose = require('mockingoose')
 | 
					 | 
				
			||||||
const { ListModel } = require('../data/model/todo/list')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const todo = require('../routers/todo/routes')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const app = express()
 | 
					 | 
				
			||||||
app.use(todo)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const listExample = {
 | 
					 | 
				
			||||||
  "title": "qqq",
 | 
					 | 
				
			||||||
  "items": [],
 | 
					 | 
				
			||||||
  "_id": "670f69b5796ce7a9069da2f7",
 | 
					 | 
				
			||||||
  "created": "2024-10-16T07:22:29.042Z",
 | 
					 | 
				
			||||||
  "id": "670f69b5796ce7a9069da2f7"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
describe('todo list app', () => {
 | 
					 | 
				
			||||||
  it('get list', (done) => {
 | 
					 | 
				
			||||||
    mockingoose(ListModel)
 | 
					 | 
				
			||||||
    .toReturn([listExample], 'find')
 | 
					 | 
				
			||||||
    .toReturn(listExample, 'create')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    request(app)
 | 
					 | 
				
			||||||
      .get('/list')
 | 
					 | 
				
			||||||
      .expect(200)
 | 
					 | 
				
			||||||
      .then((response) => {
 | 
					 | 
				
			||||||
        expect(response.body).toMatchSnapshot()
 | 
					 | 
				
			||||||
        done()
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
@ -6,7 +6,6 @@ module.exports = (err, req, res, next) => {
 | 
				
			|||||||
            success: false, error: 'Токен авторизации не найден',
 | 
					            success: false, error: 'Токен авторизации не найден',
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    res.status(400).send({
 | 
					    res.status(400).send({
 | 
				
			||||||
        success: false, error: err.message || 'Что-то пошло не так',
 | 
					        success: false, error: err.message || 'Что-то пошло не так',
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										136
									
								
								server/index.js
									
									
									
									
									
								
							
							
						
						@ -1,99 +1,75 @@
 | 
				
			|||||||
const express = require("express")
 | 
					const express = require('express')
 | 
				
			||||||
const bodyParser = require("body-parser")
 | 
					const bodyParser = require('body-parser')
 | 
				
			||||||
const cookieParser = require("cookie-parser")
 | 
					const cookieParser = require('cookie-parser')
 | 
				
			||||||
const session = require("express-session")
 | 
					const session = require('express-session')
 | 
				
			||||||
const morgan = require("morgan")
 | 
					 | 
				
			||||||
const path = require("path")
 | 
					 | 
				
			||||||
const rfs = require("rotating-file-stream")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const app = express()
 | 
					const app = express()
 | 
				
			||||||
require("dotenv").config()
 | 
					const cors = require('cors')
 | 
				
			||||||
exports.app = app
 | 
					require('dotenv').config()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const accessLogStream = rfs.createStream("access.log", {
 | 
					const config = require('../.serverrc')
 | 
				
			||||||
  size: "10M",
 | 
					const { setIo } = require('./io')
 | 
				
			||||||
  interval: "1d",
 | 
					 | 
				
			||||||
  compress: "gzip",
 | 
					 | 
				
			||||||
  path: path.join(__dirname, "log"),
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const errorLogStream = rfs.createStream("error.log", {
 | 
					 | 
				
			||||||
  size: "10M",
 | 
					 | 
				
			||||||
  interval: "1d",
 | 
					 | 
				
			||||||
  compress: "gzip",
 | 
					 | 
				
			||||||
  path: path.join(__dirname, "log"),
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const config = require("../.serverrc")
 | 
					 | 
				
			||||||
const { setIo } = require("./io")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.use(cookieParser())
 | 
					app.use(cookieParser())
 | 
				
			||||||
app.use(
 | 
					app.options('*', cors())
 | 
				
			||||||
  morgan("combined", {
 | 
					app.use(cors())
 | 
				
			||||||
    stream: accessLogStream,
 | 
					 | 
				
			||||||
    skip: function (req, res) {
 | 
					 | 
				
			||||||
      return res.statusCode >= 400
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// log all requests to access.log
 | 
					 | 
				
			||||||
app.use(
 | 
					 | 
				
			||||||
  morgan("combined", {
 | 
					 | 
				
			||||||
    stream: errorLogStream,
 | 
					 | 
				
			||||||
    skip: function (req, res) {
 | 
					 | 
				
			||||||
        console.log('statusCode', res.statusCode, res.statusCode <= 400)
 | 
					 | 
				
			||||||
        return res.statusCode < 400
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const server = setIo(app)
 | 
					const server = setIo(app)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const sess = {
 | 
					const sess = {
 | 
				
			||||||
  secret: "super-secret-key",
 | 
					    secret: 'super-secret-key',
 | 
				
			||||||
  resave: true,
 | 
					    resave: true,
 | 
				
			||||||
  saveUninitialized: true,
 | 
					    saveUninitialized: true,
 | 
				
			||||||
  cookie: {},
 | 
					    cookie: {
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if (app.get("env") === "production") {
 | 
					if (app.get('env') === 'production') {
 | 
				
			||||||
  app.set("trust proxy", 1)
 | 
					    app.set('trust proxy', 1)
 | 
				
			||||||
  sess.cookie.secure = true
 | 
					    sess.cookie.secure = true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
app.use(session(sess))
 | 
					app.use(session(sess))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.use(
 | 
					app.use(bodyParser.json({
 | 
				
			||||||
  bodyParser.json({
 | 
					    limit: '50mb',
 | 
				
			||||||
    limit: "50mb",
 | 
					}))
 | 
				
			||||||
  })
 | 
					app.use(bodyParser.urlencoded({
 | 
				
			||||||
)
 | 
					    limit: '50mb',
 | 
				
			||||||
app.use(
 | 
					 | 
				
			||||||
  bodyParser.urlencoded({
 | 
					 | 
				
			||||||
    limit: "50mb",
 | 
					 | 
				
			||||||
    extended: true,
 | 
					    extended: true,
 | 
				
			||||||
  })
 | 
					}))
 | 
				
			||||||
)
 | 
					app.use(require('./root'))
 | 
				
			||||||
app.use(require("./root"))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Добавляйте сюда свои routers.
 | 
					 * Добавляйте сюда свои routers.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
app.use("/kfu-m-24-1", require("./routers/kfu-m-24-1"))
 | 
					app.use('/lobsters', require('./routers/lobsters'))
 | 
				
			||||||
app.use("/epja-2024-1", require("./routers/epja-2024-1"))
 | 
					app.use('/example', require('./routers/example'))
 | 
				
			||||||
app.use("/v1/todo", require("./routers/todo"))
 | 
					// app.use('/coder', require('./routers/coder'))
 | 
				
			||||||
app.use("/dogsitters-finder", require("./routers/dogsitters-finder"))
 | 
					//app.use('/stc-21-03', require('./routers/stc-21-03'))
 | 
				
			||||||
app.use("/kazan-explore", require("./routers/kazan-explore"))
 | 
					//app.use('/stc-21', require('./routers/stc'))
 | 
				
			||||||
app.use("/edateam", require("./routers/edateam-legacy"))
 | 
					//app.use('/stc-22-24', require('./routers/stc-22-24'))
 | 
				
			||||||
app.use("/dry-wash", require("./routers/dry-wash"))
 | 
					// app.use('/bushou-api', require('./routers/bushou'))
 | 
				
			||||||
app.use("/freetracker", require("./routers/freetracker"))
 | 
					 | 
				
			||||||
app.use("/dhs-testing", require("./routers/dhs-testing"))
 | 
					 | 
				
			||||||
app.use("/gamehub", require("./routers/gamehub")) 
 | 
					 | 
				
			||||||
app.use("/esc", require("./routers/esc"))
 | 
					 | 
				
			||||||
app.use('/connectme', require('./routers/connectme'))
 | 
					 | 
				
			||||||
app.use('/questioneer', require('./routers/questioneer'))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.use(require("./error"))
 | 
					// app.use('/uryndyklar-api', require('./routers/uryndyklar'))
 | 
				
			||||||
 | 
					// app.use('/neptunium', require('./routers/neptunium'))
 | 
				
			||||||
 | 
					// app.use('/music-learn', require('./routers/music-learn'))
 | 
				
			||||||
 | 
					// app.use('/publicium', require('./routers/publicium'))
 | 
				
			||||||
 | 
					// app.use('/task-boss', require('./routers/task-boss'))
 | 
				
			||||||
 | 
					// app.use('/car-wash', require('./routers/car-wash'))
 | 
				
			||||||
 | 
					app.use('/zoom-bar', require('./routers/zoom-bar'))
 | 
				
			||||||
 | 
					app.use('/r-and-m', require('./routers/r-and-m'))
 | 
				
			||||||
 | 
					app.use('/my', require('./routers/my'))
 | 
				
			||||||
 | 
					app.use('/edateam', require('./routers/edateam'))
 | 
				
			||||||
 | 
					app.use('/webstar-project', require('./routers/webstar-project'))
 | 
				
			||||||
 | 
					app.use('/dogsitters-finder', require('./routers/dogsitters-finder'))
 | 
				
			||||||
 | 
					app.use('/dhs-testing', require('./routers/dhs-testing'))
 | 
				
			||||||
 | 
					app.use('/kazan-explore', require('./routers/kazan-explore'))
 | 
				
			||||||
 | 
					//app.use('/basket', require('./routers/basket'))
 | 
				
			||||||
 | 
					//app.use('/easy-project', require('./routers/easy-project'))
 | 
				
			||||||
 | 
					//app.use('/sugarbun', require('./routers/sugarbun'))
 | 
				
			||||||
 | 
					app.use('/epja-2023-2', require('./routers/epja-2023-2'))
 | 
				
			||||||
 | 
					require('./routers/hub-video')
 | 
				
			||||||
 | 
					app.use('/school-stage', require('./routers/school-stage'))
 | 
				
			||||||
 | 
					app.use('/epja-2024-1', require('./routers/epja-2024-1'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
server.listen(config.port, () =>
 | 
					app.use(require('./error'))
 | 
				
			||||||
  console.log(`Listening on http://localhost:${config.port}`)
 | 
					
 | 
				
			||||||
)
 | 
					server.listen(config.port, () => console.log(`Listening on http://localhost:${config.port}`))
 | 
				
			||||||
 | 
				
			|||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
const mongoose = require('mongoose');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Типы вопросов
 | 
					 | 
				
			||||||
const QUESTION_TYPES = {
 | 
					 | 
				
			||||||
  SINGLE_CHOICE: 'single_choice', // Один вариант
 | 
					 | 
				
			||||||
  MULTIPLE_CHOICE: 'multiple_choice', // Несколько вариантов
 | 
					 | 
				
			||||||
  TEXT: 'text', // Текстовый ответ
 | 
					 | 
				
			||||||
  RATING: 'rating', // Оценка по шкале
 | 
					 | 
				
			||||||
  TAG_CLOUD: 'tag_cloud' // Облако тегов
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Типы отображения
 | 
					 | 
				
			||||||
const DISPLAY_TYPES = {
 | 
					 | 
				
			||||||
  DEFAULT: 'default',
 | 
					 | 
				
			||||||
  TAG_CLOUD: 'tag_cloud',
 | 
					 | 
				
			||||||
  VOTING: 'voting',
 | 
					 | 
				
			||||||
  POLL: 'poll'
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Схема варианта ответа
 | 
					 | 
				
			||||||
const optionSchema = new mongoose.Schema({
 | 
					 | 
				
			||||||
  text: { type: String, required: true },
 | 
					 | 
				
			||||||
  count: { type: Number, default: 0 } // счетчик голосов
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Схема вопроса
 | 
					 | 
				
			||||||
const questionSchema = new mongoose.Schema({
 | 
					 | 
				
			||||||
  text: { type: String, required: true },
 | 
					 | 
				
			||||||
  type: { 
 | 
					 | 
				
			||||||
    type: String, 
 | 
					 | 
				
			||||||
    enum: Object.values(QUESTION_TYPES),
 | 
					 | 
				
			||||||
    required: true 
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  options: [optionSchema],
 | 
					 | 
				
			||||||
  required: { type: Boolean, default: false }
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Схема опроса
 | 
					 | 
				
			||||||
const questionnaireSchema = new mongoose.Schema({
 | 
					 | 
				
			||||||
  title: { type: String, required: true },
 | 
					 | 
				
			||||||
  description: { type: String },
 | 
					 | 
				
			||||||
  questions: [questionSchema],
 | 
					 | 
				
			||||||
  displayType: { 
 | 
					 | 
				
			||||||
    type: String, 
 | 
					 | 
				
			||||||
    enum: Object.values(DISPLAY_TYPES),
 | 
					 | 
				
			||||||
    default: DISPLAY_TYPES.DEFAULT 
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  createdAt: { type: Date, default: Date.now },
 | 
					 | 
				
			||||||
  updatedAt: { type: Date, default: Date.now },
 | 
					 | 
				
			||||||
  adminLink: { type: String, required: true }, // ссылка для редактирования
 | 
					 | 
				
			||||||
  publicLink: { type: String, required: true } // ссылка для голосования
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const Questionnaire = mongoose.model('Questionnaire', questionnaireSchema);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module.exports = {
 | 
					 | 
				
			||||||
  Questionnaire,
 | 
					 | 
				
			||||||
  QUESTION_TYPES,
 | 
					 | 
				
			||||||
  DISPLAY_TYPES
 | 
					 | 
				
			||||||
}; 
 | 
					 | 
				
			||||||
@ -1,32 +1,17 @@
 | 
				
			|||||||
 | 
					const router = require('express').Router()
 | 
				
			||||||
const fs = require('fs')
 | 
					const fs = require('fs')
 | 
				
			||||||
const path = require('path')
 | 
					const path = require('path')
 | 
				
			||||||
const router = require('express').Router()
 | 
					 | 
				
			||||||
const mongoose = require('mongoose')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const pkg = require('../package.json')
 | 
					const pkg = require('../package.json')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require('./utils/mongoose')
 | 
					 | 
				
			||||||
const folderPath = path.resolve(__dirname, './routers')
 | 
					const folderPath = path.resolve(__dirname, './routers')
 | 
				
			||||||
const folders = fs.readdirSync(folderPath)
 | 
					const folders = fs.readdirSync(folderPath)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
router.get('/', async (req, res) => {
 | 
					router.get('/', (req, res) => {
 | 
				
			||||||
  // throw new Error('check error message')
 | 
					    res.send(`
 | 
				
			||||||
  res.send(`
 | 
					 | 
				
			||||||
        <h1>multy stub is working v${pkg.version}</h1>
 | 
					        <h1>multy stub is working v${pkg.version}</h1>
 | 
				
			||||||
        <ul>
 | 
					        <ul>
 | 
				
			||||||
            ${folders.map((f) => `<li>${f}</li>`).join('')}
 | 
					            ${folders.map((f) => `<li>${f}</li>`).join('')}
 | 
				
			||||||
        </ul>
 | 
					        </ul>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <h2>models</h2>
 | 
					 | 
				
			||||||
        <ul>${
 | 
					 | 
				
			||||||
          (await Promise.all(
 | 
					 | 
				
			||||||
            (await mongoose.modelNames()).map(async (name) => {
 | 
					 | 
				
			||||||
                const count = await mongoose.model(name).countDocuments()
 | 
					 | 
				
			||||||
                return `<li>${name} - ${count}</li>`
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
          )).map(t => t).join(' ')
 | 
					 | 
				
			||||||
        }</ul>
 | 
					 | 
				
			||||||
    `)
 | 
					    `)
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
const ObjectId = require('mongodb').ObjectID
 | 
					const ObjectId = require('mongodb').ObjectID
 | 
				
			||||||
const getHash = require('pbkdf2-password')()
 | 
					const getHash = require('pbkdf2-password')()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { getDB } = require('../../../utils/mongo')
 | 
					const { getDB } = require('../../utils/mongo')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const USERS_COLLECTION = 'users'
 | 
					const USERS_COLLECTION = 'users'
 | 
				
			||||||
const LISTS_COLLECTION = 'lists'
 | 
					const LISTS_COLLECTION = 'lists'
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 377 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 470 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-clerical.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 578 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 481 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 368 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-silk.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 593 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%80-slip.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 539 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%A8-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 414 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%A8-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 414 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%B6-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 739 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%B6-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 686 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%BF-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 750 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B8%BF-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 687 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B9%99-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 706 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B9%99-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 776 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B9%99-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 628 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B9%99-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 742 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%B9%99-silk.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 853 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%85-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 911 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%8C-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 601 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%8C-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 648 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%8C-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 709 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%8C-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 442 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%8C-silk.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 858 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%8C-slip.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 718 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%A0-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1015 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.0 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-bronze-shang.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 811 B  | 
| 
		 After Width: | Height: | Size: 872 B  | 
| 
		 After Width: | Height: | Size: 659 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 767 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 719 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.0 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-silk.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 812 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BA%BA-slip.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 760 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BB%8C-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.3 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BB%8C-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BB%8C-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 955 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E4%BB%8C-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 908 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%84%BF-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 2.0 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%84%BF-bronze-shang.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%84%BF-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.0 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%84%BF-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1016 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%84%BF-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 997 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%A5-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 856 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%A5-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 693 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%A5-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 711 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%A5-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 766 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%A5-silk.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 952 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%AB-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%AB-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 843 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%AB-oracle.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 951 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%AB-seal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 967 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%AB-silk.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 923 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%85%AB-slip.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 725 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%86%82-bigseal.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 935 B  | 
							
								
								
									
										
											BIN
										
									
								
								server/routers/bushou/images/60px-%E5%86%82-bronze.svg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 820 B  |