Skip to content

Commit

Permalink
fix: handle defaultValue for names when formatter is not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Dec 8, 2021
1 parent 8859c76 commit 8873d47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/api/src/queueAdapters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export abstract class BaseAdapter {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public format(field: FormatterField, data: any): any {
return typeof this.formatters[field] === 'function' ? this.formatters[field](data) : data;
const defaultValue = field === 'name' ? data.name : data;
return typeof this.formatters[field] === 'function'
? this.formatters[field](data)
: defaultValue;
}

public abstract clean(queueStatus: JobCleanStatus, graceTimeMs: number): Promise<void>;
Expand Down

0 comments on commit 8873d47

Please sign in to comment.