Skip to content

Commit 65b5780

Browse files
authored
Merge pull request #62 from TaloDev/develop
Release 0.5.1
2 parents a860a99 + 923b844 commit 65b5780

File tree

26 files changed

+139
-81
lines changed

26 files changed

+139
-81
lines changed

.github/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
hangelog:
2+
exclude:
3+
labels:
4+
- release
5+
categories:
6+
- title: Breaking changes
7+
labels:
8+
- breaking
9+
- title: Features
10+
labels:
11+
- enhancement
12+
- title: Fixes
13+
labels:
14+
- fix
15+
- title: Other
16+
labels:
17+
- "*"

.github/workflows/ci.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ jobs:
2727
- name: Install deps
2828
run: yarn --prefer-offline
2929

30-
- name: Setup Docker
31-
run: |
32-
cp envs/.env.dev .env
33-
yarn dc up -d db
34-
echo Waiting for DB to be ready...
35-
sleep '10s'
36-
37-
- run: yarn test
30+
- name: Setup environment
31+
run: cp envs/.env.dev .env
32+
33+
- name: Run tests
34+
run: yarn test
3835

3936
- uses: codecov/codecov-action@v1
4037
with:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
name: Release
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Create release
16+
uses: softprops/action-gh-release@v1
17+
if: "!contains(github.event.head_commit.message, '--no-release')"
18+
with:
19+
generate_release_notes: true

_templates/service/new/policy.ejs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ServicePolicyResponse, ServicePolicyDenial } from 'koa-rest-services'
66
import { UserType } from '../entities/user'
77

88
export default class <%= h.changeCase.pascal(name) %>sPolicy extends Policy {
9-
async get(): Promise<boolean> {
9+
async get(): Promise<ServicePolicyResponse> {
1010
return true
1111
}
1212

envs/.env.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
DB_HOST=127.0.0.1
2+
DB_PORT=3307
3+
DB_NAME=gs_test
4+
DB_PASS=password
25

36
SENDGRID_KEY=
47
SENTRY_DSN=

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.5.0",
3+
"version": "0.5.1",
44
"description": "",
55
"main": "src/index.ts",
66
"scripts": {

src/entities/user-two-factor-auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class UserTwoFactorAuth {
1212
@Property({ hidden: true })
1313
secret: string
1414

15-
@Property()
15+
@Property({ default: false })
1616
enabled: boolean
1717

1818
constructor(secret: string) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Migration } from '@mikro-orm/migrations'
2+
3+
export class SetUserTwoFactorAuthEnabledDefaultFalse extends Migration {
4+
5+
async up(): Promise<void> {
6+
this.addSql('alter table `user_two_factor_auth` modify `enabled` tinyint(1) default false;')
7+
}
8+
9+
}

src/migrations/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { CascadeDeletePlayerAliasEvents } from './20211221195514CascadeDeletePla
77
import { AddLeaderboardEntryHiddenColumn } from './20211224154919AddLeaderboardEntryHiddenColumn'
88
import { CreateGameSavesTable } from './20220109144435CreateGameSavesTable'
99
import { CreateGameActivitiesTable } from './20220125220401CreateGameActivitiesTable'
10+
import { SetUserTwoFactorAuthEnabledDefaultFalse } from './20220203130919SetUserTwoFactorAuthEnabledDefaultFalse'
1011

1112
export default [
1213
{
@@ -44,5 +45,9 @@ export default [
4445
{
4546
name: 'CreateGameActivitiesTable',
4647
class: CreateGameActivitiesTable
48+
},
49+
{
50+
name: 'SetUserTwoFactorAuthEnabledDefaultFalse',
51+
class: SetUserTwoFactorAuthEnabledDefaultFalse
4752
}
4853
]
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import Policy from './policy'
2-
import { ServiceRequest } from 'koa-rest-services'
2+
import { ServicePolicyDenial, ServicePolicyResponse, ServiceRequest } from 'koa-rest-services'
3+
import { UserType } from '../entities/user'
34

45
export default class GameActivitysPolicy extends Policy {
5-
async index(req: ServiceRequest): Promise<boolean> {
6+
async index(req: ServiceRequest): Promise<ServicePolicyResponse> {
67
const { gameId } = req.query
8+
9+
const user = await this.getUser()
10+
if (user.type === UserType.DEV) {
11+
return new ServicePolicyDenial({ message: 'You do not have permissions to view game activities' })
12+
}
13+
714
return await this.canAccessGame(Number(gameId))
815
}
916
}

0 commit comments

Comments
 (0)