susansli / augury

Augury is a web application that uses AI to help users decide which stocks to buy. In addition, it displays data pertaining to the portfolios the user has saved, such as current valuation of all stocks held.
0 stars 0 forks source link

[User Account] [Backend] Create unified API for updating the user's portfolio defaults and account balance #65

Open susansli opened 2 weeks ago

susansli commented 2 weeks ago

Story

As a system, I should only be making one HTTP request to update the user's information after I add portfolio defaults and initial account balance.

Pre-requisites

Acceptance

LukarioMC commented 2 weeks ago

Impl in: #84

Endpoint: POST {{server_url}}/user/onboard

Interface:

Interfaces for client onboarding request & response

interface OnboardingRequestBody {
  id: string;
  balance: number;
  defaults: Portfolio;
}

interface OnboardingResponse {
  user: User;
  defaults: PortfolioDefault;
}

These are the current defs for each custom type above:

export default interface Portfolio extends Identifiable {
  name: string; // Portfolio name
  risk?: PortfolioRisk; // Optional risk if `useCustomRisk` is true
  useCustomRisk: boolean; // If true, indicates custom risk settings are used
  customRiskPercentage1?: number; // First custom percentage value if using custom risk
  customRiskPercentage2?: number; // Second custom percentage value if using custom risk
  sectorTags?: Sectors[]; // Array of sector tags
}

export default interface PortfolioDefault extends Portfolio {
  userId: Types.ObjectId | string;
}