Skip to content

Instantly share code, notes, and snippets.

@amosuro
Last active April 15, 2019 05:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amosuro/62a3919e66be046e688a2f56ee80c6ff to your computer and use it in GitHub Desktop.
Save amosuro/62a3919e66be046e688a2f56ee80c6ff to your computer and use it in GitHub Desktop.
Brief Templates Model Proposal
// This will be the BriefTemplate model which all Briefs will need to use. A BriefTemplate will always reference a 'type' which will be
// how we identify what further fields to use for that particular Brief.
{
type: {
type: String,
enum: ['WEBSITE', 'ANDROID_APP'],
default: 'WEBSITE'
},
status: {
type: String,
enum: ['DRAFT', 'READY', 'OVERDUE', 'NO_DEADLINE'],
default: 'DRAFT'
},
created_by: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
created_at: {
type: Date,
default: Date.now
},
updated_by: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
updated_at: {
type: Date,
default: Date.now
},
distributer: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
is_active: {
type: Boolean,
default: true
},
}
// This is an example of how the existing Brief model will look after we have extracted all of the generic data into BriefTemplate schema.
// Notice how there is only fields related to the BriefTemplate type = 'WEBSITE'
{
name: {
type: String
},
requirement: {
type: String
},
business_type: {
type: String
},
business_sector: {
type: String
},
business_offerings: {
type: String
},
services: [{
type: String
}],
products: [{
type: String
}],
frustrations: [{
type: String
}],
goals: [{
type: String
}],
require_brand_identity: {
type: Boolean,
default: false
},
demographic_age: [{
type: String
}],
demographic_employment: [{
type: String
}],
demographic_location: [{
type: String
}],
demographic_other: [{
type: String
}],
competitors: [{
title: { type: String },
body: { type: String}
}],
pages: [{
type: String
}],
use_existing_text_content: {
type: Boolean,
default: false
},
text_content: [{
type: String
}],
use_existing_imagery: {
type: Boolean,
default: false
},
imagery: [{
type: String
}],
use_existing_brand: {
type: Boolean,
default: false,
},
brand: [{
type: String
}],
use_existing_colours: {
type: Boolean,
default: false,
},
colours: [{
type: String
}],
inspiring_websites: [{
title: { type: String },
body: { type: String}
}],
use_existing_functionality: {
type: Boolean,
default: false
},
functionality: [{
type: String
}],
additional_functionality: [{
type: String
}],
use_existing_domain: {
type: Boolean,
default: false,
},
existing_domain: {
type: String
},
domains: [{
type: String
}],
require_hosting: {
type: Boolean,
default: false,
},
deadline: {
type: Date,
},
budget: {
type: String
},
additional_files: [{
type: String
}],
additional_comments: {
type: String
},
business_intro: {
type: String
},
require_cms: {
type: Boolean,
default: false,
},
require_seo: {
type: Boolean,
default: false,
},
require_maintenance: {
type: Boolean,
default: false,
},
require_analytics: {
type: Boolean,
default: false,
},
marketing_material: [{
type: String
}],
additional_contacts: [{
title: { type: String },
body: { type: String}
}],
}
// NOTE: This is just an example to explain how other BriefTemplate 'types' may look in the future. Please only use for reference and
// do not build this model!
{
name_existing_app: {
type: String
},
favourite_android_app: {
type: String
},
require_play_store_adverts: {
type: Boolean,
default: true
},
require_material_design: {
type: Boolean,
default: false
},
...
...
}
// This will be the Distributer model with the added field to know which BriefTemplates they have access to. This is needed, because in
// the UI they will have to select which BriefTemplate to use for a specific Client, so this will be asked when they are creating a new
// client account.
{
user_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
company_name: {
type: String,
required: true
},
clients: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
}],
is_active: {
type: Boolean,
default: true
},
created_at: {
type: Date,
default: Date.now
},
// Proposal: Need a way to reference which BriefTemplates they have access to
active_templates: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'BriefTemplate'
}],
}
// Example of how the Client model may look like
{
user_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
name: {
type: String,
required: true
},
created_by: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
briefs_count: {
type: Number,
default: 0
},
is_active: {
type: Boolean,
default: true
},
created_at: {
type: Date,
default: Date.now
},
// Proposal: Clients should inherit the available Brief Templates from
// the Distributer. E.g. if Distributer A only has access to WEBSITE BriefTemplate
// then the Client will only have access to this, and not ANDROID_APP
active_templates: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'BriefTemplate'
}],
}
// This is a very simple example of the types of fields we will need to represent ONE question. So a CustomBrief will be an object will
// many of these objects
{
name: {
type: String, // This will be the name of the CustomBrief e.g. 'IOS_APP'
required: true
},
fields: [{
section: {
type: Number // This will allow user to specify which section the question will be positioned e.g. 2
},
order: {
type: Number // This will allow user to specify which order the question will be placed in e.g. 1
},
type: {
type: String // e.g. "text"
},
label: {
type: String // e.g. "What is your deadline"
},
placeholder: {
type: String // e.g. "Enter a deadline..."
},
helperText: {
type: String // e.g. "This is so we can prioritise your requirement"
},
answers: [{ // e.g. If the type is a "dropdown" we will need to specify a selection of answers
type: String,
}],
_id: {
type: String // Unique identifier for field type
},
}]
}
@thatisusama
Copy link

hello,
In the briefTemplate model you want to save all fields related to type? like for android app you need to save additional information

{
name_existing_app: {
type: String
},
favourite_android_app: {
type: String
},
require_play_store_adverts: {
type: Boolean,
default: true
},
require_material_design: {
type: Boolean,
default: false
},
...
...
} and it will have all current fields which are in briefTemplate file?

@amosuro
Copy link
Author

amosuro commented Apr 15, 2019

Yes that is correct, all of the BriefTemplate fields are generic and will apply to all of the brief type models (Android, Website etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment