mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-06 16:53:58 +09:00
fix lint
This commit is contained in:
@ -37,11 +37,11 @@ export default class ActiveUsersChart extends Chart<ActiveUsersLog> {
|
||||
@autobind
|
||||
public async update(user: { id: User['id'], host: User['host'] }) {
|
||||
const update: Obj = {
|
||||
users: [user.id]
|
||||
users: [user.id],
|
||||
};
|
||||
|
||||
await this.inc({
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export default class DriveChart extends Chart<DriveLog> {
|
||||
remote: {
|
||||
totalCount: latest.remote.totalCount,
|
||||
totalSize: latest.remote.totalSize,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ export default class DriveChart extends Chart<DriveLog> {
|
||||
DriveFiles.count({ userHost: null }),
|
||||
DriveFiles.count({ userHost: Not(IsNull()) }),
|
||||
DriveFiles.calcDriveUsageOfLocal(),
|
||||
DriveFiles.calcDriveUsageOfRemote()
|
||||
DriveFiles.calcDriveUsageOfRemote(),
|
||||
]);
|
||||
|
||||
return {
|
||||
@ -66,7 +66,7 @@ export default class DriveChart extends Chart<DriveLog> {
|
||||
remote: {
|
||||
totalCount: remoteCount,
|
||||
totalSize: remoteSize,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ export default class DriveChart extends Chart<DriveLog> {
|
||||
}
|
||||
|
||||
await this.inc({
|
||||
[file.userHost === null ? 'local' : 'remote']: update
|
||||
[file.userHost === null ? 'local' : 'remote']: update,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export default class FederationChart extends Chart<FederationLog> {
|
||||
return {
|
||||
instance: {
|
||||
total: latest.instance.total,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,13 +34,13 @@ export default class FederationChart extends Chart<FederationLog> {
|
||||
@autobind
|
||||
protected async fetchActual(): Promise<DeepPartial<FederationLog>> {
|
||||
const [total] = await Promise.all([
|
||||
Instances.count({})
|
||||
Instances.count({}),
|
||||
]);
|
||||
|
||||
return {
|
||||
instance: {
|
||||
total: total,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ export default class FederationChart extends Chart<FederationLog> {
|
||||
}
|
||||
|
||||
await this.inc({
|
||||
instance: update
|
||||
instance: update,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ export default class HashtagChart extends Chart<HashtagLog> {
|
||||
@autobind
|
||||
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }) {
|
||||
const update: Obj = {
|
||||
users: [user.id]
|
||||
users: [user.id],
|
||||
};
|
||||
|
||||
await this.inc({
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
|
||||
}, hashtag);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
drive: {
|
||||
totalFiles: latest.drive.totalFiles,
|
||||
totalUsage: latest.drive.totalUsage,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
drive: {
|
||||
totalFiles: driveFiles,
|
||||
totalUsage: driveUsage,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -122,8 +122,8 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
public async requestReceived(host: string) {
|
||||
await this.inc({
|
||||
requests: {
|
||||
received: 1
|
||||
}
|
||||
received: 1,
|
||||
},
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
}
|
||||
|
||||
await this.inc({
|
||||
requests: update
|
||||
requests: update,
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@ -147,8 +147,8 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
await this.inc({
|
||||
users: {
|
||||
total: 1,
|
||||
inc: 1
|
||||
}
|
||||
inc: 1,
|
||||
},
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@ -169,8 +169,8 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
total: isAdditional ? 1 : -1,
|
||||
inc: isAdditional ? 1 : 0,
|
||||
dec: isAdditional ? 0 : 1,
|
||||
diffs: diffs
|
||||
}
|
||||
diffs: diffs,
|
||||
},
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
total: isAdditional ? 1 : -1,
|
||||
inc: isAdditional ? 1 : 0,
|
||||
dec: isAdditional ? 0 : 1,
|
||||
}
|
||||
},
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
total: isAdditional ? 1 : -1,
|
||||
inc: isAdditional ? 1 : 0,
|
||||
dec: isAdditional ? 0 : 1,
|
||||
}
|
||||
},
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||
}
|
||||
|
||||
await this.inc({
|
||||
drive: update
|
||||
drive: update,
|
||||
}, file.userHost);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export default class NetworkChart extends Chart<NetworkLog> {
|
||||
incomingRequests: incomingRequests,
|
||||
totalTime: time,
|
||||
incomingBytes: incomingBytes,
|
||||
outgoingBytes: outgoingBytes
|
||||
outgoingBytes: outgoingBytes,
|
||||
};
|
||||
|
||||
await this.inc(inc);
|
||||
|
@ -21,7 +21,7 @@ export default class NotesChart extends Chart<NotesLog> {
|
||||
},
|
||||
remote: {
|
||||
total: latest.remote.total,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ export default class NotesChart extends Chart<NotesLog> {
|
||||
protected async fetchActual(): Promise<DeepPartial<NotesLog>> {
|
||||
const [localCount, remoteCount] = await Promise.all([
|
||||
Notes.count({ userHost: null }),
|
||||
Notes.count({ userHost: Not(IsNull()) })
|
||||
Notes.count({ userHost: Not(IsNull()) }),
|
||||
]);
|
||||
|
||||
return {
|
||||
@ -64,14 +64,14 @@ export default class NotesChart extends Chart<NotesLog> {
|
||||
},
|
||||
remote: {
|
||||
total: remoteCount,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(note: Note, isAdditional: boolean) {
|
||||
const update: Obj = {
|
||||
diffs: {}
|
||||
diffs: {},
|
||||
};
|
||||
|
||||
update.total = isAdditional ? 1 : -1;
|
||||
@ -91,7 +91,7 @@ export default class NotesChart extends Chart<NotesLog> {
|
||||
}
|
||||
|
||||
await this.inc({
|
||||
[note.userHost === null ? 'local' : 'remote']: update
|
||||
[note.userHost === null ? 'local' : 'remote']: update,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ export default class PerUserDriveChart extends Chart<PerUserDriveLog> {
|
||||
protected async fetchActual(group: string): Promise<DeepPartial<PerUserDriveLog>> {
|
||||
const [count, size] = await Promise.all([
|
||||
DriveFiles.count({ userId: group }),
|
||||
DriveFiles.calcDriveUsageOf(group)
|
||||
DriveFiles.calcDriveUsageOf(group),
|
||||
]);
|
||||
|
||||
return {
|
||||
|
@ -22,7 +22,7 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||
},
|
||||
followers: {
|
||||
total: latest.local.followers.total,
|
||||
}
|
||||
},
|
||||
},
|
||||
remote: {
|
||||
followings: {
|
||||
@ -30,8 +30,8 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||
},
|
||||
followers: {
|
||||
total: latest.remote.followers.total,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -71,12 +71,12 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||
localFollowingsCount,
|
||||
localFollowersCount,
|
||||
remoteFollowingsCount,
|
||||
remoteFollowersCount
|
||||
remoteFollowersCount,
|
||||
] = await Promise.all([
|
||||
Followings.count({ followerId: group, followeeHost: null }),
|
||||
Followings.count({ followeeId: group, followerHost: null }),
|
||||
Followings.count({ followerId: group, followeeHost: Not(IsNull()) }),
|
||||
Followings.count({ followeeId: group, followerHost: Not(IsNull()) })
|
||||
Followings.count({ followeeId: group, followerHost: Not(IsNull()) }),
|
||||
]);
|
||||
|
||||
return {
|
||||
@ -86,7 +86,7 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||
},
|
||||
followers: {
|
||||
total: localFollowersCount,
|
||||
}
|
||||
},
|
||||
},
|
||||
remote: {
|
||||
followings: {
|
||||
@ -94,8 +94,8 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||
},
|
||||
followers: {
|
||||
total: remoteFollowersCount,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -112,10 +112,10 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||
}
|
||||
|
||||
this.inc({
|
||||
[Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update }
|
||||
[Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update },
|
||||
}, follower.id);
|
||||
this.inc({
|
||||
[Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update }
|
||||
[Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update },
|
||||
}, followee.id);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export default class PerUserNotesChart extends Chart<PerUserNotesLog> {
|
||||
@autobind
|
||||
public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean) {
|
||||
const update: Obj = {
|
||||
diffs: {}
|
||||
diffs: {},
|
||||
};
|
||||
|
||||
update.total = isAdditional ? 1 : -1;
|
||||
|
@ -38,7 +38,7 @@ export default class PerUserReactionsChart extends Chart<PerUserReactionsLog> {
|
||||
@autobind
|
||||
public async update(user: { id: User['id'], host: User['host'] }, note: Note) {
|
||||
this.inc({
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 }
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 },
|
||||
}, note.userId);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ export default class TestGroupedChart extends Chart<TestGroupedLog> {
|
||||
this.total[group]++;
|
||||
|
||||
await this.inc({
|
||||
foo: update
|
||||
foo: update,
|
||||
}, group);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export default class TestUniqueChart extends Chart<TestUniqueLog> {
|
||||
@autobind
|
||||
public async uniqueIncrement(key: string) {
|
||||
await this.inc({
|
||||
foo: [key]
|
||||
foo: [key],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export default class TestChart extends Chart<TestLog> {
|
||||
this.total++;
|
||||
|
||||
await this.inc({
|
||||
foo: update
|
||||
foo: update,
|
||||
});
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ export default class TestChart extends Chart<TestLog> {
|
||||
this.total--;
|
||||
|
||||
await this.inc({
|
||||
foo: update
|
||||
foo: update,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ export default class UsersChart extends Chart<UsersLog> {
|
||||
},
|
||||
remote: {
|
||||
total: latest.remote.total,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ export default class UsersChart extends Chart<UsersLog> {
|
||||
protected async fetchActual(): Promise<DeepPartial<UsersLog>> {
|
||||
const [localCount, remoteCount] = await Promise.all([
|
||||
Users.count({ host: null }),
|
||||
Users.count({ host: Not(IsNull()) })
|
||||
Users.count({ host: Not(IsNull()) }),
|
||||
]);
|
||||
|
||||
return {
|
||||
@ -54,7 +54,7 @@ export default class UsersChart extends Chart<UsersLog> {
|
||||
},
|
||||
remote: {
|
||||
total: remoteCount,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ export default class UsersChart extends Chart<UsersLog> {
|
||||
}
|
||||
|
||||
await this.inc({
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update
|
||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export const logSchema = {
|
||||
items: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -22,14 +22,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'activeUsers';
|
||||
|
@ -55,14 +55,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'drive';
|
||||
|
@ -21,9 +21,9 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'federation';
|
||||
|
@ -8,7 +8,7 @@ export const logSchema = {
|
||||
items: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -22,14 +22,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'hashtag';
|
||||
|
@ -21,7 +21,7 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
notes: {
|
||||
@ -59,9 +59,9 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
users: {
|
||||
@ -80,7 +80,7 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
following: {
|
||||
@ -99,7 +99,7 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
followers: {
|
||||
@ -118,7 +118,7 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
drive: {
|
||||
@ -149,9 +149,9 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'instance';
|
||||
|
@ -25,7 +25,7 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'network';
|
||||
|
@ -32,7 +32,7 @@ const logSchema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -43,14 +43,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'notes';
|
||||
|
@ -49,7 +49,7 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'perUserDrive';
|
||||
|
@ -29,7 +29,7 @@ export const logSchema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ export const logSchema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -73,14 +73,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'perUserFollowing';
|
||||
|
@ -35,9 +35,9 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'perUserNotes';
|
||||
|
@ -18,14 +18,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'perUserReaction';
|
||||
|
@ -20,9 +20,9 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'testGrouped';
|
||||
|
@ -8,9 +8,9 @@ export const schema = {
|
||||
items: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'testUnique';
|
||||
|
@ -20,9 +20,9 @@ export const schema = {
|
||||
type: 'number' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'test';
|
||||
|
@ -31,14 +31,14 @@ export const schema = {
|
||||
local: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
properties: logSchema
|
||||
properties: logSchema,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const name = 'users';
|
||||
|
@ -188,7 +188,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
id: {
|
||||
type: 'integer',
|
||||
primary: true,
|
||||
generated: true
|
||||
generated: true,
|
||||
},
|
||||
date: {
|
||||
type: 'integer',
|
||||
@ -196,9 +196,9 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
group: {
|
||||
type: 'varchar',
|
||||
length: 128,
|
||||
nullable: true
|
||||
nullable: true,
|
||||
},
|
||||
...Chart.convertSchemaToFlatColumnDefinitions(schema)
|
||||
...Chart.convertSchemaToFlatColumnDefinitions(schema),
|
||||
},
|
||||
indices: [{
|
||||
columns: ['date', 'group'],
|
||||
@ -206,8 +206,8 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
}, { // groupにnullが含まれると↑のuniqueは機能しないので↓の部分インデックスでカバー
|
||||
columns: ['date'],
|
||||
unique: true,
|
||||
where: '"group" IS NULL'
|
||||
}]
|
||||
where: '"group" IS NULL',
|
||||
}],
|
||||
});
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
if (grouped) keys.push('group');
|
||||
|
||||
entity.options.uniques = [{
|
||||
columns: keys
|
||||
columns: keys,
|
||||
}];
|
||||
|
||||
this.repository = getRepository<Log>(entity);
|
||||
@ -252,8 +252,8 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
group: group,
|
||||
}, {
|
||||
order: {
|
||||
date: -1
|
||||
}
|
||||
date: -1,
|
||||
},
|
||||
}).then(x => x || null);
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
// 現在(=今のHour)のログ
|
||||
const currentLog = await this.repository.findOne({
|
||||
date: Chart.dateToTimestamp(current),
|
||||
...(group ? { group: group } : {})
|
||||
...(group ? { group: group } : {}),
|
||||
});
|
||||
|
||||
// ログがあればそれを返して終了
|
||||
@ -308,7 +308,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
// ロック内でもう1回チェックする
|
||||
const currentLog = await this.repository.findOne({
|
||||
date: date,
|
||||
...(group ? { group: group } : {})
|
||||
...(group ? { group: group } : {}),
|
||||
});
|
||||
|
||||
// ログがあればそれを返して終了
|
||||
@ -318,7 +318,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
log = await this.repository.insert({
|
||||
group: group,
|
||||
date: date,
|
||||
...Chart.convertObjectToFlattenColumns(data)
|
||||
...Chart.convertObjectToFlattenColumns(data),
|
||||
}).then(x => this.repository.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
logger.info(`${this.name + (group ? `:${group}` : '')}: New commit created`);
|
||||
@ -424,10 +424,10 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
let logs = await this.repository.find({
|
||||
where: {
|
||||
group: group,
|
||||
date: Between(Chart.dateToTimestamp(gt), Chart.dateToTimestamp(lt))
|
||||
date: Between(Chart.dateToTimestamp(gt), Chart.dateToTimestamp(lt)),
|
||||
},
|
||||
order: {
|
||||
date: -1
|
||||
date: -1,
|
||||
},
|
||||
});
|
||||
|
||||
@ -439,7 +439,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
group: group,
|
||||
}, {
|
||||
order: {
|
||||
date: -1
|
||||
date: -1,
|
||||
},
|
||||
});
|
||||
|
||||
@ -453,10 +453,10 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||
// (隙間埋めできないため)
|
||||
const outdatedLog = await this.repository.findOne({
|
||||
group: group,
|
||||
date: LessThan(Chart.dateToTimestamp(gt))
|
||||
date: LessThan(Chart.dateToTimestamp(gt)),
|
||||
}, {
|
||||
order: {
|
||||
date: -1
|
||||
date: -1,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -11,5 +11,5 @@ export const entities = Object.values(require('require-all')({
|
||||
filter: /^.+\.[jt]s$/,
|
||||
resolve: (x: any) => {
|
||||
return Chart.schemaToEntity(x.name, x.schema);
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
Reference in New Issue
Block a user