Skip to content

Commit

Permalink
fix tsconfig.paths to work!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Jun 8, 2023
1 parent 8708ea6 commit b18ef07
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 39 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"typescript.preferences.importModuleSpecifier": "non-relative"
}
2 changes: 1 addition & 1 deletion client/src/app/services/image.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ImageDB extends Dexie {
// Define tables and indexes
//
this.version(1).stores({
images: '++id, name, quality, hash, url',
images: '++id, [name+quality], hash, url',
});

// Let's physically map BlobImage class to image table.
Expand Down
2 changes: 1 addition & 1 deletion client/src/interfaces/player.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPlayer } from '../../../shared/interfaces';
import { IPlayer } from '@interfaces';

export interface IPlayerStore {
version: number;
Expand Down
2 changes: 1 addition & 1 deletion client/src/interfaces/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IUser } from '../../../shared/interfaces';
import { IUser } from '@interfaces';

export interface IUserStore {
version: number;
Expand Down
3 changes: 1 addition & 2 deletions client/src/stores/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

export * from './player/player.store';
export * from './user/user.store';

3 changes: 1 addition & 2 deletions client/src/stores/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

export * from './player/player.migrations';
export * from './user/user.migrations';

2 changes: 1 addition & 1 deletion client/src/stores/player/player.actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPlayer } from '../../interfaces';
import { IPlayer } from '@interfaces';

export class SetPlayer {
static type = '[Player] Set';
Expand Down
7 changes: 1 addition & 6 deletions client/src/stores/player/player.functions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Currency, IPlayerStore, RechargeableStat, Stat } from '@interfaces';
import { StateContext } from '@ngxs/store';
import {
Currency,
IPlayerStore,
RechargeableStat,
Stat,
} from '../../interfaces';
import { SetPlayer } from './player.actions';

export const defaultStore: () => IPlayerStore = () => ({
Expand Down
2 changes: 1 addition & 1 deletion client/src/stores/player/player.migrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPlayerStore } from '../../interfaces';
import { IPlayerStore } from '@interfaces';

export const playerStoreMigrations = [
{
Expand Down
4 changes: 2 additions & 2 deletions client/src/stores/player/player.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Injectable } from '@angular/core';
import { Selector, State } from '@ngxs/store';
import { attachAction } from '@seiyria/ngxs-attach-action';

import { IPlayerStore } from '../../interfaces';
import { IPlayerStore } from '@interfaces';
import { defaultStore } from './player.functions';

import { attachments } from './player.attachments';

@State<IPlayerStore>({
name: 'user',
name: 'player',
defaults: defaultStore(),
})
@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion client/src/stores/user/user.actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IUser } from '../../interfaces';
import { IUser } from '@interfaces';

export class SetUser {
static type = '[User] Set';
Expand Down
4 changes: 2 additions & 2 deletions client/src/stores/user/user.attachments.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IAttachment } from '../../interfaces';
import { IAttachment } from '@interfaces';
import { SetUser } from './user.actions';
import { setUser } from './user.functions';

export const attachments: IAttachment[] = [
{ action: SetUser, handler: setUser }
{ action: SetUser, handler: setUser },
];
9 changes: 4 additions & 5 deletions client/src/stores/user/user.functions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IUserStore } from '@interfaces';
import { StateContext } from '@ngxs/store';
import { IUserStore } from '../../interfaces';
import { SetUser } from './user.actions';

export const defaultStore: () => IUserStore = () => ({
Expand All @@ -8,12 +8,11 @@ export const defaultStore: () => IUserStore = () => ({
createdAt: 0,
discriminator: '',
email: '',
username: ''
}
username: '',
},
});

export function resetGame(ctx: StateContext<IUserStore>) {
}
export function resetGame(ctx: StateContext<IUserStore>) {}

export function setUser(ctx: StateContext<IUserStore>, { user }: SetUser) {
ctx.patchState({ user });
Expand Down
10 changes: 5 additions & 5 deletions client/src/stores/user/user.migrations.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { IUserStore } from '../../interfaces';
import { IUserStore } from '@interfaces';

export const userStoreMigrations = [
{
version: 0,
migrate: (state: IUserStore) => ({
...state,
version: 1
})
}
].map(x => ({ ...x, key: 'user' }));
version: 1,
}),
},
].map((x) => ({ ...x, key: 'user' }));
9 changes: 3 additions & 6 deletions client/src/stores/user/user.store.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@

import { Injectable } from '@angular/core';
import { Selector, State } from '@ngxs/store';
import { attachAction } from '@seiyria/ngxs-attach-action';

import { IUserStore } from '../../interfaces';
import { IUserStore } from '@interfaces';
import { defaultStore } from './user.functions';

import { attachments } from './user.attachments';

@State<IUserStore>({
name: 'user',
defaults: defaultStore()
defaults: defaultStore(),
})
@Injectable()
export class UserStore {

constructor(
) {
constructor() {
attachments.forEach(({ action, handler }) => {
attachAction(UserStore, action, handler);
});
Expand Down
8 changes: 7 additions & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
"es2020",
"dom"
],
"useDefineForClassFields": false
"useDefineForClassFields": false,
"paths": {
"@interfaces": [
"src/interfaces/index.ts",
"../shared/interfaces/*"
]
}
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
1 change: 1 addition & 0 deletions server/src/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../../../shared/interfaces';
3 changes: 2 additions & 1 deletion server/src/user/user.schema.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IUser } from '@interfaces';
import {
Entity,
PrimaryKey,
Expand All @@ -11,7 +12,7 @@ import { onlineUntilExpiration } from '../utils/time';
export type UserId = User['_id'];

@Entity()
export class User {
export class User implements IUser {
@PrimaryKey()
_id!: ObjectId;

Expand Down
8 changes: 7 additions & 1 deletion server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
"noFallthroughCasesInSwitch": false,
"paths": {
"@interfaces": [
"src/interfaces/index.ts",
"../shared/interfaces/*"
]
}
}
}

0 comments on commit b18ef07

Please sign in to comment.