Commit 7a23de70 authored by nanahira's avatar nanahira

fix some queries and logs

parent f8965365
Pipeline #1259 passed with stages
in 10 minutes and 24 seconds
......@@ -54,7 +54,7 @@ class DataManager {
try {
const replays = await this.db.createQueryBuilder(CloudReplay_1.CloudReplay, "replay")
.where("exists (select id from cloud_replay_player where cloud_replay_player.cloudReplayId = replay.id and cloud_replay_player.key = :key)", { key })
.orderBy("replay.date", "DESC")
.orderBy("replay.id", "DESC")
.limit(10)
.leftJoinAndSelect("replay.players", "player")
.getMany();
......
......@@ -75,7 +75,7 @@ export class DataManager {
try {
const replays = await this.db.createQueryBuilder(CloudReplay, "replay")
.where("exists (select id from cloud_replay_player where cloud_replay_player.cloudReplayId = replay.id and cloud_replay_player.key = :key)", { key })
.orderBy("replay.date", "DESC")
.orderBy("replay.id", "DESC")
.limit(10)
.leftJoinAndSelect("replay.players", "player")
.getMany();
......
......@@ -45,6 +45,7 @@ __decorate([
__metadata("design:type", String)
], CloudReplay.prototype, "data", void 0);
__decorate([
typeorm_1.Index(),
typeorm_1.Column({ type: "datetime" }),
__metadata("design:type", Date)
], CloudReplay.prototype, "date", void 0);
......@@ -53,7 +54,11 @@ __decorate([
__metadata("design:type", Array)
], CloudReplay.prototype, "players", void 0);
CloudReplay = __decorate([
typeorm_1.Entity()
typeorm_1.Entity({
orderBy: {
id: "DESC"
}
})
], CloudReplay);
exports.CloudReplay = CloudReplay;
//# sourceMappingURL=CloudReplay.js.map
\ No newline at end of file
import {Column, Entity, OneToMany, PrimaryColumn} from "typeorm";
import {Column, Entity, Index, OneToMany, PrimaryColumn} from "typeorm";
import {CloudReplayPlayer} from "./CloudReplayPlayer";
import _ from "underscore";
import moment from "moment";
@Entity()
@Entity({
orderBy: {
id: "DESC"
}
})
export class CloudReplay {
@PrimaryColumn({ unsigned: true, type: "bigint" })
id: number;
......@@ -19,6 +23,7 @@ export class CloudReplay {
return Buffer.from(this.data, "base64");
}
@Index()
@Column({ type: "datetime" })
date: Date;
......
......@@ -50,6 +50,7 @@ __decorate([
__metadata("design:type", Number)
], DuelLog.prototype, "id", void 0);
__decorate([
typeorm_1.Index(),
typeorm_1.Column("datetime"),
__metadata("design:type", Date)
], DuelLog.prototype, "time", void 0);
......@@ -83,7 +84,11 @@ __decorate([
__metadata("design:type", Array)
], DuelLog.prototype, "players", void 0);
DuelLog = __decorate([
typeorm_1.Entity()
typeorm_1.Entity({
orderBy: {
id: "DESC"
}
})
], DuelLog);
exports.DuelLog = DuelLog;
//# sourceMappingURL=DuelLog.js.map
\ No newline at end of file
......@@ -3,11 +3,16 @@ import {DuelLogPlayer} from "./DuelLogPlayer";
import moment from "moment";
import _ from "underscore";
@Entity()
@Entity({
orderBy: {
id: "DESC"
}
})
export class DuelLog {
@PrimaryGeneratedColumn({unsigned: true, type: "bigint"})
id: number;
@Index()
@Column("datetime")
time: Date;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment