File tree 3 files changed +43
-4
lines changed
3 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ const softwareSchema = new mongoose.Schema(
26
26
trim : true ,
27
27
default : '0.0.0' ,
28
28
} ,
29
+ shortDescription : {
30
+ type : String ,
31
+ trim : true ,
32
+ maxlength : 100 ,
33
+ required : [ true , 'Software short description is required' ] ,
34
+ } ,
29
35
description : {
30
36
type : String ,
31
37
trim : true ,
@@ -52,6 +58,12 @@ const softwareSchema = new mongoose.Schema(
52
58
type : Boolean ,
53
59
required : true ,
54
60
} ,
61
+ pricing : {
62
+ type : String ,
63
+ trim : true ,
64
+ lowercase : true ,
65
+ required : [ true , 'Software pricing is required' ] ,
66
+ } ,
55
67
buildOn : {
56
68
type : [
57
69
{
@@ -82,6 +94,27 @@ const softwareSchema = new mongoose.Schema(
82
94
] ,
83
95
default : [ ] ,
84
96
} ,
97
+ videoLink : {
98
+ type : String ,
99
+ validate : [
100
+ ( value ) => {
101
+ if ( value ) {
102
+ return isURL ( value , {
103
+ protocols : [ 'http' , 'https' ] ,
104
+ host_whitelist : [ 'youtube.com' , 'vimeo.com' ] ,
105
+ } ) ;
106
+ }
107
+ return true ;
108
+ } ,
109
+ 'A valid video url is required (Only youtube.com or vimeo.com are supported)' ,
110
+ ] ,
111
+ default : '' ,
112
+ } ,
113
+ twitterUsername : {
114
+ type : String ,
115
+ trim : true ,
116
+ lowercase : true ,
117
+ } ,
85
118
query : {
86
119
isEnabled : {
87
120
type : Boolean ,
Original file line number Diff line number Diff line change 1
1
POST http://localhost:3001/api/software/
2
2
Content-Type: application/json
3
- Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNhbXBsZSIsImlkIjoiNWY4ZGEzODcwODlmZmY0ZGIwNmJjMGFmIiwiaWF0IjoxNjAzODkzMzExfQ.ARy4EKDMzJqd4DcZyWXP5hygSQ9A2Bw1YfMQ-Nb03JU
3
+ Authorization: bearer eyJ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- "description": "A sample software",
6
+ "name": "MyApp3",
7
+ "shortDescription": "MyApp3 Short descrption",
8
+ "description": "A sample software long description",
8
9
"homePage": "http://example.com",
9
10
"platform": "Windows",
10
- "isActiveDevelopment": true
11
+ "isActiveDevelopment": true,
12
+ "pricing": "free"
11
13
}
Original file line number Diff line number Diff line change @@ -2,17 +2,21 @@ const Software = require('../../../models/software');
2
2
3
3
const sampleSoftwareInDb1 = {
4
4
name : 'SampleSoftware' ,
5
+ shortDescription : 'A sample short description 1' ,
5
6
description : 'A sample software 1' ,
6
7
homePage : 'http://example.com' ,
7
8
platform : 'Windows' ,
9
+ pricing : 'free' ,
8
10
isActiveDevelopment : true ,
9
11
} ;
10
12
11
13
const sampleSoftwareInDb2 = {
12
14
name : 'SampleSoftware2' ,
15
+ shortDescription : 'A sample short description 2' ,
13
16
description : 'A sample software 1' ,
14
17
homePage : 'http://apple.com' ,
15
18
platform : 'MacOS' ,
19
+ pricing : 'paid' ,
16
20
isActiveDevelopment : false ,
17
21
} ;
18
22
You can’t perform that action at this time.
0 commit comments