Coder Social home page Coder Social logo

light's Issues

User SignUp & SignIn & SignOut

Complete the following API:

  • User sign up
    POST /users/sign-up with username, email and password.
  • User sign in
    POST /users/sign-in with username and password.
  • User sign out
    GET /users/sign-out.

User Model

Review src/main/java/models/User.java.

Failure about running Travis.

I run all the tests successfully in my own environment, whereas when pushing up and trying merging my branch into your master branch, the Travis logged and displayed errors as below:

Tests in error: 
  ``SubmissionTest.TestXXX:24 » DuplicateKey Write failed with error code 11000 an...``
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.093 s
[INFO] Finished at: 2017-03-03T07:24:51+00:00
[INFO] Final Memory: 25M/335M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project orange-juice: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/travis/build/zccz14/Orange-Juice-Java/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The command "mvn package" exited with 1.
cache.2
store build cache
0.00s
5.45schange detected (content changed, file is created, or file is deleted):
/home/travis/.m2/repository/com/funcxy/oj/orange-juice/1.0-SNAPSHOT/maven-metadata-local.xml
/home/travis/.m2/repository/com/funcxy/oj/orange-juice/1.0-SNAPSHOT/orange-juice-1.0-SNAPSHOT.jar
/home/travis/.m2/repository/com/funcxy/oj/orange-juice/1.0-SNAPSHOT/_remote.repositories
/home/travis/.m2/repository/com/funcxy/oj/orange-juice/maven-metadata-local.xml
changes detected, packing new archive
uploading archive
Done. Your build exited with 1.

which showing it ran 3 tests, but just 2 on mine. And the file containing the error information hinted by Travis is not my own.

So I don't think my code containing errors. Just merge my branch.

Consider a new resource representation to replace JSON partly.

Protocol Buffers(GFW proxy required) are a language-neutral, platform-neutral extensible mechanism for serializing structured data.

So the official website showed.
On which plenty of Google projects used as resource(data) representation.

This is a long term enhancement. Consider it only when we met the performance bottleneck of data transmission. And for the readability, JSON is the peerless choice.

So take it easy, as a interesting new tech to know.

Error Handling

We need a series of Error class to help with error handling.

Problem Model

Review src/main/java/com/funcxy/oj/models/Problem.java

Some problems occur when coding ProblemController's GET method..

Here is my router for GET in problem controller:

  @RequestMapping(method = RequestMethod.GET)
    public List<Problem> getProblem(Problem problem){
        return problemService.find(problem);
    }

And codes for find() in problemService:

 public List<Problem> find(Problem problem) {
        List<Problem> problemList = new ArrayList<>();
        if (problem.getType() != null)
            problemList.addAll(findByType(problem.getType()));
        System.out.println(problemList);
        if (problem.getTitle() != null)
            problemList.retainAll(findByTitle(problem.getTitle()));
        System.out.println(problemList);
        if (problem.getCreator() != null)
            problemList.addAll(findByCreator(problem.getCreator()));
        return problemList;
    }

And according to the discussion before, users can use title or type or creator or some other things to identify a sort of problems. So here comes the dilemma: if a user uses both type and title to identify a specific problem(more precisely, many problems whose type and title are the same.), we need to get the intersection of problems from both findByType() and findByTitle()(Right?).
But the method retainAll() in interface List<> just compares the references rather than their inner contents, when we try getting the intersection from those two methods, we will get none.(Because we access MongoDB twice, so the two methods actually give back two different references.)

How to solve this? Maybe solve it in the front-end? @zccz14 @zccz14 @zccz14

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.