@hobenakicoffee/libraries 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "type": "module",
5
5
  "types": "src/index.ts",
6
6
  "repository": {
@@ -7,3 +7,12 @@ export const ShopProductTypes = {
7
7
 
8
8
  export type ShopProductType =
9
9
  (typeof ShopProductTypes)[keyof typeof ShopProductTypes];
10
+
11
+ export const ShopApprovalStatuses = {
12
+ pending: "pending",
13
+ approved: "approved",
14
+ rejected: "rejected",
15
+ } as const;
16
+
17
+ export type ShopApprovalStatus =
18
+ (typeof ShopApprovalStatuses)[keyof typeof ShopApprovalStatuses];
@@ -1193,6 +1193,7 @@ export type Database = {
1193
1193
  shop_categories: {
1194
1194
  Row: {
1195
1195
  created_at: string;
1196
+ description: string | null;
1196
1197
  id: string;
1197
1198
  is_visible: boolean;
1198
1199
  name: string;
@@ -1204,6 +1205,7 @@ export type Database = {
1204
1205
  };
1205
1206
  Insert: {
1206
1207
  created_at?: string;
1208
+ description?: string | null;
1207
1209
  id?: string;
1208
1210
  is_visible?: boolean;
1209
1211
  name: string;
@@ -1215,6 +1217,7 @@ export type Database = {
1215
1217
  };
1216
1218
  Update: {
1217
1219
  created_at?: string;
1220
+ description?: string | null;
1218
1221
  id?: string;
1219
1222
  is_visible?: boolean;
1220
1223
  name?: string;
@@ -1234,6 +1237,63 @@ export type Database = {
1234
1237
  },
1235
1238
  ];
1236
1239
  };
1240
+ shop_category_drafts: {
1241
+ Row: {
1242
+ approval_status: Database["public"]["Enums"]["shop_approval_status_enum"];
1243
+ category_id: string;
1244
+ created_at: string;
1245
+ description: string | null;
1246
+ id: string;
1247
+ name: string;
1248
+ profile_id: string;
1249
+ rejection_reason: string | null;
1250
+ slug: string;
1251
+ sort_order: number;
1252
+ updated_at: string;
1253
+ };
1254
+ Insert: {
1255
+ approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
1256
+ category_id: string;
1257
+ created_at?: string;
1258
+ description?: string | null;
1259
+ id?: string;
1260
+ name: string;
1261
+ profile_id: string;
1262
+ rejection_reason?: string | null;
1263
+ slug: string;
1264
+ sort_order?: number;
1265
+ updated_at?: string;
1266
+ };
1267
+ Update: {
1268
+ approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
1269
+ category_id?: string;
1270
+ created_at?: string;
1271
+ description?: string | null;
1272
+ id?: string;
1273
+ name?: string;
1274
+ profile_id?: string;
1275
+ rejection_reason?: string | null;
1276
+ slug?: string;
1277
+ sort_order?: number;
1278
+ updated_at?: string;
1279
+ };
1280
+ Relationships: [
1281
+ {
1282
+ foreignKeyName: "shop_category_drafts_category_id_fkey";
1283
+ columns: ["category_id"];
1284
+ isOneToOne: true;
1285
+ referencedRelation: "shop_categories";
1286
+ referencedColumns: ["id"];
1287
+ },
1288
+ {
1289
+ foreignKeyName: "shop_category_drafts_profile_id_fkey";
1290
+ columns: ["profile_id"];
1291
+ isOneToOne: false;
1292
+ referencedRelation: "profiles";
1293
+ referencedColumns: ["id"];
1294
+ },
1295
+ ];
1296
+ };
1237
1297
  shop_download_tokens: {
1238
1298
  Row: {
1239
1299
  buyer_profile_id: string;
@@ -1512,6 +1572,130 @@ export type Database = {
1512
1572
  },
1513
1573
  ];
1514
1574
  };
1575
+ shop_product_drafts: {
1576
+ Row: {
1577
+ approval_status: Database["public"]["Enums"]["shop_approval_status_enum"];
1578
+ category_id: string | null;
1579
+ cod_enabled: boolean;
1580
+ compare_at_price: number | null;
1581
+ cover_image_url: string | null;
1582
+ created_at: string;
1583
+ description: string | null;
1584
+ download_expires_hours: number;
1585
+ id: string;
1586
+ images: string[];
1587
+ is_featured: boolean;
1588
+ low_stock_threshold: number;
1589
+ max_downloads: number;
1590
+ option_definitions: Json;
1591
+ price: number;
1592
+ processing_max_days: number | null;
1593
+ processing_min_days: number | null;
1594
+ product_id: string;
1595
+ profile_id: string;
1596
+ rejection_reason: string | null;
1597
+ requires_shipping: boolean;
1598
+ shipping_fee_inside_dhaka: number;
1599
+ shipping_fee_outside_dhaka: number;
1600
+ sku: string | null;
1601
+ slug: string;
1602
+ sort_order: number;
1603
+ stock_count: number | null;
1604
+ tags: string[];
1605
+ title: string;
1606
+ updated_at: string;
1607
+ weight_grams: number | null;
1608
+ };
1609
+ Insert: {
1610
+ approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
1611
+ category_id?: string | null;
1612
+ cod_enabled?: boolean;
1613
+ compare_at_price?: number | null;
1614
+ cover_image_url?: string | null;
1615
+ created_at?: string;
1616
+ description?: string | null;
1617
+ download_expires_hours?: number;
1618
+ id?: string;
1619
+ images?: string[];
1620
+ is_featured?: boolean;
1621
+ low_stock_threshold?: number;
1622
+ max_downloads?: number;
1623
+ option_definitions?: Json;
1624
+ price: number;
1625
+ processing_max_days?: number | null;
1626
+ processing_min_days?: number | null;
1627
+ product_id: string;
1628
+ profile_id: string;
1629
+ rejection_reason?: string | null;
1630
+ requires_shipping?: boolean;
1631
+ shipping_fee_inside_dhaka?: number;
1632
+ shipping_fee_outside_dhaka?: number;
1633
+ sku?: string | null;
1634
+ slug: string;
1635
+ sort_order?: number;
1636
+ stock_count?: number | null;
1637
+ tags?: string[];
1638
+ title: string;
1639
+ updated_at?: string;
1640
+ weight_grams?: number | null;
1641
+ };
1642
+ Update: {
1643
+ approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
1644
+ category_id?: string | null;
1645
+ cod_enabled?: boolean;
1646
+ compare_at_price?: number | null;
1647
+ cover_image_url?: string | null;
1648
+ created_at?: string;
1649
+ description?: string | null;
1650
+ download_expires_hours?: number;
1651
+ id?: string;
1652
+ images?: string[];
1653
+ is_featured?: boolean;
1654
+ low_stock_threshold?: number;
1655
+ max_downloads?: number;
1656
+ option_definitions?: Json;
1657
+ price?: number;
1658
+ processing_max_days?: number | null;
1659
+ processing_min_days?: number | null;
1660
+ product_id?: string;
1661
+ profile_id?: string;
1662
+ rejection_reason?: string | null;
1663
+ requires_shipping?: boolean;
1664
+ shipping_fee_inside_dhaka?: number;
1665
+ shipping_fee_outside_dhaka?: number;
1666
+ sku?: string | null;
1667
+ slug?: string;
1668
+ sort_order?: number;
1669
+ stock_count?: number | null;
1670
+ tags?: string[];
1671
+ title?: string;
1672
+ updated_at?: string;
1673
+ weight_grams?: number | null;
1674
+ };
1675
+ Relationships: [
1676
+ {
1677
+ foreignKeyName: "shop_product_drafts_category_id_fkey";
1678
+ columns: ["category_id"];
1679
+ isOneToOne: false;
1680
+ referencedRelation: "shop_categories";
1681
+ referencedColumns: ["id"];
1682
+ },
1683
+ {
1684
+ foreignKeyName: "shop_product_drafts_product_id_fkey";
1685
+ columns: ["product_id"];
1686
+ isOneToOne: true;
1687
+ referencedRelation: "shop_products";
1688
+ referencedColumns: ["id"];
1689
+ },
1690
+ {
1691
+ foreignKeyName: "shop_product_drafts_profile_id_fkey";
1692
+ columns: ["profile_id"];
1693
+ isOneToOne: false;
1694
+ referencedRelation: "profiles";
1695
+ referencedColumns: ["id"];
1696
+ },
1697
+ ];
1698
+ };
1515
1699
  shop_product_files: {
1516
1700
  Row: {
1517
1701
  created_at: string;
@@ -2190,6 +2374,8 @@ export type Database = {
2190
2374
  };
2191
2375
  Returns: Json;
2192
2376
  };
2377
+ approve_shop_category: { Args: { p_category_id: string }; Returns: Json };
2378
+ approve_shop_product: { Args: { p_product_id: string }; Returns: Json };
2193
2379
  authorize_manager: {
2194
2380
  Args: {
2195
2381
  requested_permission: Database["public"]["Enums"]["manager_permission"];
@@ -2653,6 +2839,14 @@ export type Database = {
2653
2839
  Args: { p_post_id: string };
2654
2840
  Returns: undefined;
2655
2841
  };
2842
+ reject_shop_category: {
2843
+ Args: { p_category_id: string; p_rejection_reason: string };
2844
+ Returns: Json;
2845
+ };
2846
+ reject_shop_product: {
2847
+ Args: { p_product_id: string; p_rejection_reason: string };
2848
+ Returns: Json;
2849
+ };
2656
2850
  reorder_shop_categories: {
2657
2851
  Args: { p_category_ids: string[] };
2658
2852
  Returns: Json;
@@ -2698,7 +2892,7 @@ export type Database = {
2698
2892
  upsert_shop_category: {
2699
2893
  Args: {
2700
2894
  p_category_id?: string;
2701
- p_is_visible?: boolean;
2895
+ p_description?: string;
2702
2896
  p_name?: string;
2703
2897
  p_slug?: string;
2704
2898
  p_sort_order?: number;
@@ -2722,7 +2916,6 @@ export type Database = {
2722
2916
  p_description?: string;
2723
2917
  p_download_expires_hours?: number;
2724
2918
  p_images?: string[];
2725
- p_is_active?: boolean;
2726
2919
  p_is_featured?: boolean;
2727
2920
  p_low_stock_threshold?: number;
2728
2921
  p_max_downloads?: number;
@@ -2896,6 +3089,7 @@ export type Database = {
2896
3089
  | "implemented"
2897
3090
  | "rejected"
2898
3091
  | "duplicate";
3092
+ shop_approval_status_enum: "pending" | "approved" | "rejected";
2899
3093
  shop_order_item_status_enum:
2900
3094
  | "pending"
2901
3095
  | "paid"
@@ -3175,6 +3369,7 @@ export const Constants = {
3175
3369
  "rejected",
3176
3370
  "duplicate",
3177
3371
  ],
3372
+ shop_approval_status_enum: ["pending", "approved", "rejected"],
3178
3373
  shop_order_item_status_enum: [
3179
3374
  "pending",
3180
3375
  "paid",