Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit 4519afc

Browse files
committed
feat: add rarity and custom URL link to inventory and market listing interfaces
1 parent 0f37001 commit 4519afc

10 files changed

Lines changed: 52 additions & 8 deletions

File tree

dist/interfaces/Inventory.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export interface InventoryItem {
1010
};
1111
sellable: boolean;
1212
purchasePrice?: number;
13+
rarity: 'very-common' | 'common' | 'uncommon' | 'rare' | 'very-rare' | 'epic' | 'ultra-epic' | 'legendary' | 'ancient' | 'mythic' | 'godlike' | 'radiant';
14+
custom_url_link?: string;
1315
}
1416
export interface Inventory {
1517
user_id: string;

dist/interfaces/MarketListing.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface MarketListing {
1313
sold_at?: string;
1414
buyer_id?: string;
1515
purchasePrice?: number;
16+
rarity: 'very-common' | 'common' | 'uncommon' | 'rare' | 'very-rare' | 'epic' | 'ultra-epic' | 'legendary' | 'ancient' | 'mythic' | 'godlike' | 'radiant';
17+
custom_url_link?: string;
1618
}
1719
export type MarketListingStatus = "active" | "sold" | "cancelled";
1820
export interface EnrichedMarketListing extends MarketListing {

dist/services/InventoryService.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ let InventoryService = class InventoryService {
4040
inv.metadata,
4141
inv.sellable,
4242
inv.purchasePrice,
43+
inv.rarity,
44+
inv.custom_url_link,
4345
i.itemId,
4446
i.name,
4547
i.description,
@@ -72,7 +74,9 @@ let InventoryService = class InventoryService {
7274
name: item.name,
7375
description: item.description,
7476
iconHash: item.iconHash,
75-
price: item.purchasePrice
77+
price: item.purchasePrice,
78+
rarity: item.rarity,
79+
custom_url_link: item.custom_url_link
7680
}));
7781
return { user_id: userId, inventory: processedItems };
7882
}

dist/services/MarketListingService.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ let MarketListingService = class MarketListingService {
3535
updated_at: row.updated_at,
3636
sold_at: row.sold_at || undefined,
3737
buyer_id: row.buyer_id || undefined,
38+
rarity: row.rarity || 'common',
39+
custom_url_link: row.custom_url_link || undefined
3840
};
3941
return listing;
4042
};
@@ -68,7 +70,9 @@ let MarketListingService = class MarketListingService {
6870
status: 'active',
6971
metadata: inventoryItem.metadata,
7072
created_at: now,
71-
updated_at: now
73+
updated_at: now,
74+
rarity: inventoryItem.rarity || 'common',
75+
custom_url_link: inventoryItem.custom_url_link || undefined
7276
};
7377
try {
7478
// 1. Ajouter l'ordre de vente (correction: utiliser create au lieu de read)
@@ -151,7 +155,9 @@ let MarketListingService = class MarketListingService {
151155
amount: 1,
152156
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
153157
sellable: true,
154-
purchasePrice: listing.purchasePrice || undefined
158+
purchasePrice: listing.purchasePrice || undefined,
159+
rarity: listing.rarity,
160+
custom_url_link: listing.custom_url_link || undefined
155161
};
156162
await this.addItemToInventory(inventoryItem);
157163
}
@@ -195,7 +201,9 @@ let MarketListingService = class MarketListingService {
195201
amount: 1,
196202
metadata: listing.metadata,
197203
sellable: true,
198-
purchasePrice: listing.purchasePrice || undefined
204+
purchasePrice: listing.purchasePrice || undefined,
205+
rarity: listing.rarity || "common",
206+
custom_url_link: listing.custom_url_link
199207
};
200208
await this.addItemToInventory(inventoryItem);
201209
return { ...listing, status: 'sold', buyer_id: buyerId, sold_at: now };

dist/services/UserService.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ let UserService = UserService_1 = class UserService {
252252
'iconHash', i.iconHash,
253253
'sellable', IF(inv.sellable = 1, 1, 0),
254254
'purchasePrice', inv.purchasePrice,
255+
'rarity', inv.rarity,
256+
'custom_url_link', inv.custom_url_link,
255257
'metadata', inv.metadata
256258
)
257259
END
@@ -351,6 +353,8 @@ let UserService = UserService_1 = class UserService {
351353
'iconHash', i.iconHash,
352354
'sellable', IF(inv.sellable = 1, 1, 0),
353355
'purchasePrice', inv.purchasePrice,
356+
'rarity', inv.rarity,
357+
'custom_url_link', inv.custom_url_link,
354358
'metadata', inv.metadata
355359
)
356360
END
@@ -450,6 +454,8 @@ let UserService = UserService_1 = class UserService {
450454
'iconHash', i.iconHash,
451455
'sellable', IF(inv.sellable = 1, 1, 0),
452456
'purchasePrice', inv.purchasePrice,
457+
'rarity', inv.rarity,
458+
'custom_url_link', inv.custom_url_link,
453459
'metadata', inv.metadata
454460
)
455461
END

src/interfaces/Inventory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export interface InventoryItem {
99
metadata?: { [key: string]: unknown };
1010
sellable: boolean;
1111
purchasePrice?: number; // Prix d'achat stocké dans la DB
12+
rarity: 'very-common' | 'common' | 'uncommon' | 'rare' | 'very-rare' | 'epic' | 'ultra-epic' | 'legendary' | 'ancient' | 'mythic' | 'godlike' | 'radiant';
13+
custom_url_link?: string;
1214
}
1315

1416
export interface Inventory {

src/interfaces/MarketListing.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export interface MarketListing {
1010
sold_at?: string;
1111
buyer_id?: string;
1212
purchasePrice?: number;
13+
rarity: 'very-common' | 'common' | 'uncommon' | 'rare' | 'very-rare' | 'epic' | 'ultra-epic' | 'legendary' | 'ancient' | 'mythic' | 'godlike' | 'radiant';
14+
custom_url_link?: string;
1315
}
1416

1517
export type MarketListingStatus = "active" | "sold" | "cancelled";

src/services/InventoryService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export class InventoryService implements IInventoryService {
5454
inv.metadata,
5555
inv.sellable,
5656
inv.purchasePrice,
57+
inv.rarity,
58+
inv.custom_url_link,
5759
i.itemId,
5860
i.name,
5961
i.description,
@@ -87,7 +89,9 @@ export class InventoryService implements IInventoryService {
8789
name: item.name,
8890
description: item.description,
8991
iconHash: item.iconHash,
90-
price: item.purchasePrice
92+
price: item.purchasePrice,
93+
rarity: item.rarity,
94+
custom_url_link: item.custom_url_link
9195
}));
9296

9397
return { user_id: userId, inventory: processedItems };

src/services/MarketListingService.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ export class MarketListingService implements IMarketListingService {
6363
status: 'active' as MarketListingStatus,
6464
metadata: inventoryItem.metadata,
6565
created_at: now,
66-
updated_at: now
66+
updated_at: now,
67+
rarity: inventoryItem.rarity || 'common',
68+
custom_url_link: inventoryItem.custom_url_link || undefined
6769
};
6870

6971
try {
@@ -186,7 +188,9 @@ export class MarketListingService implements IMarketListingService {
186188
amount: 1,
187189
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
188190
sellable: true,
189-
purchasePrice: listing.purchasePrice || undefined
191+
purchasePrice: listing.purchasePrice || undefined,
192+
rarity: listing.rarity,
193+
custom_url_link: listing.custom_url_link || undefined
190194
};
191195

192196
await this.addItemToInventory(inventoryItem);
@@ -260,7 +264,9 @@ export class MarketListingService implements IMarketListingService {
260264
amount: 1,
261265
metadata: listing.metadata,
262266
sellable: true,
263-
purchasePrice: listing.purchasePrice || undefined
267+
purchasePrice: listing.purchasePrice || undefined,
268+
rarity: listing.rarity || "common",
269+
custom_url_link: listing.custom_url_link
264270
};
265271

266272
await this.addItemToInventory(inventoryItem);
@@ -385,6 +391,8 @@ export class MarketListingService implements IMarketListingService {
385391
updated_at: row.updated_at,
386392
sold_at: row.sold_at || undefined,
387393
buyer_id: row.buyer_id || undefined,
394+
rarity: row.rarity || 'common',
395+
custom_url_link: row.custom_url_link || undefined
388396
};
389397
return listing;
390398
}

src/services/UserService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ export class UserService implements IUserService {
385385
'iconHash', i.iconHash,
386386
'sellable', IF(inv.sellable = 1, 1, 0),
387387
'purchasePrice', inv.purchasePrice,
388+
'rarity', inv.rarity,
389+
'custom_url_link', inv.custom_url_link,
388390
'metadata', inv.metadata
389391
)
390392
END
@@ -482,6 +484,8 @@ export class UserService implements IUserService {
482484
'iconHash', i.iconHash,
483485
'sellable', IF(inv.sellable = 1, 1, 0),
484486
'purchasePrice', inv.purchasePrice,
487+
'rarity', inv.rarity,
488+
'custom_url_link', inv.custom_url_link,
485489
'metadata', inv.metadata
486490
)
487491
END
@@ -576,6 +580,8 @@ export class UserService implements IUserService {
576580
'iconHash', i.iconHash,
577581
'sellable', IF(inv.sellable = 1, 1, 0),
578582
'purchasePrice', inv.purchasePrice,
583+
'rarity', inv.rarity,
584+
'custom_url_link', inv.custom_url_link,
579585
'metadata', inv.metadata
580586
)
581587
END

0 commit comments

Comments
 (0)