dataSeeds.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. This file is used to add some default seed data to the database when the app is initially
  3. setup. Normally this module would be ran from something like a grunt task so that it only
  4. runs once.
  5. */
  6. var models = require("./models");
  7. var User = models.User;
  8. var Note = models.Note;
  9. var Category = models.Category;
  10. var encrypt = require("./encrypt");
  11. module.exports = {
  12. seed: function() {
  13. models.sequelize.sync().on("success", function() {
  14. // User seeds
  15. User.findOrCreate({
  16. "username": "zeldman",
  17. "name": "Jeffery Zeldman",
  18. "bio": "Founder, Happy Cog studios. Author, Designing With Web Standards. Publisher, A List Apart, A Book Apart.",
  19. "twitter_handle": "@zeldman",
  20. "site": "zeldman.com"
  21. });
  22. User.findOrCreate({
  23. "username": "b_green",
  24. "name": "Brad Green",
  25. "bio": "I work at Google where I manage AngularJS and Google's internal sales productivity applications. I'm a dad.",
  26. "twitter_handle": "@bradlygreen",
  27. "site": "google.com/+BradGreen"
  28. });
  29. User.findOrCreate({
  30. "username": "Meyer the Eric",
  31. "name": "Eric A. Meyer",
  32. "bio": "Web standards | (X)HTML | CSS | microformats | community | writing | speaking | signing man.",
  33. "twitter_handle": "@meyerweb",
  34. "site": "meyerweb.com"
  35. });
  36. User.findOrCreate({
  37. "username": "GP",
  38. "name": "Gregg Pollack",
  39. "bio": "Founder of Envy Labs, Code School, Orlando Ruby Users Group, BarCamp Orlando, and the Orlando Tech Events newsletter.",
  40. "twitter_handle": "@greggpollack",
  41. "site": "EnvyLabs.com"
  42. });
  43. User.findOrCreate({
  44. "username": "r_higley",
  45. "name": "Rachel Higley",
  46. "bio": "A web developer located in central florida",
  47. "twitter_handle": "@RachelHigley",
  48. "site": ""
  49. });
  50. User.findOrCreate({
  51. "username": "zach",
  52. "name": "Zachary Nicoll",
  53. "bio": "Bio sections always intimidate me. I can never think of anything to say that will achieve that awe inspiring effect I want it to have.",
  54. "twitter_handle": "@turtleguyy",
  55. "site": "zacharynicoll.com"
  56. });
  57. User.findOrCreate({
  58. "username": "renz",
  59. "name": "Adam Rensel",
  60. "bio": "Web Developer at @envylabs and @codeschool",
  61. "twitter_handle": "@adamrensel",
  62. "site": "adamrensel.com"}).success(function(user){
  63. // Note Types
  64. Category.findOrCreate({"name": "Testing", "icon": "tumblr"});
  65. Category.findOrCreate({"name": "Personal Note", "icon": "pencil"});
  66. Category.findOrCreate({"name": "Bash", "icon": "terminal"});
  67. Category.findOrCreate({"name": "Idea", "icon": "lightbulb"});
  68. Category.findOrCreate({"name": "Use with Caution","icon": "warning"});
  69. Category.findOrCreate({"name": "Question", "icon": "question"}).success(function(type){
  70. // Create notes for the Question note type
  71. Note.findOrCreate({
  72. "UserId": user.id,
  73. "CategoryId": type.id,
  74. "link" : "",
  75. "description" : "Clarify the confusion between Service the term and `service` the angular method and to explain the 5 different Service recipes in Angular.",
  76. "title" : "Service Service? Really Angular?","content": "There are 5 Recipes used to create a Service. One of those *was* unfortunately named, Service. So yes, amongst its fellow peers such as Provider Service and Factory Service, there is in fact a Service Service.",
  77. "icon" : "question"
  78. });
  79. Note.findOrCreate({
  80. "UserId": user.id,
  81. "CategoryId": type.id, "link" : "",
  82. "description" : "QUESTIONABLE DESCRIPTION GOES HERE",
  83. "title" : "TEST TEST TEST",
  84. "content": "QUESTIONABLE CONTENT GOES HERE",
  85. "icon" : "question"
  86. });
  87. Note.findOrCreate({
  88. "UserId": user.id,
  89. "CategoryId": type.id,
  90. "link" : "",
  91. "description" : "Define Service",
  92. "title" : "What is a Service",
  93. "content": "Service: Angular services are objects that are wired together using dependency injection (DI). You can use services to organize and share code across your app.",
  94. "icon" : "question"
  95. });
  96. Note.findOrCreate({
  97. "UserId": user.id,
  98. "CategoryId": type.id,
  99. "description" : "Steps for Creating a Service",
  100. "title" : "How do you create a Service?",
  101. "content": "You can register a service to our Angular module `app` with a one of the following 5 recipes:\
  102. \n - **factory** \
  103. \n - **provider** \
  104. \n - **service** \
  105. \n - **value** \
  106. \n - **constant** \
  107. ",
  108. "icon" : "question"
  109. });
  110. }); // Closing Question Category
  111. });
  112. User.findOrCreate({
  113. "username": "ItsThrillhouse",
  114. "name": "Jason Millhouse",
  115. "bio": "Course builder. Aspiring writer. Comp Sci guy. Teacher. Sweetfiend. Corgi lover. Gamer who doesn't. Pro Series host. Voice of the UCF Marching Knights. Dork.",
  116. "twitter_handle": "@ItsThrillhouse",
  117. "site": ""
  118. }).success(function(user){
  119. Category.findOrCreate({
  120. "name": "Best Practice",
  121. "icon": "thumbs up outline"
  122. }).success(function(type){
  123. // Create notes for the Best Practice note type
  124. Note.findOrCreate({
  125. "UserId": user.id,
  126. "CategoryId": type.id,
  127. "link" :"https://www.youtube.com/watch?feature=player_detailpage&v=ZhfUv0spHCY#t=1870",
  128. "description": "NgModel Best Practice",
  129. "content" : "Always use dot syntax when using NgModel! Treat Scope as read-only in templates & write-only in controllers. The purpose of the scope is to refer to the model, not be the model. The model is your javascript objects. When doing bidirectional binding with ngModel make sure you don't bind directly to the scope properties. This will cause unexpected behavior in the child scopes.",
  130. "title" : "NgModel BP",
  131. "icon" : "basic info"
  132. });
  133. });
  134. });
  135. User.findOrCreate({
  136. "username": "OlivierLacan",
  137. "name": "Olivier Lacan",
  138. "bio": "Software bricoleur at @codeschool, word wrangler, scientific skeptic, and logic lumberjack.",
  139. "twitter_handle": "@olivierlacan",
  140. "site": "olivierlacan.com"
  141. });
  142. User.findOrCreate({
  143. "username": "theSmith",
  144. "name": "Andrew Smith",
  145. "bio": "iOS & Web Developer at @intelity. @fullsail graduate.",
  146. "twitter_handle": "@fullsailor",
  147. "site": "fullsailor.com"
  148. });
  149. User.findOrCreate({
  150. "username": "DrewBarontini",
  151. "password": encrypt.encryptPassword("secret").encryptedPassword,
  152. "name": "Drew Barontini",
  153. "bio": "Front-end developer @codeschool, descendant of @envylabs, real-life extrovert, internet introvert.",
  154. "twitter_handle": "@drewbarontini",
  155. "site": "drewbarontini.com"
  156. });
  157. User.findOrCreate({
  158. "username": "JordanWade",
  159. "password": encrypt.encryptPassword("secret").encryptedPassword,
  160. "name": "Jordan Wade",
  161. "bio": "Designer, Illustrator, and Front-End Developer @codeschool",
  162. "twitter_handle": "@jjordanwade",
  163. "site": "jamesjordanwade.com"
  164. });
  165. User.findOrCreate({
  166. "username": "AlyssaNicoll",
  167. "password": encrypt.encryptPassword('secret').encryptedPassword,
  168. "name": "Alyssa Nicoll",
  169. "bio": "Code School Teacher. Angular Lover. Scuba Diver.",
  170. "twitter_handle": "@AlyssaNicoll",
  171. "site": "alyssa.io"
  172. }).success(function(user){
  173. Category.findOrCreate({"name": "Code Snippet", "icon": "code"}).success(function(type){
  174. // Create notes for the Code Snippet note type
  175. Note.findOrCreate({
  176. "UserId": user.id,
  177. "CategoryId": type.id,
  178. "link" : "",
  179. "description" : "Link has *pre* & *post* functions. **Anything that manipulates the DOM goes here!**",
  180. "title" : "Link",
  181. "content" : "\
  182. \n`link: function(scope, element) {\
  183. \nscope.body = $sce.trustAsHtml(markdown.toHTML(scope.body));\
  184. \n}`\ ",
  185. "icon" : "question"
  186. });
  187. Note.findOrCreate({
  188. "UserId": user.id,
  189. "CategoryId": type.id,
  190. "link" : "https://docs.angularjs.org/api/ng#directive",
  191. "description" : "Markers on a **DOM element** that tell AngularJS's HTML compiler `$compile` to attach a specified behavior to that DOM element.",
  192. "title" : "Directives",
  193. "icon" : "code",
  194. "content": "Markers on a **DOM element**"
  195. });
  196. });
  197. });
  198. });
  199. }
  200. };