mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-04-26 00:33:48 +00:00
refactor(server): api keys (#1339)
* refactor: api keys * refactor: test module * chore: tests * chore: fix provider * refactor: test mock repos
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { APIKeyResponseDto } from './api-key-response.dto';
|
||||
|
||||
export class APIKeyCreateResponseDto {
|
||||
secret!: string;
|
||||
apiKey!: APIKeyResponseDto;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { APIKeyEntity } from '@app/infra';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class APIKeyResponseDto {
|
||||
@ApiProperty({ type: 'integer' })
|
||||
id!: number;
|
||||
name!: string;
|
||||
createdAt!: string;
|
||||
updatedAt!: string;
|
||||
}
|
||||
|
||||
export function mapKey(entity: APIKeyEntity): APIKeyResponseDto {
|
||||
return {
|
||||
id: entity.id,
|
||||
name: entity.name,
|
||||
createdAt: entity.createdAt,
|
||||
updatedAt: entity.updatedAt,
|
||||
};
|
||||
}
|
||||
2
server/libs/domain/src/api-key/response-dto/index.ts
Normal file
2
server/libs/domain/src/api-key/response-dto/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './api-key-create-response.dto';
|
||||
export * from './api-key-response.dto';
|
||||
Reference in New Issue
Block a user