Giter Club home page Giter Club logo

feedback's Introduction

Feedback

This is a project that is on its way to become a feedback website for users. There is more info under the subfolders.

Goal:

A café would like to implement a web site where customers can give feedback on their experience in the cafe.

DB: Tables in DB for client_info and feedback

Backend: Web service with REST interface to read and write from DB.

Frontend: Implement a front end page for users give feedback as below:

  • User login to the site (using data from client_info table in DB through the web service)
  • User sees his old feedbacks, but user cannot change them.
  • User should be able to add a new feedback.
  • Admin users should be able to see all other users feedbacks.
  • Admin users should have extra view for statistics (just overall view).

Languages

  • Back end dev : Java(Spring Framework)
  • Front end dev:
    • For beautiful stats: JavaScript(d3js)
    • Everything else: Typescript(Angular)
  • DevOps: Git + Maven
  • Databases: Mysql

feedback's People

Contributors

lastbeel avatar

Watchers

James Cloos avatar

feedback's Issues

Login Rework

The workflow for login.

Interfaces:

import com.example.model.User;

import java.util.Optional;

public interface UserAuthenticationService {

  /**
   * Logs in with the given {@code username} and {@code password}.
   *
   * @param username
   * @param password
   * @return an {@link Optional} of a user when login succeeds
   */
  Optional<String> login(String username, String password);

  /**
   * Finds a user by its dao-key.
   *
   * @param token user dao key
   * @return
   */
  Optional<User> findByToken(String token);

  /**
   * Logs out the given input {@code user}.
   *
   * @param user the user to logout
   */
  void logout(User user);
}
import java.util.Optional;
import java.util.UUID;
import java.util.HashMap;

final class UUIDAuthenticationService implements UserAuthenticationService {
  private HashMap<String, ##USER_ID_TYPE##> users;

  @Override
  public Optional<String> login(final String username, final String password) {
    final String uuid = UUID.randomUUID().toString();
    // Validate that the username & password is correct
    if (!OK_password_and_username) {
      return Optional.empty()
    }
    // Get the user id from username
    users.put(uuid, ##USER_ID##) 
    return Optional.of(uuid);
  }

  @Override
  public Optional<User> findByToken(final String uuid) {
    return users.get(uuid);
  }

  @Override
  public void logout(final String uuid) {
    users.remove(uuid)
  }
}
import com.example.model.Feedback;
import com.example.service.FeedbackService;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping(path = "/feedback")
public class LoginController {
    @Autowired
    private UUIDAuthenticationService uuidAuth;

    @GetMapping(path = "/login")
    public @ResponseBody
    String login(@RequestParam String username, @RequestParam String password) {
      Optional<String> os = uuidAuth.login(username, password);
      if (os.isPresent()) {
        return os.get();
      }
      return "";
    }

    @GetMapping(path = "/logout")
    public @ResponseBody
    void logout(@RequestParam int uuid) {
        uuidAuth.logout(uuid);
    }
}

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.