Giter Club home page Giter Club logo

vocascan-server's Introduction

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

vocascan-server's People

Contributors

justjakecalifornia avatar luwol03 avatar noctera avatar tracer1337 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vocascan-server's Issues

No Database

No database because i dont know what is needet (Using mysql)

Expected behavior
Should be able to execute command to database but for example xyz.roles doesn't exist

Screenshots
image

Additional context
There was no step on how to create the database

Add stats to group response

We have get routes for language packages and groups
GET: /api/languagePackage
GET: /api/languagePackage/{languagePackageId}/group
which return information about all the existing language packages and groups.

While the language package route as an optional stats parameter that allows adding stats about the existing vocabs

"stats": {
      "vocabularies": {
        "all": 0,
        "active": 0,
        "inactive": 0,
        "unresolved": 0,
        "unactivated": 0,
        "learnedToday": {
          "dueToday": 0,
          "correct": 0,
          "wrong": 0
        }
      }
    }

the group route does not have such.
In order to show stats in the group tag of the library, we have to add

  1. stats in the group route
    image

  2. and to the included groups in the language package route.
    image

Route for checking duplicate vocabs

We need a route to checki if vocab already exists in groups/packages when creating them. The check only has do be done client-side, so no additional checking in the vocab creation functions.

Needed Routes:

  1. Route to check if vocab already exists in package
    /api/check-duplicate?languagePackageId={languagePackageId}&vocab={vocab}

Response:

{
    "duplicate": false,
    "group": {
        "id": "fbd8ee4a-8105-4716-zt72-65d6ef411234",
        "languagePackageId": "81ec68fc-843e-4a76-9fzu-5ae0b1gb05c2",
        "name": "Unit 1",
        "description": "This is a test",
        "active": true,
    },
}
  1. Route to check if vocab already exists in group
    /api/check-duplicate?groupId={groupId}&vocab={vocab}

Response:

{
   " duplicate": false,
    "group": {
        "id": "fbd8ee4a-8105-4716-zt72-65d6ef411234",
        "languagePackageId": "81ec68fc-843e-4a76-9fzu-5ae0b1gb05c2",
        "name": "Unit 1",
        "description": "This is a test",
        "active": true,
    },
}

For a better overview I have split up the two needed cases. But overall there is only one endpoint, where you can give your needed query parameters to get the result. This includes adding groupId and packageId in one query too (although this is a bit useless).

bug/cors-error

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Fetch the api from crossorigin in the browser
  2. See cors error in debug console

Expected behavior
Api should return the result and browser shouldnt block the request due to cross origin.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. macos]
  • node version:
  • npm version:
  • database dialect:
  • commit ref:

Additional context

Should be an easy fix by adding the cors middleware to the server.js

On login: error: Error: Object.fromEntries is not a function

Describe the bug
Failed login attempt from Windows 10 client due to "Error: Object.fromEntries is not a function"

To Reproduce
Steps to reproduce the behavior:

  1. clone the current master branch
  2. apply fix #58
  3. Configure to use MariaDB and verify "Hello World" with wget from remote system.
  4. download Windows 10 client to desktop
  5. Register, specifying the same URL as was used to get the "Hello World"
  6. Login

This is the error:

/home/toesettast/.pm2/logs/vocascan-server-out.log  Executing (default): SELECT `id`, `username`, `password` FROM `users` AS `User` WHERE `User`.`email` = 'Wpgty9K+WB0HZuGkEnL0HEzsddlOHfkz7av6RS8U2+U=';
/home/toesettast/.pm2/logs/vocascan-server-out.log
/home/toesettast/.pm2/logs/vocascan-server-error.log  error: Error: Object.fromEntries is not a function
/home/toesettast/.pm2/logs/vocascan-server-error.log      at errorConverter (/home/toesettast/src/vocascan-server/app/Middleware/ErrorMiddleware.js:28:13)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at Layer.handle_error (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/layer.js:71:5)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at trim_prefix (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:315:13)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at /home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:284:7
/home/toesettast/.pm2/logs/vocascan-server-error.log      at Function.process_params (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:335:12)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at next (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:275:10)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at Layer.handle_error (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/layer.js:67:12)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at trim_prefix (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:315:13)
/home/toesettast/.pm2/logs/vocascan-server-error.log      at /home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:284:7
/home/toesettast/.pm2/logs/vocascan-server-error.log      at Function.process_params (/home/toesettast/src/vocascan-server/node_modules/express/lib/router/index.js:335:12)

Routes for group specific vocab activation

In order to implement the group specific activation in the frontend we need some routes in the backend.

  1. Update Route
    /api/languagePackage/:languagePackageId/group
    Add query Parameter ?staged=true to only return groups that contain unactivated/staged vocabs

  2. Update Route
    /api/group/:groupId/vocabulary
    Add query Parameter ?staged=true to only return vocabs that are unactivated

  3. Update Route
    /languagePackage/:languagePackageId/query
    Add query Parameter ?groupId={groupId}&groupId={groupId} to return only vocabs from these group
    (the staged parameter is already implemented. If groupIds are given this route should give back vocabs independently of the current status/stage. This gives the ability to add custom learning in the future vocascan/vocascan-frontend#126)

Add more configuration examples

  1. Check if existing configuration examples are still up to date and add new necessary options

  2. Add more configuration examples. Like setups with the mailer, etc.

Update Swagger Documentation for password reset

Describe the bug
The Swagger documentation currently specifies the wrong endpoint for resetting the password.

Expected behavior
The endpoint gotta be updated to the following: /api/user/reset-password

Desktop (please complete the following information):

  • OS: [e.g. macos]: macos
  • node version: v16.13.2
  • npm version: 8.3.2
  • database dialect: sqlite

Container crashes when using sqlite as DB dialect

Describe the bug
Docker container crashes on startup when current Dockerfile is used for the build or the official image, and one selects sqlite as DB backend.

To Reproduce
Steps to reproduce the behavior:
Via Dockerfile

  1. Clone repository
  2. Build docker container using docker build
  3. Change DB backend to sqlite
  4. Use official traefik installation way to start the container
  5. Container won't start, the docs will produce the below stacktrace

Via official container

  1. Use official traefik installation way to start the container
  2. Change DB backend to sqlite
  3. Container won't start, the docs will produce the below stacktrace

Expected behavior
Container should start without any problems.

Desktop (please complete the following information):

  • OS: Docker version 20.10.21, build baeda1f
  • node version: node-14.21.2
  • npm version: 6.14.17
  • database dialect: sqlite
  • commit ref: ae77ac3

Additional context
Traceback

info: loaded config file "/etc/vocascan/vocascan.config.js"
error: unhandledRejection: Please install sqlite3 package manually
Error: Please install sqlite3 package manually
    at ConnectionManager._loadDialectModule (/app/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:81:15)
    at new ConnectionManager (/app/node_modules/sequelize/lib/dialects/sqlite/connection-manager.js:24:21)
    at new SqliteDialect (/app/node_modules/sequelize/lib/dialects/sqlite/index.js:15:30)
    at new Sequelize (/app/node_modules/sequelize/lib/sequelize.js:340:20)
    at Object.db.init (/app/database/index.js:34:20)
    at createServer (/app/server.js:22:12)
    at Command.<anonymous> (/app/cmd/web.js:18:26)
    at Command.listener [as _actionHandler] (/app/node_modules/commander/lib/command.js:488:17)
    at /app/node_modules/commander/lib/command.js:1227:65

Possible solution:
I changed the Dockerfile to the following, and at least the error disappeared. Need to test further whether the container works as expected or not.

FROM node:14-alpine as builder

RUN apk add --no-cache build-base python3

WORKDIR /build

COPY ./package*.json ./

RUN npm i --only=production

FROM node:14-alpine

WORKDIR /app

COPY --from=builder /build/node_modules /app/node_modules

COPY . .

RUN npm link

# Added this line explicitly. Adding it in the builder context didn't work somehow.
RUN npm install sqlite3

CMD ["vocascan-server", "web"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.