Set TypeScript to strict mode and fix issues related to server types (#261)

* Fix lint issues and some other TS issues

- set TypeScript in strict mode
- add npm commands to lint / check code
- fix all lint issues
- fix some TS issues
- rename User reponse DTO to make it consistent with the other ones
- override Express/User interface to use UserResponseDto interface
 This is for when the accessing the `user` from a Express Request,
 like in `asset-upload-config`

* Fix the rest of TS issues

- fix all the remaining TypeScript errors
- add missing `@types/mapbox__mapbox-sdk` package

* Move global.d.ts to server `src` folder

* Update AssetReponseDto duration type

This is now of type `string` that defaults to '0:00:00.00000' if not set
which is what the mobile app currently expects

* Set context when logging error in asset.service

Use `ServeFile` as the context for logging an error when
asset.resizePath is not set

* Fix wrong AppController merge conflict resolution

`redirectToWebpage` was removed in main as is no longer used.
This commit is contained in:
Jaime Baez
2022-06-25 19:53:06 +02:00
committed by GitHub
parent cca2f7d178
commit c918f5b001
64 changed files with 415 additions and 273 deletions

View File

@@ -8,7 +8,7 @@ import { UserModule } from '../src/api-v1/user/user.module';
import { ImmichJwtModule } from '../src/modules/immich-jwt/immich-jwt.module';
import { UserService } from '../src/api-v1/user/user.service';
import { CreateUserDto } from '../src/api-v1/user/dto/create-user.dto';
import { User } from '../src/api-v1/user/response-dto/user';
import { UserResponseDto } from '../src/api-v1/user/response-dto/user-response.dto';
function _createUser(userService: UserService, data: CreateUserDto) {
return userService.createUser(data);
@@ -44,7 +44,7 @@ describe('User', () => {
describe('with auth', () => {
let userService: UserService;
let authUser: User;
let authUser: UserResponseDto;
beforeAll(async () => {
const builder = Test.createTestingModule({