Skip to content

Commit

Permalink
🐛 fixed objectId validation union
Browse files Browse the repository at this point in the history
  • Loading branch information
hemedani committed Oct 31, 2023
1 parent 4dd3720 commit 4cf853f
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
import { ObjectId } from "./npmDeps.ts";
import { ObjectId, union } from "./npmDeps.ts";
import { instance, size, string } from "./npmDeps.ts";
import { TLesanBody } from "./utils/checkWants.ts";

export const objectIdValidation = instance(ObjectId) || size(string(), 24);
export const objectIdValidation = union([
instance(ObjectId),
size(string(), 24),
]);

/**
* details of input is include set , get
* @public
*/
export interface Details {
/**
* set of query
*/
set: Record<string, any>;
/**
* get pf query
* What the client wants to return
*/
get: Record<string, any>;
/**
* set of query
*/
set: Record<string, any>;
/**
* get pf query
* What the client wants to return
*/
get: Record<string, any>;
}

/**
* interface is type of input of Actions
* @public
*/
export interface TLesanBody {
/**
* name of service
* "main" | "blog" | "ecommerce"
*/
service?: string;
/**
* model : schema name that client wants
* act : name of Actions
*/
model: string;
act: string;
/**
* details of request set and get
*/
details: Details;
/**
* name of service
* "main" | "blog" | "ecommerce"
*/
service?: string;
/**
* model : schema name that client wants
* act : name of Actions
*/
model: string;
act: string;
/**
* details of request set and get
*/
details: Details;
}

/**
Expand All @@ -55,7 +57,7 @@ export interface TLesanBody {
* } *
*/
export interface LesanContenxt {
[key: string]: any;
Headers: Headers;
body: TLesanBody | null;
[key: string]: any;
Headers: Headers;
body: TLesanBody | null;
}

0 comments on commit 4cf853f

Please sign in to comment.