For this next part I figure I'll cover more of the backend for this project.
I used a Ruby on Rails framework, with a JavaScript React & Redux front end.
Here's a screencap from VS Code showing my migration files:
If you read part one, you may notice that I did not include the model Images before. I forgot to include this in my previous post since I didn't actually add on the Images model until pretty late in the project. I had hopes of setting up a direct upload system, using AWS or Cloudinary, but didn't end up being able to suss it out in the time available, so I created a model using simply image URLs.
The most challenging piece of figuring out this model structure was determining how to create the relationships I wanted to characters and locations.
From an 'IRL' perspective, Worlds have many Stories, Characters, and Locations. But Stories also have many Characters and Locations, and in a real world sense, they do so through Worlds. Drawing out these relationships quickly becomes a mess, and simply does not work on a database model level. Here's the model I landed on, which I also showed at the end of my last post:
As you can see, the addition of the 'story-characters' and 'story-locations' joins solved my problem, allowing for the many-to-many relationship between Stories and Characters/Locations while maintaining the one-to-many relationship between Worlds and Stories/Characters/Locations. The Images model is not on this relationship chart, since I made it at the start of my project. But if it were, you would see a great deal of one-to-many relationship arrows going from Images to just about all the other models.
While showcasing my project during my final week at Flatiron, someone, can't remember who, suggested it may be useful to be able to share Characters and Locations between Worlds. At this time, that would not be supported in my program. Each Character or Location is unique to the Setting the user has created them inside. I don't currently have plans to make that an option, but it may become a logical step once I've been able to make the expansions I want to.
That leads me to my thoughts on expanding the backend going forward. There are a few things I'd like to try out.
First, I definitely want to add 'Notes' to more levels than just Stories. Currently there is only the one spot to write content for a Character, Location, or World - that's in the 'description' for those models. The description can be as long as you like, but still, it's only the one page. At this time I'm unsure how I'll implement this - could go a couple ways. I could make more models like my 'story-notes' model, or I could adapt the 'story-notes' model to be simply 'notes,' and give it a one-to-many relationship with lots of models, akin to what I did with Images.
The second change may be more ambitious. I'd like to add another level of organization to the whole structure. Currently there are merely Worlds and Stories. I have envisioned these as Campaign Settings and Arcs or Novels and Chapters. The thing is, a huge reason I wanted to create something like this in the first place was to increase potential for organization. I have struggled with some note-taking apps that simply don't have enough layers of organization for me. I find myself wishing I could put folders at the highest level into one more folder. And here I find I've recreated the problem!
I'm dithering back and forth about exactly where another layer makes the most sense. Do I add Chapters under Stories? Do I add Arcs above Stories? In the end it will depend on what exactly I hope to accomplish, such as allow for multiple campaigns/novels (currently Worlds) in the same setting or more nuanced de-structuring of the story.
This would entail at least one new model, and may require some additional join tables. Ideally, I can restructure what I've got without tearing it all down first. This is all without even going into what this restructuring might do to the front end. Ahh! The prospect makes me start to go a little mad. So I'm gonna take this one step at a time. If I reach the point of being ready to implement some of these changes, I'll be sure to keep you posted on my progress! In the meantime, there are still some tweaks and improvements to be made to the Tome as is that take priority.
Oh, and a Happy Late Thanksgiving to all! Donate to your local Native American organizations if you can.
Top comments (0)