Skip to content

Amended software model by changing developedBy and maintainedBy fields from reference to user to an array of String #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions models/software.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ const softwareSchema = new mongoose.Schema(
homePage: {
type: String,
validate: [
(value) => isURL(value, {
protocols: ['http', 'https'],
}),
(value) =>
isURL(value, {
protocols: ['http', 'https'],
}),
'A valid url is required',
],
required: [true, 'Software homepage url is required'],
Expand Down Expand Up @@ -64,17 +65,19 @@ const softwareSchema = new mongoose.Schema(
developedBy: {
type: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
type: String,
trim: true,
lowercase: true,
},
],
default: [],
},
maintainedBy: {
type: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
type: String,
trim: true,
lowercase: true,
},
],
default: [],
Expand All @@ -87,19 +90,21 @@ const softwareSchema = new mongoose.Schema(
updateUrl: {
type: String,
validate: [
(value) => isURL(value, {
protocols: ['http', 'https'],
}) || value === '',
(value) =>
isURL(value, {
protocols: ['http', 'https'],
}) || value === '',
'A valid update url is required',
],
default: '',
},
downloadUrl: {
type: String,
validate: [
(value) => isURL(value, {
protocols: ['http', 'https', 'ftp'],
}) || value === '',
(value) =>
isURL(value, {
protocols: ['http', 'https', 'ftp'],
}) || value === '',
'A valid download url is required',
],
default: '',
Expand Down