chore: merge (#5773)

* feat: allow skip of success page for native apps (#5627)

add possibility to return to callback directly after login without rendering the successful login page

* build next

* fix(console): disallow inline fonts, critical styles (#5714)

fix: disallow inline

* fix(setup): step 10 for postgres (#5717)

* fix(setup): smaller transactions (#5743)

* fix: order by sequence by default

* test: add allowCreationDateFilter

* fix(step10): separate executions (#5754)

* feat: allow skip of success page for native apps (#5627)

add possibility to return to callback directly after login without rendering the successful login page

* build next

* fix(console): disallow inline fonts, critical styles (#5714)

fix: disallow inline

* fix(setup): step 10 for postgres (#5717)

* fix(setup): smaller transactions (#5743)

* fix(step10): split statements

* fix(step10): split into separate execs

* chore: prerelease

* add truncate before insert

* fix: add truncate

* Merge branch 'main' into optimise-step-10

* chore: reset release definition

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
Co-authored-by: Max Peintner <max@caos.ch>

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
Silvan
2023-04-28 16:56:51 +02:00
committed by GitHub
parent 458a383de2
commit 39bdef35e7
17 changed files with 66 additions and 40 deletions

View File

@@ -99,10 +99,11 @@ const (
type CRDB struct {
*database.DB
AllowOrderByCreationDate bool
}
func NewCRDB(client *database.DB) *CRDB {
return &CRDB{client}
func NewCRDB(client *database.DB, allowOrderByCreationDate bool) *CRDB {
return &CRDB{client, allowOrderByCreationDate}
}
func (db *CRDB) Health(ctx context.Context) error { return db.Ping() }
@@ -254,11 +255,19 @@ func (db *CRDB) db() *sql.DB {
}
func (db *CRDB) orderByEventSequence(desc bool) string {
if desc {
return " ORDER BY creation_date DESC, event_sequence DESC"
if db.AllowOrderByCreationDate {
if desc {
return " ORDER BY creation_date DESC, event_sequence DESC"
}
return " ORDER BY creation_date, event_sequence"
}
return " ORDER BY creation_date, event_sequence"
if desc {
return " ORDER BY event_sequence DESC"
}
return " ORDER BY event_sequence"
}
func (db *CRDB) eventQuery() string {

View File

@@ -542,6 +542,7 @@ func Test_query_events_with_crdb(t *testing.T) {
DB: tt.fields.client,
Database: new(testDB),
},
AllowOrderByCreationDate: true,
}
// setup initial data for query
@@ -820,9 +821,12 @@ func Test_query_events_mocked(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
crdb := &CRDB{DB: &database.DB{
Database: new(testDB),
}}
crdb := &CRDB{
DB: &database.DB{
Database: new(testDB),
},
AllowOrderByCreationDate: true,
}
if tt.fields.mock != nil {
crdb.DB.DB = tt.fields.mock.client
}