mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-12 06:28:50 +00:00
some work on auth/sessions
This commit is contained in:
@@ -5,9 +5,9 @@ import (
|
||||
"crypto"
|
||||
"crypto/hmac"
|
||||
"encoding/hex"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"github.com/simon987/task_tracker/config"
|
||||
"net/http"
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/config"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"io/ioutil"
|
||||
"src/task_tracker/api"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"github.com/simon987/task_tracker/storage"
|
||||
"io/ioutil"
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/storage"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -3,9 +3,9 @@ package test
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"src/task_tracker/api"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/config"
|
||||
"src/task_tracker/storage"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"github.com/simon987/task_tracker/config"
|
||||
"github.com/simon987/task_tracker/storage"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
@@ -50,23 +50,3 @@ func BenchmarkCreateTask(b *testing.B) {
|
||||
_ = db.SaveTask(&storage.Task{}, project, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTest(t *testing.T) {
|
||||
|
||||
config.SetupConfig()
|
||||
db := storage.Database{}
|
||||
|
||||
project, _ := db.SaveProject(&storage.Project{
|
||||
Priority: 1,
|
||||
Id: 1,
|
||||
Version: "bmcreatetask",
|
||||
Public: true,
|
||||
Motd: "bmcreatetask",
|
||||
Name: "BenchmarkCreateTask",
|
||||
GitRepo: "benchmark_test",
|
||||
})
|
||||
|
||||
for i := 0; i < 1000000; i++ {
|
||||
_ = db.SaveTask(&storage.Task{}, project, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package test
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"github.com/simon987/task_tracker/storage"
|
||||
"io/ioutil"
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/storage"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package test
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"github.com/simon987/task_tracker/storage"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/storage"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/simon987/task_tracker/config"
|
||||
"github.com/simon987/task_tracker/storage"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"src/task_tracker/config"
|
||||
"src/task_tracker/storage"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ server:
|
||||
|
||||
database:
|
||||
conn_str: "user=task_tracker dbname=task_tracker_test sslmode=disable"
|
||||
# log_levels: ["debug", "error"]
|
||||
log_levels: ["debug", "error", "trace", "info", "warning"]
|
||||
log_levels: ["debug", "error"]
|
||||
# log_levels: ["debug", "error", "trace", "info", "warning"]
|
||||
|
||||
git:
|
||||
webhook_secret: "very_secret_secret"
|
||||
@@ -12,4 +12,8 @@ git:
|
||||
webhook_sig_header: "X-Hub-Signature"
|
||||
|
||||
log:
|
||||
level: "trace"
|
||||
level: "trace"
|
||||
|
||||
session:
|
||||
cookie_name: "tt"
|
||||
expiration: "25m"
|
||||
@@ -1,8 +1,8 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/config"
|
||||
"github.com/simon987/task_tracker/api"
|
||||
"github.com/simon987/task_tracker/config"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
DROP TABLE IF EXISTS worker_identity, worker, project, task, log_entry,
|
||||
worker_has_access_to_project;
|
||||
worker_has_access_to_project, manager, manager_has_role_on_project;
|
||||
DROP TYPE IF EXISTS status;
|
||||
DROP TYPE IF EXISTS log_level;
|
||||
|
||||
@@ -63,3 +63,17 @@ CREATE TABLE log_entry
|
||||
timestamp INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE manager
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
username TEXT,
|
||||
password TEXT,
|
||||
website_admin BOOLEAN
|
||||
);
|
||||
|
||||
CREATE TABLE manager_has_role_on_project
|
||||
(
|
||||
manager INTEGER REFERENCES manager (id),
|
||||
role SMALLINT,
|
||||
project INTEGER REFERENCES project (id)
|
||||
);
|
||||
Reference in New Issue
Block a user