Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Breeds and species closes #21 #23

Merged
merged 2 commits into from
Jul 28, 2018
Merged

Breeds and species closes #21 #23

merged 2 commits into from
Jul 28, 2018

Conversation

smarbos
Copy link
Contributor

@smarbos smarbos commented Jul 25, 2018

I added breeds and species services to be used in the Animals service.

Both have:

  • displayName: is the name we will show.
  • default: will specify wich option will be preselected when creating a new animal.

for referencing we will use the _id field.

@smarbos smarbos added the enhancement New feature or request label Jul 25, 2018
@smarbos smarbos self-assigned this Jul 25, 2018
@smarbos smarbos requested a review from anabellaspinelli July 25, 2018 02:22
@@ -49,7 +49,7 @@ module.exports = function (app) {
type: Schema.Types.ObjectId,
required: true
},
race: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Race is a different, quite uglier concept 😓

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already changed that, its not race anymore.

required: true
},
default: {
type: Boolean,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have some kind of restriction so that only one can be default? I don't know if Mongo (of sql!) has something like this.

I'm thinking about Updates too, if another breed is selected as default, the previous default should be changed to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to do that later. Im gonna create an issue for that.
We need to do that on the breed and species "before" hook.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#24

const mongooseClient = app.get('mongooseClient');
const { Schema } = mongooseClient;
const species = new Schema({
displayName: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have an ID for breed and species or am I being to relational-SQL style?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has an autogenerated id

@smarbos smarbos merged commit 81d71aa into master Jul 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants