-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcommands
55 lines (37 loc) · 2.15 KB
/
commands
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
bundle exec hanami generate model user
bundle exec hanami generate model article
bundle exec hanami generate model comment
bundle exec hanami generate model tag
bundle exec hanami generate model article_tag
bundle exec hanami generate model user_follower
bundle exec hanami generate model article_favorite
----------------
UserRepository.new.create(email: 'bobr8949@yandex.ru', password: '123456', username: 'bobr8949', bio: 'bio', image:'image')
UserRepository.new.create(email: 'test@yandex.ru', password: '123456', username: 'test', bio: 'test bio', image:'https://image.com/image.png')
UserRepository.new.create(email: 'test2@yandex.ru', password: '123456', username: 'test2', bio: 'test bio2', image:'https://image.com/image2.png')
ArticleRepository.new.create(slug: "test", title: "Test", description: "description", body: "body", author_id: 1)
ArticleRepository.new.create(slug: "test-2", title: "Test 2", description: "description2", body: "body2", author_id: 2)
ArticleRepository.new.create(slug: "test-3", title: "Test 3", description: "description3", body: "body3", author_id: 2)
TagRepository.new.create(name: "test")
TagRepository.new.create(name: "test 2")
ArticleTagRepository.new.create(article_id: 1, tag_id: 2)
ArticleTagRepository.new.create(article_id: 1, tag_id: 1)
ArticleTagRepository.new.create(article_id: 2, tag_id: 1)
CommentRepository.new.create(body: "first", article_id: 1, author_id: 1)
CommentRepository.new.create(body: "test 2", article_id: 1, author_id: 2)
ArticleFavoriteRepository.new.create(article_id: 1, favorit_id: 1)
ArticleFavoriteRepository.new.create(article_id: 2, favorit_id: 1)
ArticleFavoriteRepository.new.create(article_id: 3, favorit_id: 1)
ActiveRelationshipRepository.new.create(follower_id:1, followed_id: 2)
ActiveRelationshipRepository.new.create(follower_id:2, followed_id: 1)
ActiveRelationshipRepository.new.create(follower_id:3, followed_id: 1)
ActiveRelationshipRepository.new.create(follower_id:3, followed_id: 2)
------------
u = UserRepository.new.find(username: 'bobr8949')
u.articles
u.comments
u = UserRepository.new.find_with_comments(1)
u.comments
u = UserRepository.new.find_with_articles(1)
u.articles
c = C