@deallony/shared 1.0.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.
Files changed (105) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/types/AccessTypeType.d.ts +5 -0
  4. package/dist/types/AccessTypeType.js +1 -0
  5. package/dist/types/AdType.d.ts +33 -0
  6. package/dist/types/AdType.js +1 -0
  7. package/dist/types/AppStartScreenType.d.ts +9 -0
  8. package/dist/types/AppStartScreenType.js +1 -0
  9. package/dist/types/CarBodyType.d.ts +5 -0
  10. package/dist/types/CarBodyType.js +1 -0
  11. package/dist/types/CategoryType.d.ts +17 -0
  12. package/dist/types/CategoryType.js +2 -0
  13. package/dist/types/CategoryWorkTypeType.d.ts +10 -0
  14. package/dist/types/CategoryWorkTypeType.js +1 -0
  15. package/dist/types/ChatType.d.ts +54 -0
  16. package/dist/types/ChatType.js +5 -0
  17. package/dist/types/CityType.d.ts +10 -0
  18. package/dist/types/CityType.js +1 -0
  19. package/dist/types/ColorType.d.ts +5 -0
  20. package/dist/types/ColorType.js +1 -0
  21. package/dist/types/CurrencyType.d.ts +12 -0
  22. package/dist/types/CurrencyType.js +1 -0
  23. package/dist/types/DeviceType.d.ts +32 -0
  24. package/dist/types/DeviceType.js +1 -0
  25. package/dist/types/DistrictType.d.ts +12 -0
  26. package/dist/types/DistrictType.js +1 -0
  27. package/dist/types/FacilityType.d.ts +6 -0
  28. package/dist/types/FacilityType.js +1 -0
  29. package/dist/types/FeatureType.d.ts +7 -0
  30. package/dist/types/FeatureType.js +1 -0
  31. package/dist/types/FuelTypeType.d.ts +5 -0
  32. package/dist/types/FuelTypeType.js +1 -0
  33. package/dist/types/ImageType.d.ts +5 -0
  34. package/dist/types/ImageType.js +1 -0
  35. package/dist/types/LicenseTypeType.d.ts +5 -0
  36. package/dist/types/LicenseTypeType.js +1 -0
  37. package/dist/types/LocalizedNameType.d.ts +5 -0
  38. package/dist/types/LocalizedNameType.js +2 -0
  39. package/dist/types/MediaType.d.ts +9 -0
  40. package/dist/types/MediaType.js +1 -0
  41. package/dist/types/MessageTemplateType.d.ts +8 -0
  42. package/dist/types/MessageTemplateType.js +1 -0
  43. package/dist/types/MotorTrimType.d.ts +6 -0
  44. package/dist/types/MotorTrimType.js +1 -0
  45. package/dist/types/MotorType.d.ts +25 -0
  46. package/dist/types/MotorType.js +1 -0
  47. package/dist/types/NotificationTokenType.d.ts +7 -0
  48. package/dist/types/NotificationTokenType.js +1 -0
  49. package/dist/types/OfferTypeType.d.ts +5 -0
  50. package/dist/types/OfferTypeType.js +1 -0
  51. package/dist/types/PermissionType.d.ts +6 -0
  52. package/dist/types/PermissionType.js +3 -0
  53. package/dist/types/PotentialUserType.d.ts +38 -0
  54. package/dist/types/PotentialUserType.js +1 -0
  55. package/dist/types/PriceTypeType.d.ts +7 -0
  56. package/dist/types/PriceTypeType.js +1 -0
  57. package/dist/types/PropertyStatusType.d.ts +5 -0
  58. package/dist/types/PropertyStatusType.js +1 -0
  59. package/dist/types/PropertyType.d.ts +25 -0
  60. package/dist/types/PropertyType.js +1 -0
  61. package/dist/types/PropertyTypeType.d.ts +6 -0
  62. package/dist/types/PropertyTypeType.js +1 -0
  63. package/dist/types/PublisherTypeType.d.ts +5 -0
  64. package/dist/types/PublisherTypeType.js +1 -0
  65. package/dist/types/RegionalSpecType.d.ts +5 -0
  66. package/dist/types/RegionalSpecType.js +1 -0
  67. package/dist/types/ResponseType.d.ts +6 -0
  68. package/dist/types/ResponseType.js +2 -0
  69. package/dist/types/RoleType.d.ts +9 -0
  70. package/dist/types/RoleType.js +1 -0
  71. package/dist/types/ServiceType.d.ts +12 -0
  72. package/dist/types/ServiceType.js +1 -0
  73. package/dist/types/ServicesLocationsType.d.ts +6 -0
  74. package/dist/types/ServicesLocationsType.js +1 -0
  75. package/dist/types/SocialMediaPlatformType.d.ts +7 -0
  76. package/dist/types/SocialMediaPlatformType.js +1 -0
  77. package/dist/types/SocialMediaProfileType.d.ts +6 -0
  78. package/dist/types/SocialMediaProfileType.js +1 -0
  79. package/dist/types/StatusType.d.ts +9 -0
  80. package/dist/types/StatusType.js +1 -0
  81. package/dist/types/SubjectType.d.ts +17 -0
  82. package/dist/types/SubjectType.js +13 -0
  83. package/dist/types/TransmissionType.d.ts +5 -0
  84. package/dist/types/TransmissionType.js +1 -0
  85. package/dist/types/UnitType.d.ts +5 -0
  86. package/dist/types/UnitType.js +1 -0
  87. package/dist/types/UserType.d.ts +33 -0
  88. package/dist/types/UserType.js +1 -0
  89. package/dist/types/WalletType.d.ts +7 -0
  90. package/dist/types/WalletType.js +1 -0
  91. package/dist/types/WorkTypeType.d.ts +6 -0
  92. package/dist/types/WorkTypeType.js +1 -0
  93. package/dist/types/index.d.ts +2 -0
  94. package/dist/types/index.js +2 -0
  95. package/dist/types/product/ProductCategoryType.d.ts +15 -0
  96. package/dist/types/product/ProductCategoryType.js +1 -0
  97. package/dist/types/product/UsedProductAge.d.ts +7 -0
  98. package/dist/types/product/UsedProductAge.js +1 -0
  99. package/dist/types/product/UsedProductCondation.d.ts +7 -0
  100. package/dist/types/product/UsedProductCondation.js +1 -0
  101. package/dist/types/product/UsedProductType.d.ts +6 -0
  102. package/dist/types/product/UsedProductType.js +1 -0
  103. package/dist/validation/ad/save-ad.d.ts +45 -0
  104. package/dist/validation/ad/save-ad.js +52 -0
  105. package/package.json +22 -0
@@ -0,0 +1 @@
1
+ export * as TYPES from './types';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * as TYPES from './types';
@@ -0,0 +1,5 @@
1
+ export type AccessTypeType = {
2
+ id?: string;
3
+ name: string;
4
+ description: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ import { MotorType } from "./MotorType";
2
+ import { UsedProductType } from "./product/UsedProductType";
3
+ import { PropertyType } from "./PropertyType";
4
+ import { ServiceType } from "./ServiceType";
5
+ import { SubjectTableType } from "./SubjectType";
6
+ import { UserType } from "./UserType";
7
+ export type AdType = {
8
+ id?: number;
9
+ user_id?: number;
10
+ status_id?: number;
11
+ title: string;
12
+ description?: string;
13
+ category_id?: number;
14
+ price?: number;
15
+ base_price?: number;
16
+ currency_id?: number;
17
+ negotiable?: boolean;
18
+ views?: number;
19
+ city_id?: number;
20
+ latitude?: number;
21
+ longitude?: number;
22
+ media?: any;
23
+ subject_id?: number;
24
+ subject_type?: SubjectTableType;
25
+ motor?: MotorType;
26
+ property?: PropertyType;
27
+ product?: UsedProductType;
28
+ service?: ServiceType;
29
+ selected_phone?: string;
30
+ user: UserType;
31
+ created_at?: string;
32
+ updated_at?: string;
33
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { MediaType } from "./MediaType";
2
+ export type AppStartScreenType = {
3
+ id?: number;
4
+ title: string;
5
+ description: string;
6
+ created_at?: string;
7
+ updated_at?: string;
8
+ media: MediaType;
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from "./LocalizedNameType";
2
+ export type CarBodyType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { CategoryWorkTypeType } from "./CategoryWorkTypeType";
2
+ import { MediaType } from "./MediaType";
3
+ import { SubjectTableType } from "./SubjectType";
4
+ export type CategoryType = {
5
+ id?: number;
6
+ parent_id?: number | null;
7
+ name: string;
8
+ description?: string;
9
+ display_order?: number;
10
+ children?: CategoryType[];
11
+ category_work_types?: Array<CategoryWorkTypeType>;
12
+ isBranch: boolean;
13
+ should_validate?: boolean;
14
+ type?: SubjectTableType;
15
+ props?: Record<string, any>;
16
+ media: MediaType;
17
+ };
@@ -0,0 +1,2 @@
1
+ ``;
2
+ export {};
@@ -0,0 +1,10 @@
1
+ import { CategoryType } from "./CategoryType";
2
+ import { WorkTypeType } from "./WorkTypeType";
3
+ export type CategoryWorkTypeType = {
4
+ id?: number;
5
+ category_id: number;
6
+ work_type_id: number;
7
+ is_price_require: boolean;
8
+ workType?: WorkTypeType;
9
+ category?: CategoryType;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ export type ChatRoomType = {
2
+ id: number;
3
+ requester_id: number;
4
+ provider_id: number;
5
+ ad_id?: number | null;
6
+ created_at: Date;
7
+ requester: {
8
+ id: number;
9
+ name: string;
10
+ phone: string;
11
+ email?: string;
12
+ };
13
+ provider: {
14
+ id: number;
15
+ name: string;
16
+ phone: string;
17
+ email?: string;
18
+ };
19
+ ad?: {
20
+ id: number;
21
+ title: string;
22
+ } | null;
23
+ chats?: ChatMessageType[];
24
+ lastMessage?: string;
25
+ lastMessageAt?: Date;
26
+ };
27
+ export type ChatMessageType = {
28
+ id: number;
29
+ message: string;
30
+ message_type: MessageType;
31
+ payload?: Record<string, any> | null;
32
+ created_at: Date;
33
+ chat_room_id: number;
34
+ sender_id: number;
35
+ sender: {
36
+ id: number;
37
+ name: string;
38
+ phone: string;
39
+ };
40
+ };
41
+ export declare enum MessageType {
42
+ TEXT = 1,
43
+ PRICE_OFFER = 2
44
+ }
45
+ export type SendMessagePayload = {
46
+ chat_room_id: number;
47
+ requester_id: number;
48
+ provider_id: number;
49
+ sender_id: number;
50
+ message: string;
51
+ message_type?: MessageType;
52
+ payload?: Record<string, any> | null;
53
+ ad_id?: number | null;
54
+ };
@@ -0,0 +1,5 @@
1
+ export var MessageType;
2
+ (function (MessageType) {
3
+ MessageType[MessageType["TEXT"] = 1] = "TEXT";
4
+ MessageType[MessageType["PRICE_OFFER"] = 2] = "PRICE_OFFER";
5
+ })(MessageType || (MessageType = {}));
@@ -0,0 +1,10 @@
1
+ import { DistrictType } from "./DistrictType";
2
+ export type CityType = {
3
+ id?: number;
4
+ name: string;
5
+ centerPoint?: {
6
+ lat: number;
7
+ lng: number;
8
+ } | null;
9
+ districts?: DistrictType[];
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type ColorType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export type CurrencyType = {
2
+ id?: number;
3
+ name: string;
4
+ symbol: string;
5
+ key?: string | null;
6
+ base_currency?: boolean;
7
+ exchange_rate?: string;
8
+ url?: string | null;
9
+ selector?: string | null;
10
+ created_at?: Date;
11
+ updated_at?: Date;
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ export type DeviceType = {
2
+ id?: number;
3
+ user_id?: number | null;
4
+ is_logout?: boolean;
5
+ device_id: string;
6
+ device_name?: string | null;
7
+ device_brand?: string | null;
8
+ os?: string | null;
9
+ os_version?: string | null;
10
+ is_tablet?: boolean;
11
+ version_app?: string | null;
12
+ first_install_date?: Date | null;
13
+ open_count?: number;
14
+ last_open_date?: Date | null;
15
+ network_type?: string | null;
16
+ language?: string | null;
17
+ country?: string | null;
18
+ notification_token?: string | null;
19
+ last_notification_sent?: Date | null;
20
+ last_notification_clicked?: Date | null;
21
+ notification_enabled?: boolean;
22
+ screen_resolution?: string | null;
23
+ build_type?: string | null;
24
+ heartbeat?: Date | null;
25
+ created_at?: Date;
26
+ updated_at?: Date;
27
+ user?: {
28
+ id: number;
29
+ name: string;
30
+ phone: string;
31
+ };
32
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { CityType } from "./CityType";
2
+ export type DistrictType = {
3
+ id?: number;
4
+ name: string;
5
+ should_validate: boolean;
6
+ city_id: number;
7
+ city?: CityType;
8
+ zonePoints?: {
9
+ lat: number;
10
+ lng: number;
11
+ }[];
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type FacilityType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ type?: string;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { LocalizedNameType } from "./LocalizedNameType";
2
+ import { SubjectTableEnum } from "./SubjectType";
3
+ export type FeatureType = {
4
+ id?: number;
5
+ name: LocalizedNameType;
6
+ type?: SubjectTableEnum;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from "./LocalizedNameType";
2
+ export type FuelTypeType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type ImageType = {
2
+ id?: number;
3
+ name: string;
4
+ uri: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type LicenseTypeType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type LocalizedNameType = {
2
+ en: string;
3
+ ar: string;
4
+ };
5
+ export declare const createEmptyLocalizedName: () => LocalizedNameType;
@@ -0,0 +1,2 @@
1
+ // Utility to create an empty localized name object
2
+ export const createEmptyLocalizedName = () => ({ en: "", ar: "" });
@@ -0,0 +1,9 @@
1
+ export type MediaType = {
2
+ id?: number;
3
+ mimetype: string;
4
+ url: string;
5
+ width?: number;
6
+ height?: number;
7
+ isMain?: boolean;
8
+ size?: number;
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export type MessageTemplateType = {
2
+ id?: number;
3
+ name: string;
4
+ body: string;
5
+ param_keys?: string[];
6
+ status_ids?: number[] | null;
7
+ special_case_keys?: string[];
8
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { LocalizedNameType } from "./LocalizedNameType";
2
+ export type MotorTrimType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ category_id: number;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { SubjectTableEnum } from "./SubjectType";
2
+ export type MotorOfferType = 'sale' | 'for_rent';
3
+ export type MotorDoors = number | null;
4
+ export type MotorType = {
5
+ id: number;
6
+ componentType?: SubjectTableEnum.MOTORS;
7
+ trim_id?: number | null;
8
+ body_type_id: number;
9
+ regional_spec_id: number;
10
+ transmission_id: number;
11
+ fuel_type_id: number;
12
+ age_id: number;
13
+ condition_id: number;
14
+ interior_color_id: number;
15
+ exterior_color_id?: number | null;
16
+ mileage: number;
17
+ offer_type_id: MotorOfferType;
18
+ year: number;
19
+ doors?: MotorDoors;
20
+ horsepower?: number | null;
21
+ created_at: string;
22
+ updated_at: string;
23
+ publisher_type_id?: number;
24
+ price_type_id?: number;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type NotificationTokenType = {
2
+ id: number;
3
+ token: string;
4
+ userId: number;
5
+ deviceId: string;
6
+ createdAt: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type OfferTypeType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export type PermissionType = {
2
+ id?: number;
3
+ key: string;
4
+ description?: string | null;
5
+ };
6
+ export declare const AvailablePermissions: PermissionType[];
@@ -0,0 +1,3 @@
1
+ export const AvailablePermissions = [
2
+ { key: "City_Delete", description: "Permission to delete cities" },
3
+ ];
@@ -0,0 +1,38 @@
1
+ export type PotentialUserType = {
2
+ id: number;
3
+ name?: string;
4
+ phone_number: string;
5
+ note?: string;
6
+ user_id?: number | null;
7
+ saved_by?: number;
8
+ user?: {
9
+ id: number;
10
+ name: string;
11
+ phone?: string;
12
+ [k: string]: any;
13
+ } | null;
14
+ savedBy?: {
15
+ id: number;
16
+ name: string;
17
+ phone?: string;
18
+ [k: string]: any;
19
+ } | null;
20
+ last_message_at?: string | null;
21
+ created_at?: string;
22
+ subject_type?: string;
23
+ };
24
+ export type CreatePotentialUserPayload = {
25
+ name?: string;
26
+ phone_number: string;
27
+ note?: string;
28
+ user_id?: string;
29
+ last_message_at?: Date | string;
30
+ };
31
+ export type UpdatePotentialUserPayload = {
32
+ id: number;
33
+ name?: string;
34
+ phone_number?: string;
35
+ note?: string;
36
+ user_id?: string | null;
37
+ last_message_at?: Date | string | null;
38
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type PriceTypeType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ display_order?: number;
6
+ offer_type_id?: number;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type PropertyStatusType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { SubjectTableEnum } from "./SubjectType";
2
+ export type PropertyBathroomsEnum = '0' | '1' | '2' | '3' | '4' | '5' | '6';
3
+ export type PropertyFurnishedEnum = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '+10';
4
+ export type PropertyType = {
5
+ id: number;
6
+ componentType?: SubjectTableEnum.PROPERTIES;
7
+ property_type_id: number;
8
+ property_status_id: number;
9
+ license_type_id: number;
10
+ offer_type_id: number;
11
+ price_type_id: number;
12
+ publisher_type_id: number;
13
+ size_m2: number;
14
+ bedrooms?: number;
15
+ bathrooms: PropertyBathroomsEnum;
16
+ furnished: PropertyFurnishedEnum;
17
+ parking: boolean;
18
+ floor?: number;
19
+ total_floors?: number;
20
+ age_id: number;
21
+ condition_id: number;
22
+ district_id: number;
23
+ created_at: string;
24
+ updated_at: string;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type PropertyTypeType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ category_id: number;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type PublisherTypeType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type RegionalSpecType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export type ResponseType = {
2
+ values: any;
3
+ success: boolean;
4
+ message: string;
5
+ statusCode: number;
6
+ };
@@ -0,0 +1,2 @@
1
+ // import { AxiosResponse } from "axios";
2
+ export {};
@@ -0,0 +1,9 @@
1
+ export type RoleType = {
2
+ id: number;
3
+ name: string;
4
+ isEnterDashboard?: boolean;
5
+ description?: string | null;
6
+ permissionIds?: number[];
7
+ createdAt?: string | Date;
8
+ updatedAt?: string | Date;
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { MediaType } from "./MediaType";
2
+ import { ServiceLocationType } from "./ServicesLocationsType";
3
+ export type ServiceType = {
4
+ id?: number;
5
+ user_id: number;
6
+ title: string;
7
+ unit_id: number | null;
8
+ access_type_id: number | null;
9
+ work_type_id: number | null;
10
+ locations: ServiceLocationType[];
11
+ media: MediaType[];
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export type ServiceLocationType = {
2
+ id?: number;
3
+ service_id?: number;
4
+ district_id?: number;
5
+ city_id: number;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { MediaType } from "./MediaType";
2
+ export type SocialMediaPlatformType = {
3
+ id: number;
4
+ name: string;
5
+ url_pattern: string;
6
+ media: MediaType;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export type SocialMediaProfileType = {
2
+ id: number;
3
+ link: string;
4
+ user_id: number;
5
+ platform_id: number;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { LocalizedNameType } from "./LocalizedNameType";
2
+ export type StatusType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ is_default: boolean;
6
+ show: boolean;
7
+ color?: string | null;
8
+ special_case_keys?: string[];
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ export type SubjectTableType = "properties" | "services" | 'motors' | 'used_products';
2
+ export declare enum SubjectTableEnum {
3
+ PROPERTIES = "properties",
4
+ SERVICES = "services",
5
+ MOTORS = "motors",
6
+ USED_PRODUCTS = "used_products"
7
+ }
8
+ export type SubjectTypeOption = {
9
+ value: SubjectTableType;
10
+ label: string;
11
+ isCategory?: boolean;
12
+ isAge?: boolean;
13
+ isCondition?: boolean;
14
+ color?: string;
15
+ [key: string]: any;
16
+ };
17
+ export declare const SubjectTypeOptions: SubjectTypeOption[];
@@ -0,0 +1,13 @@
1
+ export var SubjectTableEnum;
2
+ (function (SubjectTableEnum) {
3
+ SubjectTableEnum["PROPERTIES"] = "properties";
4
+ SubjectTableEnum["SERVICES"] = "services";
5
+ SubjectTableEnum["MOTORS"] = "motors";
6
+ SubjectTableEnum["USED_PRODUCTS"] = "used_products";
7
+ })(SubjectTableEnum || (SubjectTableEnum = {}));
8
+ export const SubjectTypeOptions = [
9
+ { value: SubjectTableEnum.SERVICES, label: "Services", isCategory: true, color: '#3B82F6', isAge: false, isCondition: false, isFeature: false },
10
+ { value: SubjectTableEnum.MOTORS, label: "Motors", isCategory: true, color: '#125b40ff', isAge: false, isCondition: false, isFeature: true },
11
+ { value: SubjectTableEnum.USED_PRODUCTS, label: "Used Products", isCategory: true, color: '#6b5212ff', isAge: true, isCondition: true, isFeature: false },
12
+ { value: SubjectTableEnum.PROPERTIES, label: "properties", isCategory: false, color: '#6c4fc3ff', isAge: true, isCondition: true, isFeature: true },
13
+ ];
@@ -0,0 +1,5 @@
1
+ import { LocalizedNameType } from './LocalizedNameType';
2
+ export type TransmissionType = {
3
+ id?: number;
4
+ name: LocalizedNameType;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type UnitType = {
2
+ id?: number;
3
+ name: string;
4
+ should_validate: boolean;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ import { AdType } from "./AdType";
2
+ import { NotificationTokenType } from "./NotificationTokenType";
3
+ import { SocialMediaProfileType } from "./SocialMediaProfileType";
4
+ import { WalletType } from "./WalletType";
5
+ import { RoleType } from "./RoleType";
6
+ export type UserType = {
7
+ id?: number;
8
+ name: string;
9
+ token: string;
10
+ phone: string;
11
+ referral_id?: number | null;
12
+ referral_code?: string | null;
13
+ role_id: number;
14
+ role: RoleType;
15
+ phone_numbers?: Array<{
16
+ number: string;
17
+ name: string;
18
+ is_primary: boolean;
19
+ }>;
20
+ ads?: AdType[];
21
+ notificationTokens?: NotificationTokenType[];
22
+ socialMediaProfiles?: SocialMediaProfileType[];
23
+ referredUsers?: Array<{
24
+ id: number;
25
+ name: string;
26
+ phone: string;
27
+ }>;
28
+ wallet?: WalletType;
29
+ created_at?: string;
30
+ updated_at?: string;
31
+ blocked_at?: string | null;
32
+ };
33
+ export type UserTypeOrNull = UserType | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type WalletType = {
2
+ id: number;
3
+ user_id: number;
4
+ balance: string;
5
+ loyalty_points: number;
6
+ updated_at: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { CategoryWorkTypeType } from "./CategoryWorkTypeType";
2
+ export type WorkTypeType = {
3
+ id?: number;
4
+ name: string;
5
+ categoryWorkTypes?: CategoryWorkTypeType[];
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './AdType';
2
+ export * from './PropertyTypeType';
@@ -0,0 +1,2 @@
1
+ export * from './AdType';
2
+ export * from './PropertyTypeType';
@@ -0,0 +1,15 @@
1
+ import { MediaType } from "../MediaType";
2
+ export type ProductCategoryType = {
3
+ id?: number;
4
+ parent_id: number | null;
5
+ name: string;
6
+ media?: MediaType;
7
+ created_at: string;
8
+ updated_at: string;
9
+ parent?: ProductCategoryType;
10
+ isBranch?: boolean;
11
+ children?: ProductCategoryType[];
12
+ savedBy?: {
13
+ id: number;
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SubjectTableType } from "../SubjectType";
2
+ export type UsedProductAgeType = {
3
+ id?: number;
4
+ name: string;
5
+ description?: string;
6
+ subject_type?: SubjectTableType;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SubjectTableType } from "../SubjectType";
2
+ export type UsedProductConditionType = {
3
+ id?: number;
4
+ name: string;
5
+ description?: string;
6
+ subject_type?: SubjectTableType;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export type UsedProductType = {
2
+ id?: number;
3
+ condition_id: number;
4
+ age_id?: number;
5
+ isFree?: boolean;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ export declare const createAdSchema: z.ZodObject<{
3
+ title: z.ZodOptional<z.ZodString>;
4
+ status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
5
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ category_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
7
+ price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
8
+ currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
9
+ negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
10
+ city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
11
+ latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
12
+ longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
13
+ media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
14
+ base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
15
+ contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
16
+ by_message: z.ZodOptional<z.ZodBoolean>;
17
+ by_whatsapp: z.ZodOptional<z.ZodBoolean>;
18
+ by_call: z.ZodOptional<z.ZodBoolean>;
19
+ }, z.core.$strip>>>;
20
+ selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
+ user_id: z.ZodCoercedNumber<unknown>;
22
+ id: z.ZodOptional<z.ZodNever>;
23
+ }, z.core.$strip>;
24
+ export declare const updateAdSchema: z.ZodObject<{
25
+ id: z.ZodCoercedNumber<unknown>;
26
+ title: z.ZodOptional<z.ZodString>;
27
+ status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
28
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
+ category_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
30
+ price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
31
+ currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
32
+ negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
33
+ city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
34
+ latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
35
+ longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
36
+ media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
37
+ base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
38
+ contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
39
+ by_message: z.ZodOptional<z.ZodBoolean>;
40
+ by_whatsapp: z.ZodOptional<z.ZodBoolean>;
41
+ by_call: z.ZodOptional<z.ZodBoolean>;
42
+ }, z.core.$strip>>>;
43
+ selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
44
+ user_id: z.ZodCoercedNumber<unknown>;
45
+ }, z.core.$strip>;
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ const baseAdCommon = z.object({
3
+ title: z.string().trim().optional(),
4
+ status_id: z.coerce.number().int().positive().optional(),
5
+ description: z.string().trim().optional().nullable(),
6
+ category_id: z.coerce.number().int().positive().optional().nullable(),
7
+ price: z.coerce.number().min(0).optional().nullable(),
8
+ currency_id: z.coerce.number().int().positive().optional().nullable(),
9
+ negotiable: z.coerce.boolean().optional().nullable(),
10
+ city_id: z.coerce.number().int().positive().optional().nullable(),
11
+ latitude: z.coerce.number().optional().nullable(),
12
+ longitude: z.coerce.number().optional().nullable(),
13
+ media: z.array(z.any()).optional().nullable(),
14
+ // subject_type: SubjectTypeSchema.optional(),
15
+ base_price: z.coerce.number().optional().nullable(),
16
+ contact_methods: z.object({
17
+ by_message: z.boolean().optional(),
18
+ by_whatsapp: z.boolean().optional(),
19
+ by_call: z.boolean().optional(),
20
+ }).optional().nullable(),
21
+ selected_phone: z.string().trim().optional().nullable(),
22
+ });
23
+ export const createAdSchema = z.object({
24
+ user_id: z.coerce.number().int().positive(),
25
+ id: z.never().optional(), // disallow id on create
26
+ ...baseAdCommon.shape,
27
+ // motor: createMotorSchema
28
+ // .extend({ ad_id: z.coerce.number().optional() })
29
+ // .optional()
30
+ // .nullable(),
31
+ // // Make nested ad_id optional/nullable without changing original schemas
32
+ // property: createPropertySchema
33
+ // .extend({ ad_id: z.coerce.number().optional() })
34
+ // .optional()
35
+ // .nullable(),
36
+ // product: createUsedProductSchema
37
+ // .extend({ ad_id: z.coerce.number().optional() })
38
+ // .optional()
39
+ // .nullable(),
40
+ // service: createServiceSchema
41
+ // .extend({ ad_id: z.coerce.number().optional() })
42
+ // .optional()
43
+ // .nullable(),
44
+ });
45
+ export const updateAdSchema = z.object({
46
+ ...createAdSchema.shape,
47
+ id: z.coerce.number().int().positive(),
48
+ // motor: updateMotorSchema.optional().nullable(),
49
+ // property: updatePropertySchema.optional().nullable(),
50
+ // product: updateUsedProductSchema.optional().nullable(),
51
+ // service: updateServiceSchema.optional().nullable(),
52
+ });
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@deallony/shared",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "watch": "tsc --watch",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "dependencies": {
16
+ "zod": "^4.2.1"
17
+ },
18
+ "devDependencies": {
19
+ "@types/node": "^25.0.3",
20
+ "typescript": "^5.9.3"
21
+ }
22
+ }