Add soruceUrl to SraOrder entity
This commit is contained in:
		@@ -7,6 +7,7 @@ export class SraOrder extends BaseEntity {
 | 
				
			|||||||
    @PrimaryColumn() public exchangeAddress!: string;
 | 
					    @PrimaryColumn() public exchangeAddress!: string;
 | 
				
			||||||
    @PrimaryColumn() public orderHashHex!: string;
 | 
					    @PrimaryColumn() public orderHashHex!: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Column() public sourceUrl!: string;
 | 
				
			||||||
    @Column() public lastUpdatedTimestamp!: number;
 | 
					    @Column() public lastUpdatedTimestamp!: number;
 | 
				
			||||||
    @Column() public firstSeenTimestamp!: number;
 | 
					    @Column() public firstSeenTimestamp!: number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,10 +47,12 @@ async function getSraOrdersAsync(): Promise<void> {
 | 
				
			|||||||
    const orderRepository = connection.getRepository(SraOrder);
 | 
					    const orderRepository = connection.getRepository(SraOrder);
 | 
				
			||||||
    console.log(`found ${await orderRepository.count()} existing orders`);
 | 
					    console.log(`found ${await orderRepository.count()} existing orders`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const connect = new HttpClient('https://api.radarrelay.com/0x/v2');
 | 
					    const sraUrl = 'https://api.radarrelay.com/0x/v2';
 | 
				
			||||||
 | 
					    const connect = new HttpClient(sraUrl);
 | 
				
			||||||
    const rawOrders = await connect.getOrdersAsync();
 | 
					    const rawOrders = await connect.getOrdersAsync();
 | 
				
			||||||
    const orders = parseSraOrders(rawOrders);
 | 
					    const orders = parseSraOrders(rawOrders);
 | 
				
			||||||
    for (const order of orders) {
 | 
					    for (const order of orders) {
 | 
				
			||||||
 | 
					        order.sourceUrl = sraUrl;
 | 
				
			||||||
        order.save();
 | 
					        order.save();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    console.log(`now there are ${await orderRepository.count()} total orders`);
 | 
					    console.log(`now there are ${await orderRepository.count()} total orders`);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user