1
0

Add postgres support (#135)

Revert fixture fixes for postgres

Use postgres connection string with spaces instead of url

Fix label order

Make postgres tests in ci less verbose

Add sequence update script

Skip resets in postgres

Remove option to skip resets in postgres

Make postgres tests in ci verboseq

Update test fixtures database

Fix file tests on postgres

Add postgres options to sample config

Make sure tests init test fixtures before running the actual tests

Fix issues with IDs too big to fit in an int

Fix duplicate auto incremented IDs

Refactor / Fix team tests

Refactor team member tests

Fix team member create

Fix label test

Fix getting labels

Fix test fixtures for postgresql

Fix connection string params

Disable ssl mode on postgres integration tests

Disable ssl mode on postgres tests

Use sprintf to create the connection string for postgresql

fixup! Add postgres support

Add postgres support

Added generate as a make dependency for make build

Clarify docs on building

Co-authored-by: kolaente <k@knt.li>
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/135
This commit is contained in:
jtojnar
2020-02-16 21:42:04 +00:00
committed by konrad
parent 7e42724439
commit ce5be947b4
107 changed files with 9886 additions and 1595 deletions

View File

@ -68,7 +68,7 @@ type TeamMember struct {
// Used under the hood to manage team members
UserID int64 `xorm:"int(11) not null INDEX" json:"-"`
// Whether or not the member is an admin of the team. See the docs for more about what a team admin can do
Admin bool `xorm:"tinyint(1) INDEX null" json:"admin"`
Admin bool `xorm:"null" json:"admin"`
// A timestamp when this relation was created. You cannot change this value.
Created timeutil.TimeStamp `xorm:"created not null" json:"created"`
@ -131,7 +131,7 @@ func addMoreInfoToTeams(teams []*Team) (err error) {
}
// Get all owners and team members
users := []*TeamUser{}
users := make(map[int64]*TeamUser)
err = x.Select("*").
Table("users").
Join("LEFT", "team_members", "team_members.user_id = users.id").
@ -153,9 +153,15 @@ func addMoreInfoToTeams(teams []*Team) (err error) {
continue
}
u.Email = ""
teamMap[u.TeamID].CreatedBy = &u.User
teamMap[u.TeamID].Members = append(teamMap[u.TeamID].Members, u)
}
// We need to do this in a second loop as owners might not be the last ones in the list
for _, team := range teamMap {
if teamUser, has := users[team.CreatedByID]; has {
team.CreatedBy = &teamUser.User
}
}
return
}