-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeps.ts
38 lines (24 loc) · 1.01 KB
/
deps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export { Hono } from "https://deno.land/x/[email protected]/mod.ts";
export { GrpcServer } from "https://deno.land/x/[email protected]/server.ts";
export { getClient } from "https://deno.land/x/[email protected]/client.ts";
export { Database, MongoClient } from "https://deno.land/x/[email protected]/mod.ts";
export * as bcrypt from "https://deno.land/x/[email protected]/mod.ts";
export * from "./types/social_media.d.ts";
export * from "./types/user.d.ts";
export * from "./utils/bootstrap.ts";
import mongoose from "npm:[email protected]";
export { mongoose };
export const Schema = mongoose.Schema;
export const ObjectId = Schema.ObjectId;
export type ObjectIdType = mongoose.Types.ObjectId;
export const validObjectId = (id: string): boolean => {
return mongoose.isValidObjectId(id);
};
export const generateObjectId = (id?: string): ObjectIdType => {
if (id && validObjectId(id)) {
// @ts-ignore mongoose ObjectId typescript bug
return new mongoose.Types.ObjectId(id);
} else {
return new mongoose.Types.ObjectId();
}
};