feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -14,7 +14,7 @@ import (
|
||||
// A bounded batch supplies context for children whose parent does not match the
|
||||
// day/filter. It never grants access to another owner or Domain.
|
||||
func (s *Store) TaskContextParents(ctx context.Context, domain, actor string, items []TaskRecord) ([]TaskRecord, error) {
|
||||
if err := taskActor(ctx, s.DB, domain, actor, false); err != nil {
|
||||
if err := s.taskActor(ctx, s.DB, domain, actor, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(items) > 100 {
|
||||
@@ -33,10 +33,10 @@ func (s *Store) TaskContextParents(ctx context.Context, domain, actor string, it
|
||||
args := []any{domain, actor}
|
||||
marks := []string{}
|
||||
for id := range ids {
|
||||
marks = append(marks, "?")
|
||||
marks = append(marks, s.sqlParam(len(args)+1))
|
||||
args = append(args, id)
|
||||
}
|
||||
rows, err := s.DB.QueryContext(ctx, `SELECT data FROM organizer_items WHERE domain_uuid=? AND owner_uuid=? AND kind='task' AND uuid IN (`+strings.Join(marks, ",")+`)`, args...)
|
||||
rows, err := s.DB.QueryContext(ctx, `SELECT data FROM organizer_items WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+` AND kind='task' AND uuid IN (`+strings.Join(marks, ",")+`)`, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func (s *Store) validateTaskParentTx(ctx context.Context, tx *sql.Tx, domain, ac
|
||||
} // Parent archiving must not disable its children.
|
||||
var parent, kind string
|
||||
var archived bool
|
||||
err := tx.QueryRowContext(ctx, `SELECT parent_uuid,kind,archived FROM organizer_items WHERE domain_uuid=? AND owner_uuid=? AND uuid=?`, domain, actor, item.ParentUUID).Scan(&parent, &kind, &archived)
|
||||
err := tx.QueryRowContext(ctx, `SELECT parent_uuid,kind,archived FROM organizer_items WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+` AND uuid=`+s.sqlParam(3)+``, domain, actor, item.ParentUUID).Scan(&parent, &kind, &archived)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
@@ -117,7 +117,7 @@ func (s *Store) validateTaskParentTx(ctx context.Context, tx *sql.Tx, domain, ac
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
var children bool
|
||||
if err = tx.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_items WHERE domain_uuid=? AND owner_uuid=? AND parent_uuid=?)`, domain, actor, item.UUID).Scan(&children); err != nil {
|
||||
if err = tx.QueryRowContext(ctx, `SELECT EXISTS(SELECT 1 FROM organizer_items WHERE domain_uuid=`+s.sqlParam(1)+` AND owner_uuid=`+s.sqlParam(2)+` AND parent_uuid=`+s.sqlParam(3)+`)`, domain, actor, item.UUID).Scan(&children); err != nil {
|
||||
return err
|
||||
}
|
||||
if children {
|
||||
@@ -127,17 +127,17 @@ func (s *Store) validateTaskParentTx(ctx context.Context, tx *sql.Tx, domain, ac
|
||||
}
|
||||
|
||||
func (s *Store) TaskSchedule(ctx context.Context, domain, actor, month, project string) ([]TaskRecord, bool, error) {
|
||||
if err := taskActor(ctx, s.DB, domain, actor, false); err != nil {
|
||||
if err := s.taskActor(ctx, s.DB, domain, actor, false); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
first, err := time.Parse("2006-01", month)
|
||||
if err != nil || first.Year() < 1 || first.Format("2006-01") != month {
|
||||
return nil, false, ErrTaskInvalid
|
||||
}
|
||||
q := `SELECT data FROM organizer_items WHERE domain_uuid=? AND owner_uuid=? AND kind='task' AND archived=0 AND COALESCE(NULLIF(start_on,''),end_on)>=? AND COALESCE(NULLIF(start_on,''),end_on)<? AND COALESCE(NULLIF(end_on,''),start_on)>=?`
|
||||
q := `SELECT data FROM organizer_items WHERE domain_uuid=` + s.sqlParam(1) + ` AND owner_uuid=` + s.sqlParam(2) + ` AND kind='task' AND archived=0 AND COALESCE(NULLIF(start_on,''),end_on)>=` + s.sqlParam(3) + ` AND COALESCE(NULLIF(start_on,''),end_on)<` + s.sqlParam(4) + ` AND COALESCE(NULLIF(end_on,''),start_on)>=` + s.sqlParam(5) + ``
|
||||
args := []any{domain, actor, first.AddDate(0, 0, -365).Format("2006-01-02"), first.AddDate(0, 1, 0).Format("2006-01-02"), first.Format("2006-01-02")}
|
||||
if project != "" {
|
||||
q += ` AND project_uuid=?`
|
||||
q += ` AND project_uuid=` + s.sqlParam(len(args)+1) + ``
|
||||
args = append(args, project)
|
||||
}
|
||||
q += ` ORDER BY COALESCE(NULLIF(start_on,''),end_on),uuid LIMIT 201`
|
||||
|
||||
Reference in new issue
Block a user