sailscastshq / captain-vane

Generate realistic test data for your Waterline model
https://docs.sailscasts.com/captain-vane
MIT License
3 stars 1 forks source link

Create multiple records #2

Closed haastrupea closed 2 years ago

haastrupea commented 2 years ago

Fixes #1 💯 Create multiple records with the vane helper

haastrupea commented 2 years ago

Looking good @haastrupea. Thanks for taking the time to submit this PR. Do you think we can rename totalRecord to count and I like that it is defaulting to 1. I'm looking at simplifying the code and just default to using .createEach even if the caller want's a single record. What do you think?

Thank you. I thought about it too, it is actually a great way to simplify the code

haastrupea commented 2 years ago

Looking good @haastrupea. Thanks for taking the time to submit this PR. Do you think we can rename totalRecord to count and I like that it is defaulting to 1. I'm looking at simplifying the code and just default to using .createEach even if the caller want's a single record. What do you think?

Done

DominusKelvin commented 2 years ago

@haastrupea this is getting exciting. I was wondering if we can smartly return an object if the record created was 1 and we can take that cognitive load off the user. What do you think?

Also, can you attach a screenshot of this working on your machine?

haastrupea commented 2 years ago

@haastrupea this is getting exciting. I was wondering if we can smartly return an object if the record created was 1 and we can take that cognitive load off the user. What do you think?

Also, can you attach a screenshot of this working on your machine?

Well, I thought about it too but you know the rule, always keep it simple. Now that you asked, it is done. Just so you know for readability I decided to go with the if block for the logic instead of a ternary operator. if that is okay.

DominusKelvin commented 2 years ago

Thanks @haastrupea