mshumba / CodeU23

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring 2019 CodeU Project

Usage of Datastore

When retrieving information about usesr:

  1. Prepare:
import com.google.codeu.service.Session;
Session session = new Session();
  1. Check if the user is logged in. Returns boolean value of whether is logged in
session.isLoggedIn(request,response);
  • If not logged in,
response.sendRedirect("/login");
  1. If logged in,query the datastore
 \\if you want to look up users with the key-value pair property
  List<User> users = datastore.findUserBy(key,value);
 \\ if you want to find the user that is currently logged in.
  User user = session.getCurrentUser(request,response);

Current User data structure

  private String userName;
  private String gender;
  private String email;
  private String birthday;
  private String description;

If you want to add other data field, please update the findUserBy and getCurrentUser method. It should be pretty straight forward how to update it.

About

License:Apache License 2.0


Languages

Language:Java 53.2%Language:HTML 24.7%Language:JavaScript 18.5%Language:CSS 3.5%