Skip to content

Commit 72e9ba4

Browse files
authored
Logo URL Bug Fixed (#105)
* logo URL Bug fixed
1 parent f216a3e commit 72e9ba4

File tree

6 files changed

+30
-25
lines changed

6 files changed

+30
-25
lines changed

controllers/opportunity/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class opportunityController {
1616
opportunityDate,
1717
opportunityURL,
1818
onlyForFemale,
19+
organisationLogoURL,
1920
} = req.body;
2021

2122
try {
@@ -29,7 +30,8 @@ class opportunityController {
2930
opportunityRegistrationDeadline,
3031
opportunityDate,
3132
opportunityURL,
32-
onlyForFemale
33+
onlyForFemale,
34+
organisationLogoURL
3335
);
3436

3537
return res.status(201).json({

managers/opportunity/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class opportunityManager {
1414
opportunityRegistrationDeadline,
1515
opportunityDate,
1616
opportunityURL,
17-
onlyForFemale
17+
onlyForFemale,
18+
organisationLogoURL
1819
) {
1920
let opportunity = {
2021
opportunityTitle: opportunityTitle,
@@ -27,8 +28,8 @@ class opportunityManager {
2728
opportunityDate: opportunityDate,
2829
opportunityURL: opportunityURL,
2930
onlyForFemale: onlyForFemale,
31+
organisationLogoURL: organisationLogoURL,
3032
};
31-
//console.log('Values received in manager', opportunity);
3233

3334
try {
3435
let newOpportunity = await this.opportunity.create(opportunity);

models/opportunity.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,16 @@ let opportunitySchema = new mongoose.Schema({
5656
required: true,
5757
},
5858

59-
onlyForFemale:{
60-
type:Boolean,
61-
required:true,
62-
default:false
63-
}
64-
,
65-
organisationLogoURL:{
66-
67-
type :String ,
68-
required : false ,
69-
default : "https://picsum.photos/200"
70-
}
71-
59+
onlyForFemale: {
60+
type: Boolean,
61+
required: true,
62+
default: false,
63+
},
64+
organisationLogoURL: {
65+
type: String,
66+
required: false,
67+
default: 'https://picsum.photos/200',
68+
},
7269
});
7370

7471
export default mongoose.model('opportunity', opportunitySchema);

routes/opportunity.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ const opportunityManager = new OpportunityManager(),
6666
* example: true
6767
* organisationLogoURL:
6868
* type:string
69-
* description:URL of the organisation
70-
* example:www.amazon.com
69+
* description:URL of the organisation
70+
* example:www.amazon.com
7171
* post_schema:
7272
* type: object
7373
* required:
@@ -180,7 +180,6 @@ router.get('/', (req, res) => {
180180
* description: Sorry, opportunity could not be created!
181181
*/
182182
router.post('/', (req, res) => {
183-
console.log('Inside Route');
184183
opportunityController.createOpportunity(req, res);
185184
});
186185

@@ -233,7 +232,7 @@ router.post('/', (req, res) => {
233232
* type: string
234233
* description: URL of the opportunity
235234
* organisationLogoURL:
236-
* type:string
235+
* type:string
237236
* description :URL of the organisation
238237
* responses:
239238
* 201:

services/opportunity/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ class opportunityService {
1212
opportunityRegistrationDeadline,
1313
opportunityDate,
1414
opportunityURL,
15-
onlyForFemale
15+
onlyForFemale,
16+
organisationLogoURL
1617
) {
17-
console.log('Inside Service');
18-
1918
try {
2019
let newOpportunity = await this.opportunityManager.createOpportunity(
2120
opportunityTitle,
@@ -27,7 +26,8 @@ class opportunityService {
2726
opportunityRegistrationDeadline,
2827
opportunityDate,
2928
opportunityURL,
30-
onlyForFemale
29+
onlyForFemale,
30+
organisationLogoURL
3131
);
3232
return newOpportunity;
3333
} catch (err) {
@@ -50,7 +50,9 @@ class opportunityService {
5050

5151
async deleteOpportunity(opportunity_id) {
5252
try {
53-
let deletedDocument = await this.opportunityManager.deleteOpportunity(opportunity_id);
53+
let deletedDocument = await this.opportunityManager.deleteOpportunity(
54+
opportunity_id
55+
);
5456
return deletedDocument;
5557
} catch (err) {
5658
console.log('ERROR IN deleteOpportunity Service');

tests/managers/opportunity-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ describe('OpportunityManager', function () {
176176
expect(deletedOpportunity.opportunityRegistrationDeadline).to.equal(
177177
stubValue.opportunityRegistrationDeadline
178178
);
179+
180+
expect(deletedOpportunity.organisationLogoURL).to.equal(
181+
stubValue.organisationLogoURL
182+
);
179183
});
180184
});
181185
});

0 commit comments

Comments
 (0)