1
0

feat: rename lists to projects

This commit is contained in:
kolaente
2022-11-13 17:07:01 +01:00
parent 80266d1383
commit 349e6a5905
113 changed files with 2753 additions and 2750 deletions

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ import (
type LinkShareToken struct {
auth.Token
*models.LinkSharing
ListID int64 `json:"list_id"`
ProjectID int64 `json:"project_id"`
}
// LinkShareAuth represents everything required to authenticate a link share
@ -42,7 +42,7 @@ type LinkShareAuth struct {
// AuthenticateLinkShare gives a jwt auth token for valid share hashes
// @Summary Get an auth token for a share
// @Description Get a jwt auth token for a shared list from a share hash.
// @Description Get a jwt auth token for a shared project from a share hash.
// @tags sharing
// @Accept json
// @Produce json
@ -84,6 +84,6 @@ func AuthenticateLinkShare(c echo.Context) error {
return c.JSON(http.StatusOK, LinkShareToken{
Token: auth.Token{Token: t},
LinkSharing: share,
ListID: share.ListID,
ProjectID: share.ProjectID,
})
}

View File

@ -29,21 +29,21 @@ import (
"github.com/labstack/echo/v4"
)
// GetListsByNamespaceID is the web handler to delete a namespace
// TODO: depricate this in favour of namespace.ReadOne() <-- should also return the lists
// @Summary Get all lists in a namespace
// @Description Returns all lists inside of a namespace.
// GetProjectsByNamespaceID is the web handler to delete a namespace
// TODO: depricate this in favour of namespace.ReadOne() <-- should also return the projects
// @Summary Get all projects in a namespace
// @Description Returns all projects inside of a namespace.
// @tags namespace
// @Accept json
// @Produce json
// @Param id path int true "Namespace ID"
// @Security JWTKeyAuth
// @Success 200 {array} models.List "The lists."
// @Success 200 {array} models.Project "The projects."
// @Failure 403 {object} models.Message "No access to that namespace."
// @Failure 404 {object} models.Message "The namespace does not exist."
// @Failure 500 {object} models.Message "Internal error"
// @Router /namespaces/{id}/lists [get]
func GetListsByNamespaceID(c echo.Context) error {
// @Router /namespaces/{id}/projects [get]
func GetProjectsByNamespaceID(c echo.Context) error {
s := db.NewSession()
defer s.Close()
@ -53,17 +53,17 @@ func GetListsByNamespaceID(c echo.Context) error {
return handler.HandleHTTPError(err, c)
}
// Get the lists
// Get the projects
doer, err := user.GetCurrentUser(c)
if err != nil {
return handler.HandleHTTPError(err, c)
}
lists, err := models.GetListsByNamespaceID(s, namespace.ID, doer)
projects, err := models.GetProjectsByNamespaceID(s, namespace.ID, doer)
if err != nil {
return handler.HandleHTTPError(err, c)
}
return c.JSON(http.StatusOK, lists)
return c.JSON(http.StatusOK, projects)
}
func getNamespace(s *xorm.Session, c echo.Context) (namespace *models.Namespace, err error) {
@ -76,7 +76,7 @@ func getNamespace(s *xorm.Session, c echo.Context) (namespace *models.Namespace,
}
if namespaceID == -1 {
namespace = &models.SharedListsPseudoNamespace
namespace = &models.SharedProjectsPseudoNamespace
return
}

View File

@ -54,7 +54,7 @@ func GenerateCaldavToken(c echo.Context) (err error) {
return c.JSON(http.StatusCreated, token)
}
// GetCaldavTokens is the handler to return a list of all caldav tokens for the current user
// GetCaldavTokens is the handler to return a project of all caldav tokens for the current user
// @Summary Returns the caldav tokens for the current user
// @Description Return the IDs and created dates of all caldav tokens for the current user.
// @tags user

View File

@ -29,7 +29,7 @@ import (
"github.com/labstack/echo/v4"
)
// UserList gets all information about a user
// UserProject gets all information about a user
// @Summary Get users
// @Description Search for a user by its username, name or full email. Name (not username) or email require that the user has enabled this in their settings.
// @tags user
@ -41,13 +41,13 @@ import (
// @Failure 400 {object} web.HTTPError "Something's invalid."
// @Failure 500 {object} models.Message "Internal server error."
// @Router /users [get]
func UserList(c echo.Context) error {
func UserProject(c echo.Context) error {
search := c.QueryParam("s")
s := db.NewSession()
defer s.Close()
users, err := user.ListUsers(s, search, nil)
users, err := user.ProjectUsers(s, search, nil)
if err != nil {
_ = s.Rollback()
return handler.HandleHTTPError(err, c)
@ -66,27 +66,27 @@ func UserList(c echo.Context) error {
return c.JSON(http.StatusOK, users)
}
// ListUsersForList returns a list with all users who have access to a list, regardless of the method the list was shared with them.
// ProjectUsersForProject returns a project with all users who have access to a project, regardless of the method the project was shared with them.
// @Summary Get users
// @Description Lists all users (without emailadresses). Also possible to search for a specific user.
// @tags list
// @Description Projects all users (without emailadresses). Also possible to search for a specific user.
// @tags project
// @Accept json
// @Produce json
// @Param s query string false "Search for a user by its name."
// @Security JWTKeyAuth
// @Param id path int true "List ID"
// @Param id path int true "Project ID"
// @Success 200 {array} user.User "All (found) users."
// @Failure 400 {object} web.HTTPError "Something's invalid."
// @Failure 401 {object} web.HTTPError "The user does not have the right to see the list."
// @Failure 401 {object} web.HTTPError "The user does not have the right to see the project."
// @Failure 500 {object} models.Message "Internal server error."
// @Router /lists/{id}/listusers [get]
func ListUsersForList(c echo.Context) error {
listID, err := strconv.ParseInt(c.Param("list"), 10, 64)
// @Router /projects/{id}/projectusers [get]
func ProjectUsersForProject(c echo.Context) error {
projectID, err := strconv.ParseInt(c.Param("project"), 10, 64)
if err != nil {
return handler.HandleHTTPError(err, c)
}
list := models.List{ID: listID}
project := models.Project{ID: projectID}
auth, err := auth2.GetAuthFromClaims(c)
if err != nil {
return handler.HandleHTTPError(err, c)
@ -95,7 +95,7 @@ func ListUsersForList(c echo.Context) error {
s := db.NewSession()
defer s.Close()
canRead, _, err := list.CanRead(s, auth)
canRead, _, err := project.CanRead(s, auth)
if err != nil {
_ = s.Rollback()
return handler.HandleHTTPError(err, c)
@ -105,7 +105,7 @@ func ListUsersForList(c echo.Context) error {
}
search := c.QueryParam("s")
users, err := models.ListUsersFromList(s, &list, search)
users, err := models.ProjectUsersFromProject(s, &project, search)
if err != nil {
_ = s.Rollback()
return handler.HandleHTTPError(err, c)

View File

@ -50,9 +50,9 @@ type UserSettings struct {
OverdueTasksRemindersEnabled bool `json:"overdue_tasks_reminders_enabled"`
// The time when the daily summary of overdue tasks will be sent via email.
OverdueTasksRemindersTime string `json:"overdue_tasks_reminders_time" valid:"time,required"`
// If a task is created without a specified list this value should be used. Applies
// If a task is created without a specified project this value should be used. Applies
// to tasks made directly in API and from clients.
DefaultListID int64 `json:"default_list_id"`
DefaultProjectID int64 `json:"default_project_id"`
// The day when the week starts for this user. 0 = sunday, 1 = monday, etc.
WeekStart int `json:"week_start" valid:"range(0|7)"`
// The user's language
@ -193,7 +193,7 @@ func UpdateGeneralUserSettings(c echo.Context) error {
user.DiscoverableByEmail = us.DiscoverableByEmail
user.DiscoverableByName = us.DiscoverableByName
user.OverdueTasksRemindersEnabled = us.OverdueTasksRemindersEnabled
user.DefaultListID = us.DefaultListID
user.DefaultProjectID = us.DefaultProjectID
user.WeekStart = us.WeekStart
user.Language = us.Language
user.Timezone = us.Timezone
@ -215,7 +215,7 @@ func UpdateGeneralUserSettings(c echo.Context) error {
// GetAvailableTimezones
// @Summary Get all available time zones on this vikunja instance
// @Description Because available time zones depend on the system Vikunja is running on, this endpoint returns a list of all valid time zones this particular Vikunja instance can handle. The list of time zones is not sorted, you should sort it on the client.
// @Description Because available time zones depend on the system Vikunja is running on, this endpoint returns a project of all valid time zones this particular Vikunja instance can handle. The project of time zones is not sorted, you should sort it on the client.
// @tags user
// @Accept json
// @Produce json

View File

@ -71,7 +71,7 @@ func UserShow(c echo.Context) error {
DiscoverableByName: u.DiscoverableByName,
DiscoverableByEmail: u.DiscoverableByEmail,
OverdueTasksRemindersEnabled: u.OverdueTasksRemindersEnabled,
DefaultListID: u.DefaultListID,
DefaultProjectID: u.DefaultProjectID,
WeekStart: u.WeekStart,
Language: u.Language,
Timezone: u.Timezone,