mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-08 02:15:02 -04:00
fix: ensure dates are properly transformed
To correctly transform Date objects from ISO-strings in JSON to instances, class-transformer requires the `@Type` annotation. References: https://github.com/typestack/class-transformer#%D1%81onverting-date-strings-into-date-objects Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
59a235ebc4
commit
7e8716ec95
8 changed files with 23 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsDate, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
import { BaseDto } from '../utils/base.dto.';
|
||||
|
@ -10,13 +11,20 @@ import { BaseDto } from '../utils/base.dto.';
|
|||
export class AuthTokenDto extends BaseDto {
|
||||
@IsString()
|
||||
label: string;
|
||||
|
||||
@IsString()
|
||||
keyId: string;
|
||||
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
createdAt: Date;
|
||||
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
validUntil: Date;
|
||||
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
@IsOptional()
|
||||
lastUsedAt: Date | null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue