Skip to content

Commit

Permalink
feat: add toJson method to BaseRecord (#455)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan <[email protected]>
  • Loading branch information
janrtvld authored Sep 6, 2021
1 parent db76823 commit f3790c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/storage/BaseRecord.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Exclude, Type } from 'class-transformer'

import { JsonTransformer } from '../utils/JsonTransformer'

export type TagValue = string | boolean | undefined | Array<string>
export type TagsBase = {
[key: string]: TagValue
Expand Down Expand Up @@ -69,4 +71,8 @@ export abstract class BaseRecord<DefaultTags extends TagsBase = TagsBase, Custom
public replaceTags(tags: CustomTags & Partial<DefaultTags>) {
this._tags = tags
}

public toJSON(): Record<string, unknown> {
return JsonTransformer.toJSON(this)
}
}

0 comments on commit f3790c9

Please sign in to comment.