Skip to content

Commit

Permalink
feat: 1.4.0 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
GiyoMoon authored Aug 26, 2024
1 parent f344362 commit 4a90ab2
Show file tree
Hide file tree
Showing 49 changed files with 826 additions and 1,149 deletions.
31 changes: 16 additions & 15 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
DATABASEUSER=witchtrade
DATABASEPW=
DATABASEPORT=5432
STATS_DATABASEUSER=witchtrade
STATS_DATABASEPW=
STATS_DATABASEPORT=5432
DATABASEPW=Local123
DATABASEPORT=5440

SECRET=
REFRESHSECRET=
GAMESERVERCACHETIME=10000
STEAMINVCACHETIME=1800000
STEAMAPIKEY=
STEAM_REALM=https://witchtrade.org
STEAM_RETURNURL=https://witchtrade.org/user/settings/account
STEAMMASTERSERVER=hl2master.steampowered.com:27011
WITCHITAPPID=559650

STEAM_OPENID_REALM=http://localhost:3000

EPIC_CLIENT_ID=
EPIC_CLIENT_SECRET=

OAUTH_RETURNURL=http://localhost:3000/user/settings/account

QUEST_CACHETIME=300000
QUEST_ENDPOINT=
QUEST_AUTH_TOKEN=
USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
INVENTORY_CACHETIME=300000

WITCH_IT_ENDPOINT=
WITCH_IT_AUTH_TOKEN=

PLAUSIBLE_HOST=
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![Stars](https://img.shields.io/github/stars/WitchTrade/backend.svg?color=C59DFF)](https://github.com/WitchTrade/backend/stargazers)
[![Commits](https://img.shields.io/github/commit-activity/m/WitchTrade/backend?color=C59DFF)](https://github.com/WitchTrade/backend/commits)
[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?color=C59DFF)](https://gitmoji.dev)
[![License](https://img.shields.io/github/license/WitchTrade/backend.svg?color=C59DFF)](https://github.com/WitchTrade/backend/blob/main/COPYING)
[![CodeFactor](https://www.codefactor.io/repository/github/WitchTrade/backend/badge)](https://www.codefactor.io/repository/github/WitchTrade/backend)

Expand All @@ -21,19 +20,16 @@ Search for a specific offer or use the advanced filter to search for the rarity,

WitchTrade offers a complete and up-to-date item list to look up all available items.

**Game Servers**

The official Witch It game servers with the currently playing players can be viewed on the website.

**Account**

Create an account to get access to the following features:

- **Create offers**: Offer your items on the website for other to see and respond to.
- **Sync Steam Inventory**: Sync your Steam Witch It inventory with WitchTrade to see all your items in the item list and automatically sync your offers with your Steam inventory.
- **Sync Inventory**: Sync your Witch It inventory with WitchTrade to see all your items in the item list and automatically sync your offers with your in-game inventory.
- **Wish list**: Create a wish list with all the items you are looking for and get notified when an item is offered on the website.
- **Game Quests**: View your current in-game quests without having to start the game.

## Contact
Join the WitchTrade Discord Server if you want to give feedback, have any questions or found a bug: https://discord.gg/wm7sTW8MJq
___
> Made with ❤️ by GiyoMoon
> Made with ❤️ by GiyoMoon
74 changes: 0 additions & 74 deletions backend.hcl

This file was deleted.

16 changes: 16 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: witchtrade-v1
services:
db:
image: postgres:alpine
restart: always
environment:
- POSTGRES_USER=witchtrade
- POSTGRES_PASSWORD=Local123
ports:
- '5440:5432'
volumes:
- db:/var/lib/postgresql/data
volumes:
db:
name: witchtrade-v1-db
driver: local
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "witchtrade-be",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"description": "A Witch It trading website.",
"license": "GPLv3",
Expand Down Expand Up @@ -34,6 +34,7 @@
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.5",
"simple-oauth2": "^5.1.0",
"steam-server-query": "^1.1.3",
"typeorm": "^0.2.34"
},
Expand All @@ -47,6 +48,7 @@
"@types/jsonwebtoken": "^8.5.8",
"@types/node": "^17.0.21",
"@types/openid": "^2.0.2",
"@types/simple-oauth2": "^5.0.7",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.15.0",
"@typescript-eslint/parser": "^5.15.0",
Expand Down
6 changes: 6 additions & 0 deletions src/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,10 @@ export class AdminController {
): Promise<void> {
return this._adminService.broadcastNotification(uuid, notification);
}

@UseGuards(AuthGuard)
@Delete('completionists')
public clearCompletionists(@UserDecorator('id') uuid: string): Promise<void> {
return this._adminService.clearCompletionists(uuid);
}
}
23 changes: 23 additions & 0 deletions src/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,27 @@ export class AdminService {

return;
}

public async clearCompletionists(uuid: string) {
const requestingUser = await this._userRepository.findOne(uuid, {
relations: ['roles'],
});

if (!this._hasPermission(requestingUser.roles, PERMISSION.ADMIN)) {
throw new HttpException('Permission denied.', HttpStatus.FORBIDDEN);
}

const users = await this._userRepository.find({
relations: ['badges'],
});

for (const user of users) {
if (user.badges.some((badge) => badge.id.startsWith('completionist'))) {
user.badges = user.badges.filter(
(badge) => !badge.id.startsWith('completionist'),
);
await this._userRepository.save(user);
}
}
}
}
20 changes: 4 additions & 16 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@ import { AdminLog } from './admin/entities/adminlog.entity';
import { ItemsModule } from './items/items.module';
import { Item } from './items/entities/item.entity';
import { ItemSet } from './items/entities/itemSet.entity';
import { GameserversModule } from './gameservers/gameservers.module';
import { NotificationsModule } from './notifications/notifications.module';
import { Notification } from './notifications/entities/notification.entity';
import { SyncSettings } from './users/entities/syncSettings.entity';
import { InventoryModule } from './inventory/inventory.module';
import { InventoryItem } from './inventory/entities/inventoryItem.entity';
import { Inventory } from './inventory/entities/inventory.entity';
import { SteamModule } from './steam/steam.module';
import { OAuthModule } from './oauth/oauth.module';
import { MarketsModule } from './markets/markets.module';
import { Market } from './markets/entities/market.entity';
import { Offer } from './markets/entities/offer.entity';
import { Wish } from './markets/entities/wish.entity';
import { Price } from './markets/entities/price.entity';
import { SearchModule } from './search/search.module';
import { StatsModule } from './stats/stats.module';
import { Stats } from './stats/entities/stats.entity';
import { QuestsModule } from './quests/quests.module';
import { UserQuest } from './quests/entities/userQuest.entity';
import { Quest } from './quests/entities/quest.entity';
import { PlausibleModule } from './plausible/plausible.module';
import { WitchItModule } from 'src/witchit/witchit.module';

@Module({
imports: [
Expand Down Expand Up @@ -62,25 +61,14 @@ import { PlausibleModule } from './plausible/plausible.module';
],
synchronize: true,
}),
TypeOrmModule.forRoot({
name: 'wistats',
type: 'postgres',
host: process.env.STATS_DATABASEHOST,
port: parseInt(process.env.STATS_DATABASEPORT, 10),
username: process.env.STATS_DATABASEUSER,
password: process.env.STATS_DATABASEPW,
database: 'wistats',
entities: [Stats],
synchronize: false,
}),
ScheduleModule.forRoot(),
UsersModule,
AdminModule,
ItemsModule,
GameserversModule,
NotificationsModule,
InventoryModule,
SteamModule,
WitchItModule,
OAuthModule,
MarketsModule,
SearchModule,
StatsModule,
Expand Down
7 changes: 0 additions & 7 deletions src/gameservers/dtos/FetchStatus.dto.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/gameservers/dtos/ServerCache.dto.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/gameservers/dtos/ServerInfo.dto.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/gameservers/gameservers.controller.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/gameservers/gameservers.module.ts

This file was deleted.

Loading

0 comments on commit 4a90ab2

Please sign in to comment.