Team-Real-Ninjas / MyInvestments

This project is creating a personal investment portfolio. Allowing users to input there investments and see it graphical form. Create posts about...
MIT License
0 stars 0 forks source link

MyInvestments

Table Of Contents

  1. Overview
  2. Product Spec
  3. Wireframes
  4. Schema

Overview

Description

MyInvestments is a personal investment portfolio. It is a platform that allows for the monitoring of BTC(Bitcoin), ETH(Etherum), GLD(Gold), and SLVR(Silver) stocks in real-time. MyInvestments also allow users to input their investments and see them in graphical or listed form. Finally users can create posts in their Investment Blogs.

App Evaluation

Product Spec

1. User Stories (Required and Optional)

Required Must-have Stories

[x] User should be able to log in using secure password and email

Optional Nice-to-have Stories

2. Screens

3. Navigation

Tab Navigation (Menu to Screen)

Optional:

Flow Navigation (Screen to Screen)

Wireframes

Wireframe

Digital Wireframes & Mockups

Project

Interactive Wireframe

https://www.figma.com/proto/l9BzgvDghVJnCfdYsJzxHx/MyInvestSmart?node-id=19%3A88&scaling=min-zoom&page-id=0%3A1&starting-point-node-id=2%3A2

Schema

Models

User

Property Type Description
userId String unique id for the user (default field)
firstName String first name of user
lastName String last name of user
phoneNumber String phone number of user
username String username of user
password String password of user
emailAddress String email address of user
admin Boolean determines if user is an admin or not

Investments

Property Type Description
investmentId String unique id for the investment (default field)
createdBy Refrence to USER user associated with this Investment INPUT
type String type of investment
comment String detail about type of investment
purchaseAmount Float price of investment
stockAmount Number price of stock at the time of investment
createdAt DateTime date when investment is created (default field)
updatedAt DateTime date when investment is last updated (default field)

Posts

Property Type Description
postId String unique id for the post (default field)
author Refrence to USER user associated with post
contents String contents of post
likes Number number of likes on post
tags Array tags associated with post
showComments Bool decides whether to display contents or not
title String title of post
createdAt DateTime date when post is created (default field)
updatedAt DateTime date when post is last updated (default field)

Comments

Property Type Description
commentId String unique id for the comment post (default field)
contents String contents of comment
likes Number number of likes on post
user Refrence to USER user associated with comment
post Refrence to POST post associated with user
createdAt DateTime date when post is created (default field)
updatedAt DateTime date when post is last updated (default field)

Session

Property Type Description
sessionId String unique id for the session (default field)
sessionToken String unique id for the session token (default field)
user Pointer to User user associated with session
restricted Bool determines if session is restricted or not
installationId String unique id for session installation (default field)
createdWith Object action used to create session (i.e. login)
createdAt DateTime date when session is created (default field)
updatedAt DateTime date when session is last updated (default field)
expiresAt DateTime date when session expires (default field)

Networking

List of network requests by screen

    public Post getPostById(String id)throws ExecutionException, InterruptedException{
        Post post = null;
        //database connection object
        Firestore db = FirestoreClient.getFirestore();
        //retrieves a reference to the document(row) of the collection (table) with a specific id
        DocumentReference postRef = db.collection("Post").document(id);

        //ApiFuture allows us to make async calls to the database
        ApiFuture<DocumentSnapshot> future = postRef.get();
        //Retrieve document
        DocumentSnapshot document = future.get();

            //Convert JSON into Post class object
            if(document.exists())
            {
            UserService service = new UserService();

            DocumentReference userRef = (DocumentReference) document.get("author");
            ApiFuture<DocumentSnapshot> userQuery = userRef.get();
            DocumentSnapshot userDoc = userQuery.get();
            User user = userDoc.toObject(User.class);

            post =  new Post(document.getId(), document.getString("title") , document.getString("content"),
                (ArrayList<String>) document.get("tags"), document.getBoolean("showComments")
                , document.getLong("likes"), user);
            }

        return post;
     }
- (Create/POST) Create a new post
    public String createPost(RestPost post) throws ExecutionException, InterruptedException{
        //database connection object
        Firestore db = FirestoreClient.getFirestore();
        ApiFuture<DocumentReference> postRef = db.collection("Post").add(post);
        return postRef.get().getId();
    }
- (Create/POST) Create a new comment on a post
- (Delete) Delete existing comment
    public Boolean deleteComment(String  num) throws ExecutionException, InterruptedException{
        //database connection object
        Firestore db = FirestoreClient.getFirestore();
        ApiFuture<WriteResult> writeResult = db.collection("Comment").document(num).delete();
    if( writeResult.get().getUpdateTime() != null)
        return true;

         return false;
    }
     public RestUser updateUserProfileImage(String num) throws ExecutionException, InterruptedException {
        ObjectMapper mapObject = new ObjectMapper();
        Firestore db = FirestoreClient.getFirestore();

        DocumentReference userRef = db.collection("User").document(id)
          DocumentSnapshot docs = (DocumentSnapshot) userRef.get().get();

        //ApiFuture allows uss to make async calls to database
        ApiFuture<QuerySnapshot> futurepNum = query.get();
        List<QueryDocumentSnapshot> docs = futurepNum.get().getDocuments();

        if(docs.size() > 0){
            DocumentReference doc = docs.get(0).getReference();
            //String refers to value name ... Object is what we are passing into it
            Map<String, Object> update = new HashMap<>();
            update.put("profileImage", user.getProfileImage());

            //Async Document Update
            ApiFuture<WriteResult> writeResult = doc.update(update);
        }
        return user;
     }

[IF EXISTS:] Existing API Endpoints

Polygon Stock API

- Base URL - (https://polygon.io/docs/getting-started)     
HTTP Verb EndPoint Description
GET v2/reference/news Get the most recent news articles relating to a stock ticker symbol, including a summary of the article and a link to the original source.
GET /v1/marketstatus/now Get the current trading status of the exchanges and overall financial markets.
GET /vX/reference/tickers/{ticker} Get a single ticker supported by Polygon.io. The response will have detailed information about the ticker and the company behind it.
GET /v1/open-close/crypto/{from}/{to}/{date} Get the open, close prices of a cryptocurrency symbol on a certain day.

Build Progress

gifs/pictures unavailable, build still in progress