Skip to content

Commit c0f5478

Browse files
authored
Merge pull request #54 from TaloDev/develop
Leaderboard management
2 parents 06f37ff + 4424a33 commit c0f5478

34 files changed

+421
-69
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ This will create a policy, entity and REST API for your new entity. If you want
3535

3636
## Migrations
3737

38-
To create a migration, use `yarn migration:create`. This will create a migration class in the `migrations` folder. You will then need to import that migration class into the `index.ts` in the same folder.
38+
To create a migration, use `yarn migration:create`. This will create a migration class in the `migrations` folder.
39+
40+
Modify the default name of the file from `Migration[Timestamp].ts` to `[Timestamp][PascalCaseDescriptionOfTheMigration].ts`.
41+
42+
You should also rename the exported class to be `[PascalCaseDescriptionOfTheMigration]`.
43+
44+
You will then need to import and add that migration class to the end of the list of migrations inside `index.ts` in the same folder.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "game-services",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "",
55
"main": "src/index.ts",
66
"scripts": {

src/entities/data-export.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export enum DataExportStatus {
1212
export enum DataExportAvailableEntities {
1313
EVENTS = 'events',
1414
PLAYERS = 'players',
15-
PLAYER_ALIASES = 'playerAliases'
15+
PLAYER_ALIASES = 'playerAliases',
16+
LEADERBOARD_ENTRIES = 'leaderboardEntries'
1617
}
1718

1819
@Entity()

src/entities/leaderboard-entry.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export default class LeaderboardEntry {
1616
@ManyToOne(() => PlayerAlias, { cascade: [Cascade.REMOVE], eager: true })
1717
playerAlias: PlayerAlias
1818

19+
@Property({ default: false })
20+
hidden: boolean
21+
1922
@Property()
2023
createdAt: Date = new Date()
2124

@@ -36,6 +39,7 @@ export default class LeaderboardEntry {
3639
service: this.playerAlias.service,
3740
identifier: this.playerAlias.identifier
3841
},
42+
hidden: this.hidden,
3943
updatedAt: this.updatedAt
4044
}
4145
}

src/entities/leaderboard.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export default class Leaderboard {
4747
name: this.name,
4848
sortMode: this.sortMode,
4949
unique: this.unique,
50-
createdAt: this.createdAt
50+
createdAt: this.createdAt,
51+
updatedAt: this.updatedAt
5152
}
5253
}
5354
}

src/migrations/Migration20210725211129.ts renamed to src/migrations/20210725211129InitialMigration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Migration } from '@mikro-orm/migrations'
22

3-
export class Migration20210725211129 extends Migration {
3+
export class InitialMigration extends Migration {
44

55
async up(): Promise<void> {
66
this.addSql('create table `organisation` (`id` int unsigned not null auto_increment primary key, `email` varchar(255) not null, `name` varchar(255) not null, `created_at` datetime not null, `updated_at` datetime not null) default character set utf8mb4 engine = InnoDB')

src/migrations/Migration20210926160859.ts renamed to src/migrations/20210926160859CreateDataExportsTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Migration } from '@mikro-orm/migrations'
22

3-
export class Migration20210926160859 extends Migration {
3+
export class CreateDataExportsTable extends Migration {
44

55
async up(): Promise<void> {
66
this.addSql('create table `data_export` (`id` int unsigned not null auto_increment primary key, `created_by_user_id` int(11) unsigned not null, `game_id` int(11) unsigned not null, `entities` text not null, `status` tinyint not null, `failed_at` datetime null, `created_at` datetime not null, `updated_at` datetime not null) default character set utf8mb4 engine = InnoDB;')

src/migrations/Migration20211107233610.ts renamed to src/migrations/20211107233610CreateLeaderboardsTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Migration } from '@mikro-orm/migrations'
22

3-
export class Migration20211107233610 extends Migration {
3+
export class CreateLeaderboardsTable extends Migration {
44

55
async up(): Promise<void> {
66
this.addSql('create table `leaderboard` (`id` int unsigned not null auto_increment primary key, `internal_name` varchar(255) not null, `name` varchar(255) not null, `sort_mode` enum(\'desc\', \'asc\') not null, `unique` tinyint(1) not null, `game_id` int(11) unsigned not null, `created_at` datetime not null, `updated_at` datetime not null) default character set utf8mb4 engine = InnoDB;')

src/migrations/Migration20211205171927.ts renamed to src/migrations/20211205171927CreateUserTwoFactorAuthTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Migration } from '@mikro-orm/migrations'
22

3-
export class Migration20211205171927 extends Migration {
3+
export class CreateUserTwoFactorAuthTable extends Migration {
44

55
async up(): Promise<void> {
66
this.addSql('create table `user_two_factor_auth` (`id` int unsigned not null auto_increment primary key, `secret` varchar(255) not null, `enabled` tinyint(1) not null) default character set utf8mb4 engine = InnoDB;')

src/migrations/Migration20211209003017.ts renamed to src/migrations/20211209003017CreateUserRecoveryCodeTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Migration } from '@mikro-orm/migrations'
22

3-
export class Migration20211209003017 extends Migration {
3+
export class CreateUserRecoveryCodeTable extends Migration {
44

55
async up(): Promise<void> {
66
this.addSql('create table `user_recovery_code` (`id` int unsigned not null auto_increment primary key, `user_id` int(11) unsigned not null, `code` varchar(255) not null, `created_at` datetime not null) default character set utf8mb4 engine = InnoDB;')

0 commit comments

Comments
 (0)