/api.git
+git fetch --all --prune
+{{< /highlight >}}
+
+This should provide a working development environment for Vikunja. Take a look at the Makefile to get an overview about
+the available tasks. The most common tasks should be `make test` which will start our test environment and `make build`
+which will build a vikunja binary into the working directory. Writing test cases is not mandatory to contribute, but it
+is highly encouraged and helps developers sleep at night.
+
+That’s it! You are ready to hack on Vikunja. Test changes, push them to the repository, and open a pull request.
diff --git a/docs/content/doc/development/make.md b/docs/content/doc/development/make.md
new file mode 100644
index 000000000..d0a750b87
--- /dev/null
+++ b/docs/content/doc/development/make.md
@@ -0,0 +1,132 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Makefile"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "development"
+---
+
+# Makefile
+
+We scripted a lot of tasks used mostly for developing into the makefile. This documents explains what
+taks are available and what they do.
+
+## CI
+
+These tasks are automatically run in our CI every time someone pushes to master or you update a pull request:
+
+* `make lint`
+* `make fmt-check`
+* `make ineffassign-check`
+* `make misspell-check`
+* `make goconst-check`
+* `make build`
+
+### clean
+
+{{< highlight bash >}}
+make clean
+{{< /highlight >}}
+
+Clears all builds and binaries.
+
+### test
+
+{{< highlight bash >}}
+make test
+{{< /highlight >}}
+
+Runs all tests in Vikunja.
+
+### Format the code
+
+{{< highlight bash >}}
+make fmt
+{{< /highlight >}}
+
+Formats all source code using `go fmt`.
+
+#### Check formatting
+
+{{< highlight bash >}}
+make fmt-check
+{{< /highlight >}}
+
+Checks if the code needs to be formatted. Fails if it does.
+
+### Build Vikunja
+
+{{< highlight bash >}}
+make build
+{{< /highlight >}}
+
+Builds a `vikunja`-binary in the root directory of the repo for the platform it is run on.
+
+### Build Releases
+
+{{< highlight bash >}}
+make build
+{{< /highlight >}}
+
+Builds binaries for all platforms and zips them with a copy of the `templates/` folder.
+All built zip files are stored into `dist/zips/`. Binaries are stored in `dist/binaries/`,
+binaries bundled with `templates` are stored in `dist/releases/`.
+
+All cross-platform binaries built using this series of commands are built with the help of
+[xgo](https://github.com/karalabe/xgo). The make command will automatically install the
+binary to be able to use it.
+
+`make release` is actually just a shortcut to execute `make release-dirs release-windows release-linux release-darwin release-copy release-check release-os-package release-zip`.
+
+* `release-dirs` creates all directories needed
+* `release-windows`/`release-linux`/`release-darwin` execute xgo to build for their respective platforms
+* `release-copy` bundles binaries with a copy of `templates/` to then be zipped
+* `release-check` creates sha256 checksums for each binary which will be included in the zip file
+* `release-os-package` bundles a binary with a copy of the `templates/` folder, the `sha256` checksum file, a sample `config.yml` and a copy of the license in a folder for each architecture
+* `release-zip` makes a zip file for the files created by `release-os-package`
+
+### Build debian packages
+
+{{< highlight bash >}}
+make build-deb
+{{< /highlight >}}
+
+Will build a `.deb` package into the current folder. You need to have [fpm](https://fpm.readthedocs.io/en/latest/intro.html) installed to be able to do this.
+
+#### Make a debian repo
+
+{{< highlight bash >}}
+make reprepro
+{{< /highlight >}}
+
+Takes an already built debian package and creates a debian repo structure around it.
+
+Used to be run inside a [docker container](https://git.kolaente.de/konrad/reprepro-docker) in the CI process when releasing.
+
+### Generate swagger definitions from code comments
+
+{{< highlight bash >}}
+make do-the-swag
+{{< /highlight >}}
+
+Generates swagger definitions from the comments in the code.
+
+#### Check if swagger generation is needed
+
+{{< highlight bash >}}
+make got-swag
+{{< /highlight >}}
+
+This command is currently more an experiment, use it with caution.
+It may bring up wrong results.
+
+### Code-Checks
+
+* `misspell-check`: Checks for commonly misspelled words
+* `ineffassign-check`: Checks for ineffectual assignments in the code using [ineffassign](https://github.com/gordonklaus/ineffassign).
+* `gocyclo-check`: Calculates cyclomatic complexities of functions using [gocyclo](https://github.com/fzipp/gocyclo).
+* `static-check`: Analyzes the code for bugs, improvements and more using [staticcheck](https://staticcheck.io/docs/).
+* `gosec-check`: Inspects source code for security problems by scanning the Go AST using the [gosec tool](https://github.com/securego/gosec).
+* `goconst-check`: Finds repeated strings that could be replaced by a constant using [goconst](https://github.com/jgautheron/goconst/).
\ No newline at end of file
diff --git a/docs/content/doc/development/structure.md b/docs/content/doc/development/structure.md
new file mode 100644
index 000000000..6bc4e1346
--- /dev/null
+++ b/docs/content/doc/development/structure.md
@@ -0,0 +1,136 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Project structure"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "development"
+---
+
+# Project structure
+
+In general, this api repo has the following structure:
+
+* `docker`
+* `docs`
+* `pkg`
+ * `caldav`
+ * `config`
+ * `log`
+ * `mail`
+ * `metrics`
+ * `models`
+ * `red`
+ * `routes`
+ * `api/v1`
+ * `swagger`
+ * `utils`
+* `REST-Tests`
+* `templates`
+* `vendor`
+
+This document will explain what these mean and what you can find where.
+
+## Root level
+
+The root directory is where [the config file]({{< ref "../setup/config.md">}}), [Makefile]({{< ref "make.md">}}), license, drone config,
+application entry point (`main.go`) and so on are located.
+
+## docker
+
+This directory holds additonal files needed to build and run the docker container, mainly service configuration to properly run Vikunja inside a docker
+container.
+
+## pkg
+
+This is where most of the magic happens. Most packages with actual code are located in this folder.
+
+### caldav
+
+This folder holds a simple caldav implementation which is responsible for returning the caldav feature.
+
+### config
+
+This package configures the config. It sets default values and sets up viper and tells it where to look for config files,
+how to interpret which env variables for config etc.
+
+If you want to add a new config parameter, you should add default value in this package.
+
+### log
+
+Similar to `config`, this will set up the logging, based on differen logging backends.
+This init is called in `main.go` after the config init is done.
+
+### mail
+
+This package handles all mail sending. To learn how to send a mail, see [sending emails]({{< ref "../practical-instructions/mail.md">}}).
+
+### metrics
+
+This package handles all metrics which are exposed to the prometheus endpoint.
+To learn how it works and how to add new metrics, take a look at [how metrics work]({{< ref "../practical-instructions/metrics.md">}}).
+
+### models
+
+This is where most of the magic happens.
+When adding new features or upgrading existing ones, that most likely happens here.
+
+Because this package is pretty huge, there are several documents and how-to's about it:
+
+* [Adding a feature]({{< ref "../practical-instructions/feature.md">}})
+* [Making calls to the database]({{< ref "../practical-instructions/database.md">}})
+
+### red (redis)
+
+This package initializes a connection to a redis server.
+This inizialization is automatically done at the startup of vikunja.
+
+It also has a function (`GetRedis()`) which returns a redis client object you can then use in your package
+to talk to redis.
+
+It uses the [go-redis](https://github.com/go-redis/redis) library, please see their configuration on how to use it.
+
+### routes
+
+This package defines all routes which are available for vikunja clients to use.
+To add a new route, see [adding a new route]({{< ref "../practical-instructions/feature.md">}}).
+
+#### api/v1
+
+This is where all http-handler functions for the api are stored.
+Every handler function which does not use the standard web handler should live here.
+
+### swagger
+
+This is where the [generated]({{< ref "make.md#generate-swagger-definitions-from-code-comments">}} [api docs]({{< ref "../usage/api.md">}}) live.
+You usually don't need to touch this package.
+
+### utils
+
+A small package, containing some helper functions:
+
+* `MakeRandomString`: Generates a random string of a given length.
+* `Sha256`: Calculates a sha256 hash from a given string.
+
+See their function definitions for instructions on how to use them.
+
+## REST-Tests
+
+Holds all kinds of test files to directly test the api from inside of [jetbrains ide's](https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html).
+
+These files are currently more an experiment, maybe we will drop them in the future to use something we could integrate in the testing process with drone.
+Therefore, this has no claim to be complete yet even working, you're free to change whatever is needed to get it working for you.
+
+## templates
+
+Holds the email templates used to send plain text and html emails for new user registration and password changes.
+
+## vendor
+
+All libraries needed to build Vikunja.
+
+We keep all libraries used for Vikunja around in the `vendor/` folder to still be able to build the project even if
+some maintainers take their libraries down like [it happened in the past](https://github.com/jteeuwen/go-bindata/issues/5).
+
+When adding a new dependency, make sure to run `go mod vendor` to put it inside this directory.
diff --git a/docs/test.md b/docs/content/doc/development/test.md
similarity index 60%
rename from docs/test.md
rename to docs/content/doc/development/test.md
index 6f3da1652..bf6c8e815 100644
--- a/docs/test.md
+++ b/docs/content/doc/development/test.md
@@ -1,10 +1,20 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Testing"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "development"
+---
+
# Testing
-You can run unit tests with our `Makefile` with
+You can run unit tests with [our `Makefile`]({{< ref "make.md">}}) with
-```bash
+{{< highlight bash >}}
make test
-```
+{{< /highlight >}}
### Running tests with config
diff --git a/docs/content/doc/practical-instructions/database.md b/docs/content/doc/practical-instructions/database.md
new file mode 100644
index 000000000..0ae608ebb
--- /dev/null
+++ b/docs/content/doc/practical-instructions/database.md
@@ -0,0 +1,38 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Database"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Database
+
+Vikunja uses [xorm](http://xorm.io/) as an abstraction layer to handle the database connection.
+Please refer to [their](http://xorm.io/docs/) documentation on how to exactly use it.
+
+Inside the `models` package, a variable `x` is available which contains a pointer to an instance of `xorm.Engine`.
+This is used whenever you make a call to the database to get or update data.
+
+This xorm instance is set up and initialized every time vikunja is started.
+
+### Adding new database tables
+
+To add a new table to the database, add a an instance of your struct to the `tables` variable in the
+init function in `pkg/models/models.go`. Xorm will sync them automatically.
+
+You also need to add a pointer to the `tablesWithPointer` slice to enable caching for all instances of this struct.
+
+To learn more about how to configure your struct to create "good" tables, refer to [the xorm documentaion](http://xorm.io/docs/).
+
+### Adding data to test fixtures
+
+Adding data for test fixtures is done in via `yaml` files insinde of `pkg/models/fixtures`.
+
+The name of the yaml file should equal the table name in the database.
+Adding values to it is done via array definition inside of the yaml file.
+
+**Note**: Table and column names need to be in snake_case as that's what is used internally in the database
+and for mapping values from the database to xorm so your structs can use it.
\ No newline at end of file
diff --git a/docs/content/doc/practical-instructions/errors.md b/docs/content/doc/practical-instructions/errors.md
new file mode 100644
index 000000000..dac3bb3e4
--- /dev/null
+++ b/docs/content/doc/practical-instructions/errors.md
@@ -0,0 +1,72 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Custom Errors"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Custom Errors
+
+All custom errors are defined in `pkg/models/errors.go`.
+You should add new ones in this file.
+
+Custom errors usually have fields for the http return code, a [vikunja-specific error code]({{< ref "../usage/errors.md">}})
+and a human-readable error message about what went wrong.
+
+An error consists of multiple functions and definitions:
+
+{{< highlight golang >}}
+// This struct holds any information about this specific error.
+// In this case, it contains the user ID of a nonexistand user.
+// This type should always be a struct, even if it has no values in it.
+
+// ErrUserDoesNotExist represents a "UserDoesNotExist" kind of error.
+type ErrUserDoesNotExist struct {
+ UserID int64
+}
+
+// This function is mostly used in unit tests to check if a returned error is of that type.
+// Every error type should have one of these.
+// The name should always start with IsErr... followed by the name of the error.
+
+// IsErrUserDoesNotExist checks if an error is a ErrUserDoesNotExist.
+func IsErrUserDoesNotExist(err error) bool {
+ _, ok := err.(ErrUserDoesNotExist)
+ return ok
+}
+
+// This is the definition of the actual error type.
+// Your error type is _required_ to implement this in order to be able to be returned as an "error" from functions.
+func (err ErrUserDoesNotExist) Error() string {
+ return fmt.Sprintf("User does not exist [user id: %d]", err.UserID)
+}
+
+// This const holds the vikunja error code used to be able to identify this error without having to
+// rely on an error string.
+// This needs to be unique, so you should check whether the error code exists or not.
+// The general convention for error codes is as follows:
+// * Every "group" errors lives in a thousend something. For example all user issues are 1000-something, all
+// list errors are 3000-something and so on.
+// * New error codes should be the current max error code + 1. Don't take free numbers to prevent old errors
+// which are depricated and removed from being "new ones". For example, if there are error codes 1001, 1002, 1004,
+// a new error should be 1005 and not 1003.
+
+// ErrCodeUserDoesNotExist holds the unique world-error code of this error
+const ErrCodeUserDoesNotExist = 1005
+
+// This is the implementation which returns an http error which is then passed to the client.
+// Here you define the http status code with which one the error will be returned, the vikunja error code and
+// a human-readable error message.
+
+// HTTPError holds the http error description
+func (err ErrUserDoesNotExist) HTTPError() web.HTTPError {
+ return web.HTTPError{
+ HTTPCode: http.StatusNotFound,
+ Code: ErrCodeUserDoesNotExist,
+ Message: "The user does not exist.",
+ }
+}
+{{< /highlight >}}
\ No newline at end of file
diff --git a/docs/content/doc/practical-instructions/feature.md b/docs/content/doc/practical-instructions/feature.md
new file mode 100644
index 000000000..059ab6a34
--- /dev/null
+++ b/docs/content/doc/practical-instructions/feature.md
@@ -0,0 +1,33 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Add a new api endpoint"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Add a new api endpoint/feature
+
+Most of the api endpoints/features of Vikunja are using the [common web handler](https://code.vikunja.io/web).
+This is a library created by Vikunja in an effort to facilitate the creation of REST endpoints.
+
+This works by abstracting the handling of CRUD-Requests, including rights check.
+
+You can learn more about the web handler on [the project's repo](https://code.vikunja.io/web).
+
+### Helper for pagination
+
+Pagination limits can be calculated with a helper function, `getLimitFromPageIndex(pageIndex)`
+(only available in the `models` package) from any page number.
+It returns the `limit` (max-length) and `offset` parameters needed for SQL-Queries.
+
+You can feed this function directly into xorm's `Limit`-Function like so:
+
+{{< highlight golang >}}
+lists := []List{}
+err := x.Limit(getLimitFromPageIndex(pageIndex)).Find(&lists)
+{{< /highlight >}}
+
+// TODO: Add a full example from start to finish, like a tutorial on how to create a new endpoint?
diff --git a/docs/content/doc/practical-instructions/mail.md b/docs/content/doc/practical-instructions/mail.md
new file mode 100644
index 000000000..1d6671cae
--- /dev/null
+++ b/docs/content/doc/practical-instructions/mail.md
@@ -0,0 +1,84 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Mailer"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Mailer
+
+This document explains how to use the mailer to send emails and what to do to create a new kind of email to be sent.
+
+## Sending emails
+
+**Note:** You should use mail templates whenever possible (see below).
+
+To send an email, use the function `mail.SendMail(options)`. The options are defined as follows:
+
+{{< highlight golang >}}
+type Opts struct {
+ To string // The email address of the recipent
+ Subject string // The subject of the mail
+ Message string // The plaintext message in the mail
+ HTMLMessage string // The html message
+ ContentType ContentType // The content type of the mail. Can be either mail.ContentTypePlain, mail.ContentTypeHTML, mail.ContentTypeMultipart. You should set this according to the kind of mail you want to send.
+ Boundary string
+ Headers []*header // Other headers to set in the mail.
+}
+{{< /highlight >}}
+
+## Sending emails based on a template
+
+For each mail with a template, there are two email templates: One for plaintext emails, one for html emails.
+
+These are located in the `templates/mail` folder and follow the conventions of `template-name.{plain|hmtl}.tmpl`,
+both the plaintext and html templates are in the same folder.
+
+To send a mail based on a template, use the function `mail.SendMailWithTemplate(to, subject, tpl string, data map[string]interface{})`.
+`to` and `subject` are pretty much self-explanatory, `tpl` is the name of the template, without `.html.tmpl` or `.plain.tmpl`.
+`data` is a map you can pass additional data to your template.
+
+#### Sending a mail with a template
+
+A basic html email template would look like this:
+
+{{< highlight go-html-template >}}
+{{template "mail-header.tmpl" .}}
+
+ Hey there!
+ This is a minimal html email example.
+ {{.Something}}
+
+{{template "mail-footer.tmpl"}}
+{{< /highlight >}}
+
+And the corresponding plaintext template:
+
+{{< highlight go-text-template >}}
+Hey there!
+
+This is a minimal html email example.
+
+{{.Something}}
+{{< /highlight >}}
+You would then call this like so:
+
+{{< highlight golang >}}
+data := make(map[string]interface{})
+data["Something"] = "I am some computed value"
+to := "test@example.com"
+subject := "A simple test mail"
+tpl := "demo" // Assuming you saved the templates as demo.plain.tmpl and demo.html.tmpl
+mail.SendMailWithTemplate(to, subject, tpl, data)
+{{< /highlight >}}
+
+The function does not return an error. If an error occures when sending a mail, it is logged but not returned because sending the mail happens asinchrounly.
+
+Notice the `mail-header.tmpl` and `mail-footer.tmpl` in the template. These populate some basic css, a box for your content and the vikunja logo.
+All that's left for you is to put the content in, which then will appear in a beautifully-styled box.
+
+Remeber, these are email templates. This is different from normal html/css, you cannot use whatever you want (because most of the clients are wayyy to outdated).
+
diff --git a/docs/content/doc/practical-instructions/metrics.md b/docs/content/doc/practical-instructions/metrics.md
new file mode 100644
index 000000000..c6e548f18
--- /dev/null
+++ b/docs/content/doc/practical-instructions/metrics.md
@@ -0,0 +1,46 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Metrics"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Metrics
+
+Metrics work by exposing a `/metrics` endpoint which can then be accessed by prometheus.
+
+To keep the load on the database minimal, metrics are stored and updated in redis.
+The `metrics` package provides several functions to create and update metrics.
+
+## New metrics
+
+First, define a `const` with the metric key in redis. This is done in `pkg/metrics/metrics.go`.
+
+To expose a new metric, you need to register it in the `init` function inside of the `metrics` package like so:
+
+{{< highlight golang >}}
+// Register total user count metric
+promauto.NewGaugeFunc(prometheus.GaugeOpts{
+ Name: "vikunja_team_count", // The key of the metric. Must be unique.
+ Help: "The total number of teams on this instance", // A description about the metric itself.
+}, func() float64 {
+ count, _ := GetCount(TeamCountKey) // TeamCountKey is the const we defined earlier.
+ return float64(count)
+})
+{{< /highlight >}}
+
+Then you'll need to set the metrics initial value on every startup of vikunja.
+This is done in `pkg/routes/routes.go` to avoid cyclic imports.
+If metrics are enabled, it checks if a redis connection is available and then sets the initial values.
+A convenience function is available if the metric is based on a database struct.
+
+Because metrics are stored in redis, you are responsible to increase or decrease these based on criteria you define.
+To do this, use `metrics.UpdateCount(value, key)` where `value` is the amount you want to cange it (you can pass
+negative values to decrease it) and `key` it the redis key used to define the metric.
+
+# Using it
+
+A Prometheus config with a Grafana template is available at [our git repo](https://git.kolaente.de/vikunja/monitoring).
diff --git a/docs/content/doc/practical-instructions/new-config-options.md b/docs/content/doc/practical-instructions/new-config-options.md
new file mode 100644
index 000000000..0fb461fba
--- /dev/null
+++ b/docs/content/doc/practical-instructions/new-config-options.md
@@ -0,0 +1,31 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Adding new config options"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Adding new config options
+
+Vikunja uses [viper](https://github.com/spf13/viper) to handle configuration options.
+It handles parsing all different configuration sources.
+
+The configuration is done in sections. These are represented with a `.` in viper.
+Take a look at `pkg/config/config.go` to understand how these are set.
+
+To add a new config option, you should add a default value to `pkg/config/config.go`.
+Default values should always enable the feature to work somehow, or turn it off completely if it always needs
+additional configuration.
+
+Make sure to add the new config option to [the config document]({{< ref "../setup/config.md">}}) and the default config file
+(`config.yml.sample` at the root of the repository) to make sure it is well documented.
+
+If you're using a computed value as a default, make sure to update the sample config file and debian
+post-install scripts to reflect that.
+
+To get a configured option, use `viper.Get("config.option")`.
+Take a look at [viper's documentation](https://github.com/spf13/viper#getting-values-from-viper) to learn of the
+different ways available to get config options.
\ No newline at end of file
diff --git a/docs/content/doc/practical-instructions/swagger-docs.md b/docs/content/doc/practical-instructions/swagger-docs.md
new file mode 100644
index 000000000..ad24021d9
--- /dev/null
+++ b/docs/content/doc/practical-instructions/swagger-docs.md
@@ -0,0 +1,47 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Modifying swagger api docs"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "practical instructions"
+---
+
+# Adding/editing swagger api docs
+
+The api documentation is generated using [swaggo](https://github.com/swaggo/swag) from comments.
+
+### Documenting structs
+
+You should always comment every field which will be exposed as a json in the api.
+These comments will show up in the documentation, it'll make it easier for developers using the api.
+
+As an example, this is the definition of a list with all comments:
+
+{{< highlight golang >}}
+// List represents a list of tasks
+type List struct {
+ // The unique, numeric id of this list.
+ ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"list"`
+ // The title of the list. You'll see this in the namespace overview.
+ Title string `xorm:"varchar(250)" json:"title" valid:"required,runelength(3|250)" minLength:"3" maxLength:"250"`
+ // The description of the list.
+ Description string `xorm:"varchar(1000)" json:"description" valid:"runelength(0|1000)" maxLength:"1000"`
+ OwnerID int64 `xorm:"int(11) INDEX" json:"-"`
+ NamespaceID int64 `xorm:"int(11) INDEX" json:"-" param:"namespace"`
+
+ // The user who created this list.
+ Owner User `xorm:"-" json:"owner" valid:"-"`
+ // An array of tasks which belong to the list.
+ Tasks []*ListTask `xorm:"-" json:"tasks"`
+
+ // A unix timestamp when this list was created. You cannot change this value.
+ Created int64 `xorm:"created" json:"created"`
+ // A unix timestamp when this list was last updated. You cannot change this value.
+ Updated int64 `xorm:"updated" json:"updated"`
+
+ web.CRUDable `xorm:"-" json:"-"`
+ web.Rights `xorm:"-" json:"-"`
+}
+{{< /highlight >}}
diff --git a/docs/content/doc/setup/backups.md b/docs/content/doc/setup/backups.md
new file mode 100644
index 000000000..c587fee5c
--- /dev/null
+++ b/docs/content/doc/setup/backups.md
@@ -0,0 +1,34 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "What to backup"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
+# What to backup
+
+Vikunja does not store any data outside of the database.
+So, all you need to backup are the contents of that database and maybe the config file.
+
+## MySQL
+
+To create a backup from mysql use the `mysqldump` command:
+
+{{< highlight bash >}}
+mysqldump -u -p -h > vkunja-backup.sql
+{{< /highlight >}}
+
+You will be prompted for the password of the mysql user.
+
+To restore it, simply pipe it back into the `mysql` command:
+
+{{< highlight bash >}}
+mysql -u -p -h < vkunja-backup.sql
+{{< /highlight >}}
+
+## SQLite
+
+To backup sqllite databases, it is enough to copy the database elsewhere.
diff --git a/docs/content/doc/setup/build-from-source.md b/docs/content/doc/setup/build-from-source.md
new file mode 100644
index 000000000..72527d9ff
--- /dev/null
+++ b/docs/content/doc/setup/build-from-source.md
@@ -0,0 +1,25 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Build from sources"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
+# Build Vikunja from source
+
+Vikunja being a go application, has no other dependencies than go itself.
+All libraries are bundeled inside the repo in the `vendor/` folder, so all it boils down to are these steps:
+
+1. Make sure [Go](https://golang.org/doc/install) is properly installed on your system. You'll need at least Go `1.9`.
+2. Make sure [Make](https://www.gnu.org/software/make/) is properly installed on your system.
+3. Clone the repo with `git clone https://code.vikunja.io/api`
+3. Run `make build` in the source of this repo. This will build a binary in the root of the repo which will be able to run on your system.
+
+# Build for different architectures
+
+To build for other platforms and architectures than the one you're currently on, simply run `make release` or `make release-{linux|windows|darwin}`.
+
+More options are available, please refer to the [makefile docs]({{< ref "../development/make.md">}}) for more details.
\ No newline at end of file
diff --git a/docs/config.md b/docs/content/doc/setup/config.md
similarity index 93%
rename from docs/config.md
rename to docs/content/doc/setup/config.md
index 97b2772f7..a119dc25a 100644
--- a/docs/config.md
+++ b/docs/content/doc/setup/config.md
@@ -1,3 +1,13 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Config options"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
# Configuration options
You can either use a `config.yml` file in the root directory of vikunja or set all config option with
@@ -6,16 +16,16 @@ environment variables. If you have both, the value set in the config file is use
Variables are nested in the `config.yml`, these nested variables become `VIKUNJA_FIRST_CHILD` when configuring via
environment variables. So setting
-```bash
+{{< highlight bash >}}
export VIKUNJA_FIRST_CHILD=true
-```
+{{< /highlight >}}
is the same as defining it in a `config.yml` like so:
-```yaml
+{{< highlight yaml >}}
first:
child: true
-```
+{{< /highlight >}}
## Config file locations
@@ -30,7 +40,7 @@ Vikunja will search on various places for a config file:
This is the same as the `config.yml.sample` file you'll find in the root of vikunja.
-```yaml
+{{< highlight yaml >}}
service:
# This token is used to verify issued JWT tokens.
# Default is a random token which will be generated at each startup of vikunja.
@@ -78,9 +88,9 @@ redis:
# Whether to enable redis or not
enabled: false
# The host of the redis server including its port.
- redishost: 'localhost:6379'
+ host: 'localhost:6379'
# The password used to authenicate against the redis server
- redispassword: ''
+ password: ''
# 0 means default database
db: 0
@@ -119,4 +129,4 @@ log:
http: "stdout"
# Echo has its own logging which usually is unnessecary, which is why it is disabled by default. Possible values are stdout, stderr, file or off to disable standard logging.
echo: "off"
-```
+{{< /highlight >}}
diff --git a/docs/content/doc/setup/full-docker-example.md b/docs/content/doc/setup/full-docker-example.md
new file mode 100644
index 000000000..f7473972e
--- /dev/null
+++ b/docs/content/doc/setup/full-docker-example.md
@@ -0,0 +1,110 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Full docker example"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
+# Full docker example
+
+This docker compose configuration will run Vikunja with backend and frontend with a mariadb as database.
+It uses an nginx container to proxy backend and frontend into a single port.
+
+You'll need to save this nginx configuration on your host under `nginx.conf`
+(or elsewhere, but then you'd need to adjust the proxy mount at the bottom of the compose file):
+
+{{< highlight conf >}}
+server {
+ listen 80;
+
+ location / {
+ proxy_pass http://frontend:80;
+ }
+
+ location /api/ {
+ proxy_pass http://api:3456;
+ }
+}
+{{< /highlight >}}
+
+### Without redis
+
+{{< highlight yaml >}}
+version: '3'
+
+services:
+ db:
+ image: mariadb:10
+ environment:
+ MYSQL_ROOT_PASSWORD: supersecret
+ MYSQL_DATABASE: vikunja
+ volumes:
+ - ./db:/var/lib/mysql
+ api:
+ image: vikunja/api
+ environment:
+ VIKUNJA_DATABASE_HOST: db
+ VIKUNJA_DATABASE_PASSWORD: supersecret
+ VIKUNJA_DATABASE_TYPE: mysql
+ VIKUNJA_DATABASE_USER: root
+ VIKUNJA_DATABASE_DATABASE: vikunja
+ depends_on:
+ - db
+ frontend:
+ image: vikunja/frontend
+ proxy:
+ image: nginx
+ ports:
+ - 80:80
+ volumes:
+ - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
+ depends_on:
+ - api
+ - frontend
+{{< /highlight >}}
+
+### With redis
+
+{{< highlight yaml >}}
+version: '3'
+
+services:
+ db:
+ image: mariadb:10
+ environment:
+ MYSQL_ROOT_PASSWORD: supersecret
+ MYSQL_DATABASE: vikunja
+ volumes:
+ - ./db:/var/lib/mysql
+ redis:
+ image: redis
+ api:
+ image: vikunja/api
+ environment:
+ VIKUNJA_DATABASE_HOST: db
+ VIKUNJA_DATABASE_PASSWORD: supersecret
+ VIKUNJA_DATABASE_TYPE: mysql
+ VIKUNJA_DATABASE_USER: root
+ VIKUNJA_DATABASE_DATABASE: vikunja
+ VIKUNJA_REDIS_ENABLED: 1
+ VIKUNJA_REDIS_HOST: 'redis:6379'
+ VIKUNJA_CACHE_ENABLED: 1
+ VIKUNJA_CACHE_TYPE: redis
+ depends_on:
+ - db
+ - redis
+ frontend:
+ image: vikunja/frontend
+ proxy:
+ image: nginx
+ ports:
+ - 80:80
+ volumes:
+ - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
+ depends_on:
+ - api
+ - frontend
+{{< /highlight >}}
\ No newline at end of file
diff --git a/docs/content/doc/setup/install-backend.md b/docs/content/doc/setup/install-backend.md
new file mode 100644
index 000000000..08245ea47
--- /dev/null
+++ b/docs/content/doc/setup/install-backend.md
@@ -0,0 +1,160 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Install Backend"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
+# Backend
+
+## Install from binary
+
+Download a copy of Vikunja from the [download page](https://vikunja.io/en/download/) for your architecture.
+
+{{< highlight bash >}}
+wget
+{{< /highlight >}}
+
+### Verify the GPG signature
+
+Starting with version `0.7`, all releases are signed using pgp.
+Releases from `master` will always be signed.
+
+To validate the downloaded zip file use the signiture file `.asc` and the key `FF054DACD908493A`:
+
+{{< highlight bash >}}
+gpg --keyserver keyserver.ubuntu.com --recv FF054DACD908493A
+gpg --verify vikunja-0.7-linux-amd64-full.zip.asc vikunja-0.7-linux-amd64-full.zip
+{{< /highlight >}}
+
+### Set it up
+
+Once you've verified the signature, you need to unzip it and make it executable, you'll also need to
+create a symlink to it so you can execute Vikunja by typing `vikunja` on your system.
+We'll install vikunja to `/opt/vikunja`, change the path where needed if you want to install it elsewhere.
+
+{{< highlight bash >}}
+mkdir -p /opt/vikunja
+unzip -d /opt/vikunja
+chmod +x /opt/vikunja
+ln -s /opt/vikunja/vikunja /usr/bin/vikunja
+{{< /highlight >}}
+
+### Systemd service
+
+Take the following `service` file and adapt it to your needs:
+
+{{< highlight service >}}
+[Unit]
+Description=Vikunja
+After=syslog.target
+After=network.target
+# Depending on how you configured Vikunja, you may want to uncomment these:
+#Requires=mysql.service
+#Requires=mariadb.service
+#Requires=redis.service
+
+[Service]
+RestartSec=2s
+Type=simple
+WorkingDirectory=/opt/vikunja
+ExecStart=/usr/bin/vikunja
+Restart=always
+# If you want to bind Vikunja to a port below 1024 uncomment
+# the two values below
+###
+#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+#AmbientCapabilities=CAP_NET_BIND_SERVICE
+
+[Install]
+WantedBy=multi-user.target
+{{< /highlight >}}
+
+If you've installed Vikunja to a directory other than `/opt/vikunja`, you need to adapt `WorkingDirectory` accordingly.
+
+Save the file to `/etc/systemd/system/vikunja.service`
+
+After you made all nessecary modifications, it's time to start the service:
+
+{{< highlight bash >}}
+sudo systemctl enable vikunja
+sudo systemctl start vikunja
+{{< /highlight >}}
+
+### Build from source
+
+To build vikunja from source, see [building from source]({{< ref "build-from-source.md">}}).
+
+### Updating
+
+Simply replace the binary and templates with the new version, then restart Vikunja.
+It will automatically run all nessecary database migrations.
+**Make sure to take a look at the changelog for the new version to not miss any manual steps the update may involve!**
+
+## Docker
+
+(Note: this assumes some familarity with docker)
+
+Usage with docker is pretty straightforward:
+
+{{< highlight bash >}}
+docker run -p 3456:3456 vikunja/api
+{{< /highlight >}}
+
+to run with a standard configuration.
+This will expose
+
+You can mount a local configuration like so:
+
+{{< highlight bash >}}
+docker run -p 3456:3456 -v /path/to/config/on/host.yml:/app/vikunja/config.yml:ro vikunja/api
+{{< /highlight >}}
+
+Though it is recommended to use eviroment variables or `.env` files to configure Vikunja in docker.
+See [config]({{< ref "config.md">}}) for a list of available configuration options.
+
+### Docker compose
+
+To run the backend with a mariadb database you can use this example [docker-compose](https://docs.docker.com/compose/) file:
+
+{{< highlight yaml >}}
+version: '2'
+services:
+ api:
+ image: vikunja/api:latest
+ environment:
+ VIKUNJA_DATABASE_HOST: db
+ VIKUNJA_DATABASE_PASSWORD: supersecret
+ VIKUNJA_DATABASE_TYPE: mysql
+ VIKUNJA_DATABASE_USER: root
+ VIKUNJA_SERVICE_JWTSECRET:
+ db:
+ image: mariadb:10
+ environment:
+ MYSQL_ROOT_PASSWORD: supersecret
+ MYSQL_DATABASE: vikunja
+ volumes:
+ - ./db:/var/lib/mysql
+{{< /highlight >}}
+
+See [full docker example]({{< ref "full-docker-example.md">}}) for more varations of this config.
+
+## Debian packages
+
+Since version 0.7 Vikunja is also released as debian packages.
+
+To install these, grab a copy from [the download page](https://vikunja.io/en/download/) and run
+
+{{< highlight bash >}}
+dpkg -i vikunja.deb
+{{< /highlight >}}
+
+This will install the backend to `/opt/vikunja`.
+To configure it, use the config file in `/etc/vikunja/config.yml`.
+
+## Configuration
+
+See [available configuration options]({{< ref "config.md">}}).
diff --git a/docs/content/doc/setup/install-frontend.md b/docs/content/doc/setup/install-frontend.md
new file mode 100644
index 000000000..dd9306917
--- /dev/null
+++ b/docs/content/doc/setup/install-frontend.md
@@ -0,0 +1,116 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Install Frontend"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
+# Frontend
+
+Installing the frontend is just a matter of hosting a bunch of static files somewhere.
+
+With nginx or apache, you have to [download](https://vikunja.io/en/download/) the frontend files first.
+Unzip them and store them somewhere your server can access them.
+
+You also need to configure a rewrite condition to internally redirect all requests to `index.html` which handles all urls.
+
+## Docker
+
+The docker image is based on nginx and just contains all nessecary files for the frontend.
+
+To run it, all you need is
+
+{{< highlight bash >}}
+docker run -p 80:80 vikunja/frontend
+{{< /highlight >}}
+
+which will run the docker image and expose port 80 on the host.
+
+See [full docker example]({{< ref "full-docker-example.md">}}) for more varations of this config.
+
+## NGINX
+
+Below are two example configurations which you can put in your `nginx.conf`:
+
+You may need to adjust `server_name` and `root` accordingly.
+
+After configuring them, you need to reload nginx (`service nginx reload`).
+
+### with gzip enabled (recommended)
+
+{{< highlight conf >}}
+gzip on;
+gzip_disable "msie6";
+
+gzip_vary on;
+gzip_proxied any;
+gzip_comp_level 6;
+gzip_buffers 16 8k;
+gzip_http_version 1.1;
+gzip_min_length 256;
+gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml;
+
+server {
+ listen 80;
+ server_name localhost;
+
+ location / {
+ root /path/to/vikunja/static/frontend/files;
+ try_files $uri $uri/ /;
+ index index.html index.htm;
+ }
+}
+{{< /highlight >}}
+
+### without gzip
+
+{{< highlight conf >}}
+server {
+ listen 80;
+ server_name localhost;
+
+ location / {
+ root /path/to/vikunja/static/frontend/files;
+ try_files $uri $uri/ /;
+ index index.html index.htm;
+ }
+}
+{{< /highlight >}}
+
+## Apache
+
+Apache needs to have `mod_rewrite` enabled for this to work properly:
+
+{{< highlight bash >}}
+a2enmod rewrite
+service apache2 restart
+{{< /highlight >}}
+
+Put the following config in `cat /etc/apache2/sites-available/vikunja.conf`:
+
+{{< highlight aconf >}}
+
+ ServerName localhost
+ DocumentRoot /path/to/vikunja/static/frontend/files
+ RewriteEngine On
+ RewriteRule ^\/?(config\.json|favicon\.ico|css|fonts|images|img|js) - [L]
+ RewriteRule ^(.*)$ /index.html [QSA,L]
+
+{{< /highlight >}}
+
+You probably want to adjust `ServerName` and `DocumentRoot`.
+
+Once you've customized your config, you need to enable it:
+
+{{< highlight bash >}}
+a2ensite vikunja
+service apache2 reload
+{{< /highlight >}}
+
+## Updating
+
+To update, it should be enough to download the new files and overwrite the old ones.
+The paths contain hashes, so all caches are invalidated automatically.
diff --git a/docs/content/doc/setup/install.md b/docs/content/doc/setup/install.md
new file mode 100644
index 000000000..08b1fe10d
--- /dev/null
+++ b/docs/content/doc/setup/install.md
@@ -0,0 +1,40 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Installing"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+ weight: 10
+---
+
+# Installing
+
+Vikunja consists of two parts: [Backend](https://code.vikunja.io/api) and [frontend](https://code.vikunja.io/frontend).
+While the backend is required, the frontend is not.
+You don't neccesarily need to have a web-frontend, using Vikunja via the [mobile app](https://code.vikunja.io/app) is totally fine.
+
+However, using the web frontend is highly reccommended.
+
+Vikunja can be installed in various forms.
+This document provides an overview and instructions for the different methods.
+
+* [Backend]({{< ref "install-backend.md">}})
+ * [Installing from binary]({{< ref "install-backend.md#install-from-binary">}})
+ * [Verify the GPG signature]({{< ref "install-backend.md#verify-the-gpg-signature">}})
+ * [Set it up]({{< ref "install-backend.md#set-it-up">}})
+ * [Systemd service]({{< ref "install-backend.md#systemd-service">}})
+ * [Updating]({{< ref "install-backend.md#updating">}})
+ * [Build from source]({{< ref "install-backend.md#build-from-source">}})
+ * [Docker]({{< ref "install-backend.md#docker">}})
+ * [Debian packages]({{< ref "install-backend.md#debian-packages">}})
+ * [Configuration]({{< ref "config.md">}})
+* [Frontend]({{< ref "install-frontend.md">}})
+ * [Docker]({{< ref "install-frontend.md#docker">}})
+ * [NGINX]({{< ref "install-frontend.md#nginx">}})
+ * [Apache]({{< ref "install-frontend.md#apache">}})
+ * [Updating]({{< ref "install-frontend.md#updating">}})
+* [Reverse proxies]({{< ref "reverse-proxies.md">}})
+* [Full docker example]({{< ref "full-docker-example.md">}})
+* [Backups]({{< ref "backups.md">}})
diff --git a/docs/content/doc/setup/reverse-proxies.md b/docs/content/doc/setup/reverse-proxies.md
new file mode 100644
index 000000000..087017868
--- /dev/null
+++ b/docs/content/doc/setup/reverse-proxies.md
@@ -0,0 +1,95 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Reverse Proxy"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "setup"
+---
+
+# Setup behind a reverse proxy which also serves the frontend
+
+These examples assume you have an instance of the backend running on your server listening on port `3456`.
+If you've changed this setting, you need to update the server configurations accordingly.
+
+## NGINX
+
+Below are two example configurations which you can put in your `nginx.conf`:
+
+You may need to adjust `server_name` and `root` accordingly.
+
+### with gzip enabled (recommended)
+
+{{< highlight conf >}}
+gzip on;
+gzip_disable "msie6";
+
+gzip_vary on;
+gzip_proxied any;
+gzip_comp_level 6;
+gzip_buffers 16 8k;
+gzip_http_version 1.1;
+gzip_min_length 256;
+gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml;
+
+server {
+ listen 80;
+ server_name localhost;
+
+ location / {
+ root /path/to/vikunja/static/frontend/files;
+ try_files $uri $uri/ /;
+ index index.html index.htm;
+ }
+
+ location /api/ {
+ proxy_pass http://localhost:3456;
+ }
+}
+{{< /highlight >}}
+
+### without gzip
+
+{{< highlight conf >}}
+server {
+ listen 80;
+ server_name localhost;
+
+ location / {
+ root /path/to/vikunja/static/frontend/files;
+ try_files $uri $uri/ /;
+ index index.html index.htm;
+ }
+
+ location /api/ {
+ proxy_pass http://localhost:3456;
+ }
+}
+{{< /highlight >}}
+
+## Apache
+
+Put the following config in `cat /etc/apache2/sites-available/vikunja.conf`:
+
+{{< highlight aconf >}}
+
+ ServerName localhost
+
+
+ Order Deny,Allow
+ Allow from all
+
+ ProxyPass /api http://localhost:3456/api
+ ProxyPassReverse /api http://localhost:3456/api
+
+ DocumentRoot /var/www/html
+ RewriteEngine On
+ RewriteRule ^\/?(config\.json|favicon\.ico|css|fonts|images|img|js|api) - [L]
+ RewriteRule ^(.*)$ /index.html [QSA,L]
+
+{{< /highlight >}}
+
+**Note:** The apache modules `proxy` and `proxy_http` must be enabled for this.
+
+For more details see the [frontend apache configuration]({{< ref "install-frontend.md#apache">}}).
\ No newline at end of file
diff --git a/docs/api.md b/docs/content/doc/usage/api.md
similarity index 76%
rename from docs/api.md
rename to docs/content/doc/usage/api.md
index f6d0265e0..582186064 100644
--- a/docs/api.md
+++ b/docs/content/doc/usage/api.md
@@ -1,3 +1,13 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "API Documentation"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "usage"
+---
+
# API Documentation
You can find the api docs under `http://vikunja.tld/api/v1/docs` of your instance.
diff --git a/docs/errors.md b/docs/content/doc/usage/errors.md
similarity index 95%
rename from docs/errors.md
rename to docs/content/doc/usage/errors.md
index f4aace61d..79bb2bf5d 100644
--- a/docs/errors.md
+++ b/docs/content/doc/usage/errors.md
@@ -1,3 +1,13 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Errors"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "usage"
+---
+
# Errors
This document describes the different errors Vikunja can return.
diff --git a/docs/rights.md b/docs/content/doc/usage/rights.md
similarity index 88%
rename from docs/rights.md
rename to docs/content/doc/usage/rights.md
index 38460a320..0eb341851 100644
--- a/docs/rights.md
+++ b/docs/content/doc/usage/rights.md
@@ -1,3 +1,13 @@
+---
+date: "2019-02-12:00:00+02:00"
+title: "Rights"
+draft: false
+type: "doc"
+menu:
+ sidebar:
+ parent: "usage"
+---
+
# List and namespace rights for teams and users
Whenever you share a list or namespace with a user or team, you can specify a `rights` parameter.
diff --git a/docs/nginx.conf b/docs/nginx.conf
new file mode 100644
index 000000000..e59a2ee63
--- /dev/null
+++ b/docs/nginx.conf
@@ -0,0 +1,17 @@
+server {
+ listen 80;
+ server_name localhost;
+
+ charset utf-8;
+
+ location / {
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+ }
+
+ error_page 404 /docs/404.html;
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /usr/share/nginx/html;
+ }
+}
diff --git a/docs/themes/vikunja b/docs/themes/vikunja
new file mode 160000
index 000000000..7127218c9
--- /dev/null
+++ b/docs/themes/vikunja
@@ -0,0 +1 @@
+Subproject commit 7127218c9fd3fbc496d5326dae3bcb55af2801a7
diff --git a/go.mod b/go.mod
index b57236a7b..6607571f1 100644
--- a/go.mod
+++ b/go.mod
@@ -67,5 +67,5 @@ require (
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/testfixtures.v2 v2.5.3
gopkg.in/yaml.v2 v2.2.2 // indirect
- honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3
+ honnef.co/go/tools v0.0.0-20190128043916-71123fcbb8fe
)
diff --git a/go.sum b/go.sum
index 1028e8354..10e9df384 100644
--- a/go.sum
+++ b/go.sum
@@ -17,6 +17,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLM
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cweill/gotests v1.5.2 h1:kKqmKmS2wCV3tuLnfpbiuN8OlkosQZTpCfiqmiuNAsA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -202,3 +203,5 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3 h1:LyX67rVB0kBUFoROrQfzKwdrYLH1cRzHibxdJW85J1c=
honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190128043916-71123fcbb8fe h1:/GZ/onp6W295MEgrIwtlbnxmFSKGavFp7/D7tMVyuaM=
+honnef.co/go/tools v0.0.0-20190128043916-71123fcbb8fe/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/main.go b/main.go
index d2be7da73..024554f14 100644
--- a/main.go
+++ b/main.go
@@ -17,12 +17,12 @@
package main
import (
- "code.vikunja.io/api/docs"
_ "code.vikunja.io/api/pkg/config" // To trigger its init() which initializes the config
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/mail"
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/routes"
+ "code.vikunja.io/api/pkg/swagger"
"context"
"github.com/spf13/viper"
"os"
@@ -51,7 +51,7 @@ func main() {
log.Log.Infof("Vikunja version %s", Version)
// Additional swagger information
- docs.SwaggerInfo.Version = Version
+ swagger.SwaggerInfo.Version = Version
// Start the webserver
e := routes.NewEcho()
diff --git a/pkg/routes/routes.go b/pkg/routes/routes.go
index 861bb8cd4..717188f56 100644
--- a/pkg/routes/routes.go
+++ b/pkg/routes/routes.go
@@ -39,11 +39,11 @@
package routes
import (
- _ "code.vikunja.io/api/docs" // To generate swagger docs
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/metrics"
"code.vikunja.io/api/pkg/models"
apiv1 "code.vikunja.io/api/pkg/routes/api/v1"
+ _ "code.vikunja.io/api/pkg/swagger" // To generate swagger docs
"code.vikunja.io/web"
"code.vikunja.io/web/handler"
"github.com/asaskevich/govalidator"
diff --git a/docs/docs.go b/pkg/swagger/docs.go
similarity index 99%
rename from docs/docs.go
rename to pkg/swagger/docs.go
index 85a71c1ec..0472b0ab8 100644
--- a/docs/docs.go
+++ b/pkg/swagger/docs.go
@@ -1,8 +1,8 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
-// 2019-01-18 12:59:51.359642373 +0100 CET m=+0.125821859
+// 2019-01-31 20:54:13.368738869 +0100 CET m=+0.182170800
-package docs
+package swagger
import (
"bytes"
@@ -14,7 +14,7 @@ import (
var doc = `{
"swagger": "2.0",
"info": {
- "description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer \u003cjwt-token\u003e` + "`" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
+ "description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API",
"contact": {
"name": "General Vikunja contact",
@@ -37,7 +37,7 @@ var doc = `{
"JWTKeyAuth": []
}
],
- "description": "Returns an array with all assignees for this task.",
+ "description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"consumes": [
"application/json"
],
@@ -45,9 +45,9 @@ var doc = `{
"application/json"
],
"tags": [
- "assignees"
+ "labels"
],
- "summary": "Get all assignees for a task",
+ "summary": "Get all labels a user has access to",
"parameters": [
{
"type": "integer",
@@ -57,18 +57,18 @@ var doc = `{
},
{
"type": "string",
- "description": "Search assignees by their username.",
+ "description": "Search labels by label text.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
- "description": "The assignees",
+ "description": "The labels",
"schema": {
"type": "array",
"items": {
- "$ref": "#/definitions/models.User"
+ "$ref": "#/definitions/models.Label"
}
}
},
@@ -391,7 +391,7 @@ var doc = `{
"JWTKeyAuth": []
}
],
- "description": "Returns a team by its ID.",
+ "description": "Returns a list by its ID.",
"consumes": [
"application/json"
],
@@ -399,13 +399,13 @@ var doc = `{
"application/json"
],
"tags": [
- "team"
+ "list"
],
- "summary": "Gets one team",
+ "summary": "Gets one list",
"parameters": [
{
"type": "integer",
- "description": "Team ID",
+ "description": "List ID",
"name": "id",
"in": "path",
"required": true
@@ -413,14 +413,14 @@ var doc = `{
],
"responses": {
"200": {
- "description": "The team",
+ "description": "The list",
"schema": {
"type": "object",
- "$ref": "#/definitions/models.Team"
+ "$ref": "#/definitions/models.List"
}
},
"403": {
- "description": "The user does not have access to the team",
+ "description": "The user does not have access to the list",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
diff --git a/docs/swagger/swagger.json b/pkg/swagger/swagger.json
similarity index 99%
rename from docs/swagger/swagger.json
rename to pkg/swagger/swagger.json
index 29077a74f..f39541604 100644
--- a/docs/swagger/swagger.json
+++ b/pkg/swagger/swagger.json
@@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
- "description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + \"`\" + `Authorization: Bearer \u003cjwt-token\u003e` + \"`\" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
+ "description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API",
"contact": {
"name": "General Vikunja contact",
@@ -24,7 +24,7 @@
"JWTKeyAuth": []
}
],
- "description": "Returns an array with all assignees for this task.",
+ "description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"consumes": [
"application/json"
],
@@ -32,9 +32,9 @@
"application/json"
],
"tags": [
- "assignees"
+ "labels"
],
- "summary": "Get all assignees for a task",
+ "summary": "Get all labels a user has access to",
"parameters": [
{
"type": "integer",
@@ -44,18 +44,18 @@
},
{
"type": "string",
- "description": "Search assignees by their username.",
+ "description": "Search labels by label text.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
- "description": "The assignees",
+ "description": "The labels",
"schema": {
"type": "array",
"items": {
- "$ref": "#/definitions/models.User"
+ "$ref": "#/definitions/models.Label"
}
}
},
@@ -378,7 +378,7 @@
"JWTKeyAuth": []
}
],
- "description": "Returns a team by its ID.",
+ "description": "Returns a list by its ID.",
"consumes": [
"application/json"
],
@@ -386,13 +386,13 @@
"application/json"
],
"tags": [
- "team"
+ "list"
],
- "summary": "Gets one team",
+ "summary": "Gets one list",
"parameters": [
{
"type": "integer",
- "description": "Team ID",
+ "description": "List ID",
"name": "id",
"in": "path",
"required": true
@@ -400,14 +400,14 @@
],
"responses": {
"200": {
- "description": "The team",
+ "description": "The list",
"schema": {
"type": "object",
- "$ref": "#/definitions/models.Team"
+ "$ref": "#/definitions/models.List"
}
},
"403": {
- "description": "The user does not have access to the team",
+ "description": "The user does not have access to the list",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
diff --git a/docs/swagger/swagger.yaml b/pkg/swagger/swagger.yaml
similarity index 98%
rename from docs/swagger/swagger.yaml
rename to pkg/swagger/swagger.yaml
index 76e9f9e7d..18e8835af 100644
--- a/docs/swagger/swagger.yaml
+++ b/pkg/swagger/swagger.yaml
@@ -622,13 +622,7 @@ info:
email: hello@vikunja.io
name: General Vikunja contact
url: http://vikunja.io/en/contact/
- description: |-
- This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams.
- # Authorization
- **JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer ` + "`" + `-header to authenticate successfully.
-
- **BasicAuth:** Only used when requesting tasks via caldav.
-
+ description: ''
license:
name: GPLv3
url: http://code.vikunja.io/api/src/branch/master/LICENSE
@@ -639,14 +633,15 @@ paths:
get:
consumes:
- application/json
- description: Returns an array with all assignees for this task.
+ description: Returns all labels which are either created by the user or associated
+ with a task the user has at least read-access to.
parameters:
- description: The page number. Used for pagination. If not provided, the first
page of results is returned.
in: query
name: p
type: integer
- - description: Search assignees by their username.
+ - description: Search labels by label text.
in: query
name: s
type: string
@@ -654,10 +649,10 @@ paths:
- application/json
responses:
"200":
- description: The assignees
+ description: The labels
schema:
items:
- $ref: '#/definitions/models.User'
+ $ref: '#/definitions/models.Label'
type: array
"500":
description: Internal error
@@ -666,9 +661,9 @@ paths:
type: object
security:
- JWTKeyAuth: []
- summary: Get all assignees for a task
+ summary: Get all labels a user has access to
tags:
- - assignees
+ - labels
put:
consumes:
- application/json
@@ -912,9 +907,9 @@ paths:
get:
consumes:
- application/json
- description: Returns a team by its ID.
+ description: Returns a list by its ID.
parameters:
- - description: Team ID
+ - description: List ID
in: path
name: id
required: true
@@ -923,12 +918,12 @@ paths:
- application/json
responses:
"200":
- description: The team
+ description: The list
schema:
- $ref: '#/definitions/models.Team'
+ $ref: '#/definitions/models.List'
type: object
"403":
- description: The user does not have access to the team
+ description: The user does not have access to the list
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
@@ -939,9 +934,9 @@ paths:
type: object
security:
- JWTKeyAuth: []
- summary: Gets one team
+ summary: Gets one list
tags:
- - team
+ - list
post:
consumes:
- application/json
diff --git a/tools.go b/tools.go
index 0b3cc5de8..7f8e5a5a9 100644
--- a/tools.go
+++ b/tools.go
@@ -30,7 +30,5 @@ import (
_ "golang.org/x/lint/golint"
_ "github.com/jgautheron/goconst/cmd/goconst"
- _ "honnef.co/go/tools/cmd/gosimple"
_ "honnef.co/go/tools/cmd/staticcheck"
- _ "honnef.co/go/tools/cmd/unused"
)