Skip to content

DoCurious API Reference / types / Badge

Interface: Badge ​

Defined in: types/gamification.types.ts:72

A badge definition that specifies earning criteria, rarity, and display properties.

Remarks ​

Badges are admin-managed templates. When a user meets the criteria, a UserBadge record is created and XP is awarded based on rarity.

Example ​

ts
const badge: Badge = {
  id: 'bdg-005',
  createdAt: '2025-01-01T00:00:00Z',
  updatedAt: '2025-01-01T00:00:00Z',
  name: 'Trailblazer',
  description: 'Complete challenges in 5 different categories.',
  category: 'breadth',
  rarity: 'rare',
  criteria: { type: 'category_count', value: 5 },
  xpBonus: 50,
}

Extends ​

Properties ​

category ​

category: BadgeCategory

Defined in: types/gamification.types.ts:76


createdAt ​

createdAt: string

Defined in: types/common.types.ts:154

ISO 8601 datetime when the entity was created

Inherited from ​

BaseEntity.createdAt


criteria ​

criteria: object

Defined in: types/gamification.types.ts:80

Rule that determines when the badge is awarded

categoryId? ​

optional categoryId: string

Specific category ID (for category_mastery badges)

challengeId? ​

optional challengeId: string

Specific challenge ID (for challenge_specific badges)

type ​

type: "challenge" | "streak" | "special" | "challenge_count" | "category_count" | "verification_count"

The metric type to evaluate

value ​

value: number

Threshold value that must be reached to earn the badge


description ​

description: string

Defined in: types/gamification.types.ts:74


displayOrder? ​

optional displayOrder: number

Defined in: types/gamification.types.ts:94


iconUrl? ​

optional iconUrl: string

Defined in: types/gamification.types.ts:75


id ​

id: string

Defined in: types/common.types.ts:167

Inherited from ​

BaseEntity.id


isActive? ​

optional isActive: boolean

Defined in: types/gamification.types.ts:100

If false, this badge is retired and can no longer be earned


isHidden? ​

optional isHidden: boolean

Defined in: types/gamification.types.ts:97

If true, badge is hidden in the showcase until the user earns it


name ​

name: string

Defined in: types/gamification.types.ts:73


rarity ​

rarity: BadgeRarity

Defined in: types/gamification.types.ts:77


updatedAt ​

updatedAt: string

Defined in: types/common.types.ts:156

ISO 8601 datetime when the entity was last modified

Inherited from ​

BaseEntity.updatedAt


xpBonus? ​

optional xpBonus: number

Defined in: types/gamification.types.ts:92

XP bonus awarded when earned (overrides the default rarity-based bonus if set)

DoCurious Platform Documentation