@deallony/shared 1.2.61 → 1.2.63

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.
@@ -1,9 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import type { IAd } from "../../types/ad/Ad";
3
3
  import { createAdSchema, saveAdSchema, updateAdSchema } from "../../schema/ad/save-ad.schema";
4
+ import { findAdSchema } from "../../schema/ad/find-ad.schema";
5
+ import { adDailyViewsSchema } from "../../schema/ad/ad-views.schema";
4
6
  export type CreateAdDto = z.infer<typeof createAdSchema>;
5
7
  export type UpdateAdDto = z.infer<typeof updateAdSchema>;
6
8
  export type SaveAdDto = z.infer<typeof saveAdSchema>;
9
+ export type FindAdDto = z.input<typeof findAdSchema>;
10
+ export type AdDailyViewsDto = z.input<typeof adDailyViewsSchema>;
7
11
  export declare const AdDto: (params: {
8
12
  ad: IAd;
9
13
  }) => IAd;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ /** Most days of per-day views kept on the server (older merged days are deleted) */
3
+ export declare const AD_DAILY_VIEWS_MAX_DAYS = 180;
4
+ /** Body of `POST api/v1/ads/views-daily/:id`: the owner's views per day for the last `days` days */
5
+ export declare const adDailyViewsSchema: z.ZodObject<{
6
+ days: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
7
+ }, z.core.$strip>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.adDailyViewsSchema = exports.AD_DAILY_VIEWS_MAX_DAYS = void 0;
4
+ const zod_1 = require("zod");
5
+ /** Most days of per-day views kept on the server (older merged days are deleted) */
6
+ exports.AD_DAILY_VIEWS_MAX_DAYS = 180;
7
+ /** Body of `POST api/v1/ads/views-daily/:id`: the owner's views per day for the last `days` days */
8
+ exports.adDailyViewsSchema = zod_1.z.object({
9
+ days: zod_1.z.coerce.number().int().min(1).max(exports.AD_DAILY_VIEWS_MAX_DAYS).default(30),
10
+ });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Body of `POST api/v1/ads/find-one/:id`. Loading an ad counts a view unless `track_view` is false:
4
+ * only the ad details page should count, not the chat preview, the edit form or promotion screens.
5
+ * The viewer comes from the auth token, never from the body.
6
+ */
7
+ export declare const findAdSchema: z.ZodObject<{
8
+ track_view: z.ZodDefault<z.ZodBoolean>;
9
+ }, z.core.$strip>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAdSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Body of `POST api/v1/ads/find-one/:id`. Loading an ad counts a view unless `track_view` is false:
7
+ * only the ad details page should count, not the chat preview, the edit form or promotion screens.
8
+ * The viewer comes from the auth token, never from the body.
9
+ */
10
+ exports.findAdSchema = zod_1.z.object({
11
+ track_view: zod_1.z.boolean().default(true),
12
+ });
@@ -1 +1,3 @@
1
1
  export * from './save-ad.schema';
2
+ export * from './find-ad.schema';
3
+ export * from './ad-views.schema';
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./save-ad.schema"), exports);
18
+ __exportStar(require("./find-ad.schema"), exports);
19
+ __exportStar(require("./ad-views.schema"), exports);
@@ -0,0 +1,5 @@
1
+ /** Views of an ad on one day (YYYY-MM-DD, Asia/Damascus) */
2
+ export type IAdDailyViews = {
3
+ day: string;
4
+ views: number;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,7 @@ export * as ModuleFetchEndpoints from "./common/ModuleFetchEndpointsLastUpdated"
7
7
  export * as FilterParams from "./common/FilterParams";
8
8
  export * as Ad from "./ad/Ad";
9
9
  export * as AdLocation from "./ad/AdLocation";
10
+ export * as AdDailyViews from "./ad/AdDailyViews";
10
11
  export * as Addresses from "./addresses/Address";
11
12
  export * as AdPromotion from "./ad/AdPromotion";
12
13
  export * as Motor from "./motor/Motor";
@@ -36,8 +36,8 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Loyalty = exports.Favorite = exports.Wallet = exports.Permission = exports.Role = exports.User = exports.EventVenue = exports.EventWedding = exports.EventTimeline = exports.EventRsvp = exports.Event = exports.District = exports.City = exports.AdminBoundary = exports.WorkType = exports.UsedProductCondition = exports.UsedProductAge = exports.Unit = exports.Transmission = exports.RegionalSpec = exports.PublisherType = exports.PropertyStatus = exports.PriceType = exports.OfferType = exports.LicenseType = exports.FuelType = exports.Feature = exports.Facility = exports.Currency = exports.Color = exports.CategoryWorkType = exports.Category = exports.CarBody = exports.UsedProduct = exports.Service = exports.PropertySubType = exports.Property = exports.MotorTrim = exports.Motor = exports.AdPromotion = exports.Addresses = exports.AdLocation = exports.Ad = exports.FilterParams = exports.ModuleFetchEndpoints = exports.Config = exports.AccessType = exports.Status = exports.Response = exports.LocalizedName = void 0;
40
- exports.Payment = exports.Analysis = exports.GeminiApiKey = exports.Google = exports.Kyc = exports.SocialMediaProfile = exports.SocialMediaPlatform = exports.Image = exports.Media = exports.File = exports.NotificationToken = exports.MessageTemplate = exports.Device = exports.Chat = exports.AppStartScreen = exports.MetaData = exports.Company = exports.PotentialUser = void 0;
39
+ exports.Favorite = exports.Wallet = exports.Permission = exports.Role = exports.User = exports.EventVenue = exports.EventWedding = exports.EventTimeline = exports.EventRsvp = exports.Event = exports.District = exports.City = exports.AdminBoundary = exports.WorkType = exports.UsedProductCondition = exports.UsedProductAge = exports.Unit = exports.Transmission = exports.RegionalSpec = exports.PublisherType = exports.PropertyStatus = exports.PriceType = exports.OfferType = exports.LicenseType = exports.FuelType = exports.Feature = exports.Facility = exports.Currency = exports.Color = exports.CategoryWorkType = exports.Category = exports.CarBody = exports.UsedProduct = exports.Service = exports.PropertySubType = exports.Property = exports.MotorTrim = exports.Motor = exports.AdPromotion = exports.Addresses = exports.AdDailyViews = exports.AdLocation = exports.Ad = exports.FilterParams = exports.ModuleFetchEndpoints = exports.Config = exports.AccessType = exports.Status = exports.Response = exports.LocalizedName = void 0;
40
+ exports.Payment = exports.Analysis = exports.GeminiApiKey = exports.Google = exports.Kyc = exports.SocialMediaProfile = exports.SocialMediaPlatform = exports.Image = exports.Media = exports.File = exports.NotificationToken = exports.MessageTemplate = exports.Device = exports.Chat = exports.AppStartScreen = exports.MetaData = exports.Company = exports.PotentialUser = exports.Loyalty = void 0;
41
41
  // common
42
42
  exports.LocalizedName = __importStar(require("./common/LocalizedName"));
43
43
  exports.Response = __importStar(require("./common/Response"));
@@ -49,6 +49,7 @@ exports.FilterParams = __importStar(require("./common/FilterParams"));
49
49
  // listings
50
50
  exports.Ad = __importStar(require("./ad/Ad"));
51
51
  exports.AdLocation = __importStar(require("./ad/AdLocation"));
52
+ exports.AdDailyViews = __importStar(require("./ad/AdDailyViews"));
52
53
  exports.Addresses = __importStar(require("./addresses/Address"));
53
54
  exports.AdPromotion = __importStar(require("./ad/AdPromotion"));
54
55
  exports.Motor = __importStar(require("./motor/Motor"));
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ /** Most days of per-day views kept on the server (older merged days are deleted) */
3
+ export const AD_DAILY_VIEWS_MAX_DAYS = 180;
4
+ /** Body of `POST api/v1/ads/views-daily/:id`: the owner's views per day for the last `days` days */
5
+ export const adDailyViewsSchema = z.object({
6
+ days: z.coerce.number().int().min(1).max(AD_DAILY_VIEWS_MAX_DAYS).default(30),
7
+ });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Body of `POST api/v1/ads/find-one/:id`. Loading an ad counts a view unless `track_view` is false:
4
+ * only the ad details page should count, not the chat preview, the edit form or promotion screens.
5
+ * The viewer comes from the auth token, never from the body.
6
+ */
7
+ export const findAdSchema = z.object({
8
+ track_view: z.boolean().default(true),
9
+ });
@@ -1 +1,3 @@
1
1
  export * from './save-ad.schema.js';
2
+ export * from './find-ad.schema.js';
3
+ export * from './ad-views.schema.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -12,6 +12,7 @@ export * as FilterParams from "./common/FilterParams.js";
12
12
  // listings
13
13
  export * as Ad from "./ad/Ad.js";
14
14
  export * as AdLocation from "./ad/AdLocation.js";
15
+ export * as AdDailyViews from "./ad/AdDailyViews.js";
15
16
  export * as Addresses from "./addresses/Address.js";
16
17
  export * as AdPromotion from "./ad/AdPromotion.js";
17
18
  export * as Motor from "./motor/Motor.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deallony/shared",
3
- "version": "1.2.61",
3
+ "version": "1.2.63",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",