Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Commit

Permalink
Merge pull request #237 from codeuniversity/clean-twitter
Browse files Browse the repository at this point in the history
Move twitter models to twitter/models
  • Loading branch information
Urhengulas authored Dec 20, 2019
2 parents 8ca575b + adbadfd commit ab6b64f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions twitter/inserter/posts/inserter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
_ "github.com/jinzhu/gorm/dialects/postgres"

dbUtils "github.com/codeuniversity/smag-mvp/db"
"github.com/codeuniversity/smag-mvp/models"
"github.com/codeuniversity/smag-mvp/twitter/models"
"github.com/codeuniversity/smag-mvp/utils"
"github.com/codeuniversity/smag-mvp/worker"

Expand Down Expand Up @@ -40,7 +40,7 @@ func New(postgresHost, postgresPassword, dbName string, qReader *kafka.Reader) *

db, err := gorm.Open("postgres", connectionString)
utils.PanicIfNotNil(err)
i.db = db
i.db = db // use db.Debug() here to get detailed gorm logs

db.AutoMigrate(&models.TwitterPost{})

Expand Down
4 changes: 2 additions & 2 deletions twitter/inserter/users/inserter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
_ "github.com/jinzhu/gorm/dialects/postgres"

dbUtils "github.com/codeuniversity/smag-mvp/db"
"github.com/codeuniversity/smag-mvp/models"
"github.com/codeuniversity/smag-mvp/twitter/models"
"github.com/codeuniversity/smag-mvp/utils"
"github.com/codeuniversity/smag-mvp/worker"

Expand Down Expand Up @@ -40,7 +40,7 @@ func New(postgresHost, postgresPassword, dbName string, qReader *kafka.Reader) *

db, err := gorm.Open("postgres", connectionString)
utils.PanicIfNotNil(err)
i.db = db
i.db = db // use db.Debug() here to get detailed gorm logs

db.AutoMigrate(&models.TwitterUser{})

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions models/twitter_post.go → twitter/models/twitter_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ type TwitterPost struct {
Place string

// content
Cashtags pq.StringArray `gorm:"type:varchar(64)[]"`
Hashtags pq.StringArray `gorm:"type:varchar(64)[]"`
Cashtags pq.StringArray `gorm:"type:text[]"`
Hashtags pq.StringArray `gorm:"type:text[]"`
Mentions []*TwitterUser `gorm:"many2many:post_mentions;association_foreignkey:username;foreignkey:postIdentifier"`
Photos pq.StringArray `gorm:"type:varchar(64)[]"`
Photos pq.StringArray `gorm:"type:text[]"`
QuoteURL string
ReplyTo []*TwitterUser `gorm:"many2many:post_replies;association_foreignkey:username;foreignkey:postIdentifier"`
Retweet bool
RetweetDate string
RetweetID string
Source string
Tweet string
URLs pq.StringArray `gorm:"type:varchar(64)[]"`
URLs pq.StringArray `gorm:"type:text[]"`
Video int

// reactions
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion twitter/scraper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ RUN pip install -r requirements.txt
COPY ./twitterscraper ./twitterscraper

ENTRYPOINT [ "python" ]
CMD [ "-c", "raise Exception('Please set the CMD to either tweets_scraper.py or user_scraper.py')" ]
CMD [ "-c", "raise Exception('Please set the CMD to either `-m twitterscraper.posts_scraper.py`, `-m twitterscraper.users_scraper.py`, `-m twitterscraper.follwers_scraper.py` or `-m twitterscraper.follwing_scraper.py`')" ]

0 comments on commit ab6b64f

Please sign in to comment.