mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
added thread list to get accounts endpoint
This commit is contained in:
parent
9fd80d4575
commit
a4b45119cd
5 changed files with 23 additions and 0 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
func (d *Data) GetAccountsByUser(user *models.User) ([]models.Account, error) {
|
||||
var accounts []models.Account
|
||||
err := d.db.
|
||||
Preload("Threads").
|
||||
Where("user_id = ?", user.ID).
|
||||
Find(&accounts).
|
||||
Error
|
||||
|
|
|
@ -7,6 +7,8 @@ type Account struct {
|
|||
UserID uuid.UUID `json:"-"`
|
||||
User *User `json:"-"`
|
||||
|
||||
Threads []Thread `json:"threads"`
|
||||
|
||||
ScreenName string `json:"screen_name"`
|
||||
Name string `json:"name"`
|
||||
TwitterID *int64 `json:"twitter_id"`
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import Thread from "./Thread";
|
||||
|
||||
type Account = {
|
||||
id: string
|
||||
|
@ -5,6 +6,7 @@ type Account = {
|
|||
screen_name: string
|
||||
twitter_id: string
|
||||
avatar_url: string
|
||||
threads: Thread[]
|
||||
}
|
||||
|
||||
export default Account
|
17
frontend/src/api/entities/Thread.ts
Normal file
17
frontend/src/api/entities/Thread.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
export enum ThreadStatus {
|
||||
SCHEDULED = "SCHEDULED",
|
||||
PROCESSING = "PROCESSING",
|
||||
FAILED = "FAILED",
|
||||
DONE = "DONE",
|
||||
}
|
||||
|
||||
type Thread = {
|
||||
id: string,
|
||||
//tweets: Tweet[],
|
||||
scheduled_for: Date,
|
||||
status: ThreadStatus,
|
||||
error: string|null
|
||||
}
|
||||
|
||||
export default Thread
|
|
@ -29,6 +29,7 @@ const Dashboard: FunctionComponent<DashboardProps> = () => {
|
|||
useEffect(() => {
|
||||
accountEndpoint.getAll()
|
||||
.then(accounts => {
|
||||
console.dir(accounts)
|
||||
setAccounts(accounts)
|
||||
setLoading(false)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue