-
Notifications
You must be signed in to change notification settings - Fork 19
GraphQL #270
base: master
Are you sure you want to change the base?
GraphQL #270
Conversation
not used
|
||
-- +migrate Up | ||
UPDATE needs SET updated_at = created_at WHERE updated_at IS NULL; | ||
ALTER TABLE needs ALTER COLUMN updated_at SET NOT NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Com essa ideia não teria que setar o default da coluna updated_at
como now
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
na hora de criar, sim, olhando agora acho que tem algum problema ou as linhas
vitrine-social/server/db/repo/need.go
Lines 83 to 98 in dea782f
err = r.db.QueryRow( | |
`INSERT INTO needs (category_id, organization_id, title, description, required_qtd, reached_qtd, due_date, status, unit, updated_at) | |
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) | |
RETURNING id | |
`, | |
n.CategoryID, | |
n.OrganizationID, | |
n.Title, | |
n.Description, | |
n.RequiredQuantity, | |
n.ReachedQuantity, | |
n.DueDate, | |
n.Status, | |
n.Unit, | |
n.UpdatedAt, | |
).Scan(&n.ID) |
created_at
esta errado, vou dar uma olhada
|
||
v1.HandleFunc("/auth/login", AuthHandler.Login) | ||
|
||
v1.Path("/auth/update-password").Handler(authMiddleware.With( | ||
v1.Path("/auth/update-password").Handler(privateMiddleware.With( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precisam existir esses endpoint agora que tudo vai ser graphql?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
para o frontend não precisar migrar de uma vez sim, depois que eles migrarem podemos tirar eles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhh boaa 👍
if c, ok := categoryCache.Load(id); ok { | ||
return c.(model.Category), nil | ||
c := c.(*model.Category) | ||
return c, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? não entendi porque a mudança
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
não tinha um endpoint para procurar a categoria antes, isso fazia com que fosse meio impossível de não achar uma quando vc procurasse, jah que ela estaria vinculada a uma need, ou vindo pelo GetAll
... como agora pode usar o query category(id)
para buscar a categoria, achei melhor deixar ela semelhante ao resto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beleza 👍
Here is an overview of what got changed by this pull request: Issues
======
- Added 4
Complexity increasing per file
==============================
- server/db/repo/organization.go 8
- server/graphql/organizationUpdateMutation.go 19
- server/graphql/viewerQuery.go 2
- server/graphql/needImageDeleteMutation.go 2
- server/graphql/needCreateMutation.go 4
- server/graphql/categoryQuery.go 4
- server/graphql/graphql_test.go 7
- server/graphql/loginMutation.go 4
- server/graphql/resetPasswordMutation.go 4
- server/graphql/organizationQuery.go 2
- server/graphql/allCategoriesQuery.go 2
- server/graphql/scalar.go 6
- server/graphql/needImageCreateMutation.go 3
- server/graphql/viewerMutation.go 1
- server/graphql/organizationImageDeleteMutation.go 2
- server/graphql/searchQuery.go 6
- server/graphql/graphiql-middleware.go 4
- server/graphql/graphql.go 3
- server/graphql/needQuery.go 10
- server/graphql/updatePasswordMutation.go 4
- server/graphql/needUpdateMutation.go 20
- server/graphql/organizationImageCreateMutation.go 3
See the complete overview on Codacy |
@@ -139,7 +128,18 @@ type SearchNeed struct { | |||
CategorySlug string `db:"category_slug"` | |||
} | |||
|
|||
func (s *needStatus) Scan(src interface{}) error { | |||
type NeedStatus string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -163,6 +163,6 @@ func (s *needStatus) Scan(src interface{}) error { | |||
return nil | |||
} | |||
|
|||
func (s needStatus) Value() (driver.Value, error) { | |||
func (s NeedStatus) Value() (driver.Value, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NeedStatusEmpty = NeedStatus("") | ||
) | ||
|
||
func (s *NeedStatus) Scan(src interface{}) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALTER TABLE needs ALTER COLUMN updated_at SET NOT NULL; | ||
|
||
-- +migrate Down | ||
ALTER TABLE needs ALTER COLUMN updated_at SET NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: syntax error at or near "NULL"
connected to #297
Essa é uma implementação dos handlers que existem usando a lib
github.com/graphql-go/graphql
, não foram implementados os endpoints de contato/e-mail e afins por enquanto, para tentar evitar demorar mais com o PR que o humanamente aceitável.Se puderem dar uma olhada (talvez testar o uso) eu agradeceria.
O GraphiQL foi alterado para suportar o envio do token de autorização:
Full Schema: