From abc62667f6f885be5178db4fb210ad203d4a7632 Mon Sep 17 00:00:00 2001 From: alameerashraf Date: Fri, 14 Feb 2020 18:04:27 +0200 Subject: [PATCH] Adding .env vars --- .env.dev | 11 +---------- .env.staging | 11 +---------- src/application/post/post.app.js | 6 +++--- src/models/post/post.js | 23 +++++++++++++++++++++++ 4 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 src/models/post/post.js diff --git a/.env.dev b/.env.dev index aafe973..340cb4d 100644 --- a/.env.dev +++ b/.env.dev @@ -1,13 +1,4 @@ NAME=DEV PORT=3255 ROUTING_PREFIX=/ -DATA_BASE_URL=mongodb://localhost:27017/seqtdb - -PROXY=195.87.150.104 -PROXY_PORT=80 - -GAPIMP_client_id=4pxVa7OvDNOMmT3GGTfdwM1dIvKACqdC -GAPIMP_client_secret=fGV6XuvrUVVDqsAe - -GAPIMP_URL=https://api.dev.se.com/token -bfoURL=https://api.qa.se.com/rest/bfo/opportunity/2.0/opportunities?seopptyreferenceId= +DATA_BASE_URL=mongodb://localhost:27017/postsDB diff --git a/.env.staging b/.env.staging index 57bc941..5a1fb59 100644 --- a/.env.staging +++ b/.env.staging @@ -1,13 +1,4 @@ NAME=STAGING PORT=3255 ROUTING_PREFIX=/seqt/ -DATA_BASE_URL=mongodb://localhost:27017/seqtdb - -PROXY=165.225.94.17 -PROXY_PORT=80 - -GAPIMP_client_id=4pxVa7OvDNOMmT3GGTfdwM1dIvKACqdC -GAPIMP_client_secret=fGV6XuvrUVVDqsAe - -GAPIMP_URL=https://api.dev.se.com/token -bfoURL=https://api.qa.se.com/rest/bfo/opportunity/2.0/opportunities?seopptyreferenceId= +DATA_BASE_URL=mongodb://localhost:27017/postsDB diff --git a/src/application/post/post.app.js b/src/application/post/post.app.js index 8556499..4c3c948 100644 --- a/src/application/post/post.app.js +++ b/src/application/post/post.app.js @@ -1,11 +1,11 @@ -import postService from ''; -import postModel from ''; +import postService from '../../services/post.service'; +import postModel from '../../models/post/post'; import createPost from './create-post/create-post'; // Construct the post service! -const service = new postService(); +const service = new postService(new postModel().constructModel() ); export default () => { return Object.freeze({ diff --git a/src/models/post/post.js b/src/models/post/post.js new file mode 100644 index 0000000..114c4c1 --- /dev/null +++ b/src/models/post/post.js @@ -0,0 +1,23 @@ +import mongoose, { Schema } from "mongoose"; +import subject from "./subject"; + +class post { + constructor() { + new subject().constructModel(); + } + + initSchema() { + const schema = new Schema({ + title: { type: String, required: true }, + body: { type: String } + }); + + return mongoose.model("post", schema); + } + + constructModel() { + return this.initSchema(); + } +} + +export default post;