Deploy to production #101
|
|
@ -41,9 +41,10 @@ export const updateWebBid = async (bid: Partial<IWebBid>) => {
|
|||
password,
|
||||
username,
|
||||
origin_url,
|
||||
display_name,
|
||||
active,
|
||||
arrival_offset_seconds,
|
||||
early_tracking_seconds
|
||||
early_tracking_seconds,
|
||||
} = removeFalsyValues(bid, ["active"]);
|
||||
|
||||
try {
|
||||
|
|
@ -58,7 +59,8 @@ export const updateWebBid = async (bid: Partial<IWebBid>) => {
|
|||
origin_url,
|
||||
active,
|
||||
arrival_offset_seconds,
|
||||
early_tracking_seconds
|
||||
early_tracking_seconds,
|
||||
display_name: display_name || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export interface IWebBidModelProps extends ModalProps {
|
|||
|
||||
const schema = z.object({
|
||||
username: z.string().min(1, { message: "Username is required" }),
|
||||
display_name: z.string({ message: "Display name is" }).optional(),
|
||||
password: z
|
||||
.string()
|
||||
.min(6, { message: "Password must be at least 6 characters long" }),
|
||||
|
|
@ -118,6 +119,14 @@ export default function WebAccountModal({
|
|||
label="Username"
|
||||
{...form.getInputProps("username")}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
className="col-span-2"
|
||||
size="sm"
|
||||
label="Display name"
|
||||
{...form.getInputProps("display_name")}
|
||||
/>
|
||||
|
||||
<PasswordInput
|
||||
withAsterisk
|
||||
className="col-span-2"
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ export interface IWebBid extends ITimestamp {
|
|||
origin_url: string;
|
||||
url: string | null;
|
||||
username: string | null;
|
||||
display_name: string | null;
|
||||
password: string | null;
|
||||
active: boolean;
|
||||
arrival_offset_seconds: number;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"createdAt":1752455341798}
|
||||
{"createdAt":1764726107601}
|
||||
|
|
@ -1,4 +1,11 @@
|
|||
import { IsBoolean, IsNumber, IsOptional, IsString, IsUrl, Min } from 'class-validator';
|
||||
import {
|
||||
IsBoolean,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUrl,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
|
||||
export class UpdateWebBidDto {
|
||||
@IsUrl()
|
||||
|
|
@ -13,7 +20,7 @@ export class UpdateWebBidDto {
|
|||
@Min(60)
|
||||
@IsOptional()
|
||||
arrival_offset_seconds: number;
|
||||
|
||||
|
||||
@IsNumber()
|
||||
@Min(600)
|
||||
@IsOptional()
|
||||
|
|
@ -23,6 +30,10 @@ export class UpdateWebBidDto {
|
|||
@IsOptional()
|
||||
username: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
display_name: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
password: string;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ export class WebBid extends Timestamp {
|
|||
@Column({ default: null, nullable: true })
|
||||
username: string;
|
||||
|
||||
@Column({ default: null, nullable: true })
|
||||
display_name: string;
|
||||
|
||||
@Column({ default: 300 })
|
||||
arrival_offset_seconds: number;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
import { shouldResetTool } from '@/ultils';
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Cron, CronExpression } from '@nestjs/schedule';
|
||||
import { IsNull, Not } from 'typeorm';
|
||||
import { BidsService } from './bids.service';
|
||||
import * as moment from 'moment';
|
||||
import {
|
||||
isTimeReached,
|
||||
shouldResetTool,
|
||||
subtractMinutes,
|
||||
subtractSeconds,
|
||||
} from '@/ultils';
|
||||
import { BidsService } from './bids.service';
|
||||
import { ConfigsService } from './configs.service';
|
||||
import { DashboardService } from './dashboard.service';
|
||||
import { Bid } from '../entities/bid.entity';
|
||||
@Injectable()
|
||||
export class TasksService {
|
||||
private readonly logger = new Logger(TasksService.name);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
import _ from "lodash";
|
||||
import { outBid, pushPrice, updateBid } from "../../system/apis/bid.js";
|
||||
import { sendMessage } from "../../system/apis/notification.js";
|
||||
import { createOutBidLog } from "../../system/apis/out-bid-log.js";
|
||||
import axios from "../../system/axios.js";
|
||||
import configs from "../../system/config.js";
|
||||
import CONSTANTS from "../../system/constants.js";
|
||||
import {
|
||||
convertAETtoUTC,
|
||||
isTimeReached,
|
||||
removeFalsyValues,
|
||||
takeSnapshot,
|
||||
} from "../../system/utils.js";
|
||||
import { ProductBid } from "../product-bid.js";
|
||||
import axios from "../../system/axios.js";
|
||||
|
||||
export class AllbidsProductBid extends ProductBid {
|
||||
constructor({ ...prev }) {
|
||||
|
|
@ -208,6 +205,8 @@ export class AllbidsProductBid extends ProductBid {
|
|||
|
||||
const historiesData = await this.getHistoriesData();
|
||||
|
||||
console.log({ historiesData });
|
||||
|
||||
// 📌 Nếu không có dữ liệu trả về thì dừng
|
||||
if (!result) {
|
||||
console.log(`⚠️ [${this.id}] No valid data received, skipping update.`);
|
||||
|
|
@ -226,9 +225,11 @@ export class AllbidsProductBid extends ProductBid {
|
|||
: null,
|
||||
// close_time: close_time && !this.close_time ? String(close_time) : null, // test
|
||||
name: result?.aucTitle || null,
|
||||
metadata: {
|
||||
competor_histories: historiesData,
|
||||
},
|
||||
metadata: isTimeReached(new Date(result.aucCloseUtc).toUTCString())
|
||||
? null
|
||||
: {
|
||||
competor_histories: historiesData,
|
||||
},
|
||||
},
|
||||
["close_time"]
|
||||
);
|
||||
|
|
@ -240,6 +241,22 @@ export class AllbidsProductBid extends ProductBid {
|
|||
|
||||
console.log("✅ Update successful!");
|
||||
|
||||
const currentHigherBid = historiesData[0];
|
||||
|
||||
if (
|
||||
!isTimeReached(new Date(result.aucCloseUtc).toUTCString()) &&
|
||||
currentHigherBid?.userName !== this?.web_bid?.display_name &&
|
||||
this?.web_bid?.display_name &&
|
||||
currentHigherBid?.amount === this.histories[0].price &&
|
||||
currentHigherBid?.amount >= this.max_price
|
||||
) {
|
||||
console.log(
|
||||
`⚠️ [${this.id}] ${currentHigherBid?.userName} is highter price`
|
||||
);
|
||||
|
||||
outBid(this.id);
|
||||
}
|
||||
|
||||
return { ...response, name: data.name, close_time: data.close_time };
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
import path from "path";
|
||||
import fs from "fs";
|
||||
import { createOutBidLog } from "../../system/apis/out-bid-log.js";
|
||||
import configs from "../../system/config.js";
|
||||
import {
|
||||
delay,
|
||||
extractNumber,
|
||||
getPathProfile,
|
||||
isTimeReached,
|
||||
safeClosePage,
|
||||
} from "../../system/utils.js";
|
||||
import { ApiBid } from "../api-bid.js";
|
||||
import fs from "fs";
|
||||
|
||||
export class GrayApiBid extends ApiBid {
|
||||
retry_login = 0;
|
||||
|
|
|
|||
|
|
@ -490,8 +490,10 @@ export class GraysProductBid extends ProductBid {
|
|||
// A.V - Lidcombe NSW
|
||||
const data = bids.find(
|
||||
(bid) =>
|
||||
`${bid?.UserInitials} - ${bid.UserShortAddress}` == "A.V - Lidcombe NSW"
|
||||
`${bid?.UserInitials} - ${bid.UserShortAddress}` ==
|
||||
(this.web_bid?.display_name || "A.V - Lidcombe NSW")
|
||||
);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
import _ from "lodash";
|
||||
import { outBid, pushPrice, updateBid } from "../../system/apis/bid.js";
|
||||
import { sendMessage } from "../../system/apis/notification.js";
|
||||
import { createOutBidLog } from "../../system/apis/out-bid-log.js";
|
||||
import configs from "../../system/config.js";
|
||||
import CONSTANTS from "../../system/constants.js";
|
||||
import {
|
||||
convertAETtoUTC,
|
||||
isTimeReached,
|
||||
randomDelayWithMeta,
|
||||
removeFalsyValues,
|
||||
takeSnapshot,
|
||||
} from "../../system/utils.js";
|
||||
|
|
|
|||
Loading…
Reference in New Issue