@fesmex/models 0.1.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/README.md +36 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +8 -0
- package/dist/clients/models/ClientsContact.d.ts +16 -0
- package/dist/clients/models/ClientsContact.js +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/package.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @fesmex/models
|
|
2
|
+
|
|
3
|
+
Paquete con modelos de Mongoose compartidos.
|
|
4
|
+
|
|
5
|
+
## Estructura
|
|
6
|
+
```
|
|
7
|
+
src/
|
|
8
|
+
index.ts # reexporta dominios
|
|
9
|
+
clients/
|
|
10
|
+
index.ts # reexporta modelos de clientes
|
|
11
|
+
models/ClientsContact.ts
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Build
|
|
15
|
+
```
|
|
16
|
+
npm install
|
|
17
|
+
npm run build
|
|
18
|
+
```
|
|
19
|
+
Genera `dist/` con JS + d.ts.
|
|
20
|
+
|
|
21
|
+
## Uso en otros servicios
|
|
22
|
+
1) Instala `mongoose` en el servicio consumidor (peer dependency):
|
|
23
|
+
```
|
|
24
|
+
npm install mongoose @fesmex/models
|
|
25
|
+
```
|
|
26
|
+
2) Importa el modelo:
|
|
27
|
+
```ts
|
|
28
|
+
import { ClientContact } from "@fesmex/models/clients"
|
|
29
|
+
```
|
|
30
|
+
3) Conéctate a la misma `DB_URI` con mongoose antes de usar los modelos.
|
|
31
|
+
|
|
32
|
+
## Publicar (npm privado)
|
|
33
|
+
```
|
|
34
|
+
npm publish --access restricted
|
|
35
|
+
```
|
|
36
|
+
Configura `.npmrc` en el consumidor con tu token/registry.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ClientContact = void 0;
|
|
7
|
+
var ClientsContact_1 = require("./models/ClientsContact");
|
|
8
|
+
Object.defineProperty(exports, "ClientContact", { enumerable: true, get: function () { return __importDefault(ClientsContact_1).default; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Types } from "mongoose";
|
|
2
|
+
export interface ClientContactType {
|
|
3
|
+
client_id: Types.ObjectId;
|
|
4
|
+
contact_person_name?: string | null;
|
|
5
|
+
first_name?: string | null;
|
|
6
|
+
last_name?: string | null;
|
|
7
|
+
contact_phone?: string | null;
|
|
8
|
+
contact_email?: string | null;
|
|
9
|
+
pipedrive_id?: string | null;
|
|
10
|
+
created_at?: Date;
|
|
11
|
+
updated_at?: Date;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: import("mongoose").Model<ClientContactType, {}, {}, {}, import("mongoose").Document<unknown, {}, ClientContactType> & ClientContactType & {
|
|
14
|
+
_id: Types.ObjectId;
|
|
15
|
+
}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const clientContactSchema = new mongoose_1.Schema({
|
|
5
|
+
client_id: {
|
|
6
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
7
|
+
ref: "Client",
|
|
8
|
+
required: true,
|
|
9
|
+
index: true,
|
|
10
|
+
},
|
|
11
|
+
contact_person_name: { type: String },
|
|
12
|
+
first_name: { type: String },
|
|
13
|
+
last_name: { type: String },
|
|
14
|
+
contact_phone: { type: String },
|
|
15
|
+
contact_email: { type: String },
|
|
16
|
+
pipedrive_id: { type: String },
|
|
17
|
+
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
18
|
+
exports.default = (0, mongoose_1.model)("ClientContact", clientContactSchema, "client_contacts");
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./clients";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./clients"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fesmex/models",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": ["dist"],
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.json"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"mongoose": "^7"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "^5",
|
|
15
|
+
"@types/mongoose": "^5"
|
|
16
|
+
}
|
|
17
|
+
}
|