mirror of https://github.com/ghostfolio/ghostfolio
				
				
			
			
			
				Browse Source
			
			
			
			
				
		* Add symbol profile model and positions by country chart * Add positions by continent chart * Fix tests * Extend seed * Update changelogpull/149/head
							committed by
							
								
								GitHub
							
						
					
				
				 17 changed files with 283 additions and 24 deletions
			
			
		@ -0,0 +1,6 @@ | 
				
			|||
export interface Country { | 
				
			|||
  code: string; | 
				
			|||
  continent: string; | 
				
			|||
  name: string; | 
				
			|||
  weight: number; | 
				
			|||
} | 
				
			|||
@ -1,5 +1,8 @@ | 
				
			|||
import { Account, Order, Platform } from '@prisma/client'; | 
				
			|||
import { Account, Order, Platform, SymbolProfile } from '@prisma/client'; | 
				
			|||
 | 
				
			|||
type AccountWithPlatform = Account & { Platform?: Platform }; | 
				
			|||
 | 
				
			|||
export type OrderWithAccount = Order & { Account?: AccountWithPlatform }; | 
				
			|||
export type OrderWithAccount = Order & { | 
				
			|||
  Account?: AccountWithPlatform; | 
				
			|||
  SymbolProfile?: SymbolProfile; | 
				
			|||
}; | 
				
			|||
 | 
				
			|||
@ -0,0 +1,21 @@ | 
				
			|||
-- AlterTable | 
				
			|||
ALTER TABLE "Order" ADD COLUMN     "symbolProfileId" TEXT; | 
				
			|||
 | 
				
			|||
-- CreateTable | 
				
			|||
CREATE TABLE "SymbolProfile" ( | 
				
			|||
    "countries" JSONB, | 
				
			|||
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | 
				
			|||
    "dataSource" "DataSource" NOT NULL, | 
				
			|||
    "id" TEXT NOT NULL, | 
				
			|||
    "name" TEXT, | 
				
			|||
    "updatedAt" TIMESTAMP(3) NOT NULL, | 
				
			|||
    "symbol" TEXT NOT NULL, | 
				
			|||
 | 
				
			|||
    PRIMARY KEY ("id") | 
				
			|||
); | 
				
			|||
 | 
				
			|||
-- CreateIndex | 
				
			|||
CREATE UNIQUE INDEX "SymbolProfile.dataSource_symbol_unique" ON "SymbolProfile"("dataSource", "symbol"); | 
				
			|||
 | 
				
			|||
-- AddForeignKey | 
				
			|||
ALTER TABLE "Order" ADD FOREIGN KEY ("symbolProfileId") REFERENCES "SymbolProfile"("id") ON DELETE SET NULL ON UPDATE CASCADE; | 
				
			|||
					Loading…
					
					
				
		Reference in new issue