2
0
Эх сурвалжийг харах

Fix Cards and Users docs not generated because of syntax error and new Javascript syntax.
Wekan uses wekan/releases/generate-docs*.sh Python code to generate OpenAPI docs,
it did not show any errors while generating docs, only left out parts of API docs.

Thanks to pvcon13 and xet7 !

Lauri Ojansivu 5 жил өмнө
parent
commit
9ae20a3f51

+ 3 - 2
models/cards.js

@@ -1053,6 +1053,7 @@ Cards.helpers({
       return Users.find({ _id: { $in: this.vote.positive } });
     return [];
   },
+
   voteMemberNegative() {
     if (this.vote && this.vote.negative)
       return Users.find({ _id: { $in: this.vote.negative } });
@@ -1475,12 +1476,12 @@ Cards.mutations({
       },
     };
   },
-  setVoteQuestion(question, public) {
+  setVoteQuestion(question, publicVote) {
     return {
       $set: {
         vote: {
           question,
-          public,
+          public: publicVote,
           positive: [],
           negative: [],
         },

+ 1 - 1
models/users.js

@@ -531,7 +531,7 @@ Users.helpers({
   getStartDayOfWeek() {
     const profile = this.profile || {};
     // default is 'Monday' (1)
-    return profile.startDayOfWeek ?? 1;
+    return profile.startDayOfWeek || 1;
   },
 
   getTemplatesBoardId() {

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1 - 1
public/api/wekan.html


+ 999 - 0
public/api/wekan.yml

@@ -1221,6 +1221,296 @@ paths:
             properties:
               _id:
                 type: string
+  /api/boards/{board}/lists/{list}/cards:
+    get:
+      operationId: get_all_cards
+      summary: Get all Cards attached to a List
+      tags:
+        - Cards
+      parameters:
+        - name: board
+          in: path
+          description: |
+            the board ID
+          type: string
+          required: true
+        - name: list
+          in: path
+          description: |
+            the list ID
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: array
+            items:
+              type: object
+              properties:
+                _id:
+                  type: string
+                title:
+                  type: string
+                description:
+                  type: string
+    post:
+      operationId: new_card
+      summary: Create a new Card
+      tags:
+        - Cards
+      consumes:
+        - multipart/form-data
+        - application/json
+      parameters:
+        - name: authorId
+          in: formData
+          description: the authorId value
+          type: string
+          required: true
+        - name: members
+          in: formData
+          description: |
+            the member IDs list of the new card
+          type: string
+          required: false
+        - name: assignees
+          in: formData
+          description: |
+            the array of maximum one ID of assignee of the new card
+          type: string
+          required: false
+        - name: title
+          in: formData
+          description: |
+            the title of the new card
+          type: string
+          required: true
+        - name: description
+          in: formData
+          description: |
+            the description of the new card
+          type: string
+          required: true
+        - name: swimlaneId
+          in: formData
+          description: |
+            the swimlane ID of the new card
+          type: string
+          required: true
+        - name: board
+          in: path
+          description: |
+            the board ID of the new card
+          type: string
+          required: true
+        - name: list
+          in: path
+          description: |
+            the list ID of the new card
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: object
+            properties:
+              _id:
+                type: string
+  /api/boards/{board}/lists/{list}/cards/{card}:
+    get:
+      operationId: get_board_list_card
+      tags:
+        - Cards
+      parameters:
+        - name: board
+          in: path
+          description: the board value
+          type: string
+          required: true
+        - name: list
+          in: path
+          description: the list value
+          type: string
+          required: true
+        - name: card
+          in: path
+          description: the card value
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+    put:
+      operationId: put_board_list_card
+      tags:
+        - Cards
+      consumes:
+        - multipart/form-data
+        - application/json
+      parameters:
+        - name: title
+          in: formData
+          description: the title value
+          type: string
+          required: true
+        - name: listId
+          in: formData
+          description: the listId value
+          type: string
+          required: true
+        - name: authorId
+          in: formData
+          description: the authorId value
+          type: string
+          required: true
+        - name: parentId
+          in: formData
+          description: the parentId value
+          type: string
+          required: true
+        - name: description
+          in: formData
+          description: the description value
+          type: string
+          required: true
+        - name: color
+          in: formData
+          description: the color value
+          type: string
+          required: true
+        - name: labelIds
+          in: formData
+          description: the labelIds value
+          type: string
+          required: true
+        - name: requestedBy
+          in: formData
+          description: the requestedBy value
+          type: string
+          required: true
+        - name: assignedBy
+          in: formData
+          description: the assignedBy value
+          type: string
+          required: true
+        - name: receivedAt
+          in: formData
+          description: the receivedAt value
+          type: string
+          required: true
+        - name: startAt
+          in: formData
+          description: the startAt value
+          type: string
+          required: true
+        - name: dueAt
+          in: formData
+          description: the dueAt value
+          type: string
+          required: true
+        - name: endAt
+          in: formData
+          description: the endAt value
+          type: string
+          required: true
+        - name: spentTime
+          in: formData
+          description: the spentTime value
+          type: string
+          required: true
+        - name: isOverTime
+          in: formData
+          description: the isOverTime value
+          type: string
+          required: true
+        - name: customFields
+          in: formData
+          description: the customFields value
+          type: string
+          required: true
+        - name: members
+          in: formData
+          description: the members value
+          type: string
+          required: true
+        - name: assignees
+          in: formData
+          description: the assignees value
+          type: string
+          required: true
+        - name: swimlaneId
+          in: formData
+          description: the swimlaneId value
+          type: string
+          required: true
+        - name: board
+          in: path
+          description: the board value
+          type: string
+          required: true
+        - name: list
+          in: path
+          description: the list value
+          type: string
+          required: true
+        - name: card
+          in: path
+          description: the card value
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+    delete:
+      operationId: delete_board_list_card
+      tags:
+        - Cards
+      parameters:
+        - name: board
+          in: path
+          description: the board value
+          type: string
+          required: true
+        - name: list
+          in: path
+          description: the list value
+          type: string
+          required: true
+        - name: card
+          in: path
+          description: the card value
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
   /api/boards/{board}/members/{member}:
     post:
       operationId: set_board_member_permission
@@ -1276,6 +1566,104 @@ paths:
         '200':
           description: |-
             200 response
+  /api/boards/{board}/members/{user}/add:
+    post:
+      operationId: add_board_member
+      summary: Add New Board Member with Role
+      description: |
+        Only the admin user (the first user) can call the REST API.
+
+         **Note**: see [Boards.set_board_member_permission](#set_board_member_permission)
+         to later change the permissions.
+      tags:
+        - Users
+        - Boards
+      consumes:
+        - multipart/form-data
+        - application/json
+      parameters:
+        - name: action
+          in: formData
+          description: the action value
+          type: string
+          required: true
+        - name: isAdmin
+          in: formData
+          description: |
+            is the user an admin of the board
+          type: boolean
+          required: true
+        - name: isNoComments
+          in: formData
+          description: |
+            disable comments
+          type: boolean
+          required: true
+        - name: isCommentOnly
+          in: formData
+          description: |
+            only enable comments
+          type: boolean
+          required: true
+        - name: board
+          in: path
+          description: |
+            the board ID
+          type: string
+          required: true
+        - name: user
+          in: path
+          description: |
+            the user ID
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: object
+            properties:
+              _id:
+                type: string
+              title:
+                type: string
+  /api/boards/{board}/members/{user}/remove:
+    post:
+      operationId: post_board_user_remove
+      tags:
+        - Users
+      consumes:
+        - multipart/form-data
+        - application/json
+      parameters:
+        - name: action
+          in: formData
+          description: the action value
+          type: string
+          required: true
+        - name: board
+          in: path
+          description: the board value
+          type: string
+          required: true
+        - name: user
+          in: path
+          description: the user value
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
   /api/boards/{board}/swimlanes:
     get:
       operationId: get_all_swimlanes
@@ -1392,6 +1780,208 @@ paths:
         '200':
           description: |-
             200 response
+  /api/boards/{board}/swimlanes/{swimlane}/cards:
+    get:
+      operationId: get_board_swimlane_cards
+      tags:
+        - Cards
+      parameters:
+        - name: board
+          in: path
+          description: the board value
+          type: string
+          required: true
+        - name: swimlane
+          in: path
+          description: the swimlane value
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+  /api/user:
+    get:
+      operationId: get_current_user
+      summary: returns the current user
+      tags:
+        - Users
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            $ref: "#/definitions/Users"
+  /api/users:
+    get:
+      operationId: get_all_users
+      summary: return all the users
+      description: |
+        Only the admin user (the first user) can call the REST API.
+      tags:
+        - Users
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: array
+            items:
+              type: object
+              properties:
+                _id:
+                  type: string
+                username:
+                  type: string
+    post:
+      operationId: new_user
+      summary: Create a new user
+      description: |
+        Only the admin user (the first user) can call the REST API.
+      tags:
+        - Users
+      consumes:
+        - multipart/form-data
+        - application/json
+      parameters:
+        - name: username
+          in: formData
+          description: |
+            the new username
+          type: string
+          required: true
+        - name: email
+          in: formData
+          description: |
+            the email of the new user
+          type: string
+          required: true
+        - name: password
+          in: formData
+          description: |
+            the password of the new user
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: object
+            properties:
+              _id:
+                type: string
+  /api/users/{user}:
+    get:
+      operationId: get_user
+      summary: get a given user
+      description: |
+        Only the admin user (the first user) can call the REST API.
+      tags:
+        - Users
+      parameters:
+        - name: user
+          in: path
+          description: |
+            the user ID
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            $ref: "#/definitions/Users"
+    put:
+      operationId: edit_user
+      summary: edit a given user
+      description: |
+        Only the admin user (the first user) can call the REST API.
+
+         Possible values for *action*:
+         - `takeOwnership`: The admin takes the ownership of ALL boards of the user (archived and not archived) where the user is admin on.
+         - `disableLogin`: Disable a user (the user is not allowed to login and his login tokens are purged)
+         - `enableLogin`: Enable a user
+      tags:
+        - Users
+      consumes:
+        - multipart/form-data
+        - application/json
+      parameters:
+        - name: action
+          in: formData
+          description: |
+            the action
+          type: string
+          required: true
+        - name: user
+          in: path
+          description: |
+            the user ID
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: object
+            properties:
+              _id:
+                type: string
+              title:
+                type: string
+    delete:
+      operationId: delete_user
+      summary: Delete a user
+      description: |
+        Only the admin user (the first user) can call the REST API.
+      tags:
+        - Users
+      parameters:
+        - name: user
+          in: path
+          description: |
+            the ID of the user to delete
+          type: string
+          required: true
+      produces:
+        - application/json
+      security:
+          - UserSecurity: []
+      responses:
+        '200':
+          description: |-
+            200 response
+          schema:
+            type: object
+            properties:
+              _id:
+                type: string
   /api/users/{user}/boards:
     get:
       operationId: get_boards_from_user
@@ -1764,6 +2354,222 @@ definitions:
       - createdAt
       - modifiedAt
       - userId
+  Cards:
+    type: object
+    properties:
+      title:
+        description: |
+           the title of the card
+        type: string
+        x-nullable: true
+      archived:
+        description: |
+           is the card archived
+        type: boolean
+      parentId:
+        description: |
+           ID of the parent card
+        type: string
+        x-nullable: true
+      listId:
+        description: |
+           List ID where the card is
+        type: string
+        x-nullable: true
+      swimlaneId:
+        description: |
+           Swimlane ID where the card is
+        type: string
+      boardId:
+        description: |
+           Board ID of the card
+        type: string
+        x-nullable: true
+      coverId:
+        description: |
+           Cover ID of the card
+        type: string
+        x-nullable: true
+      color:
+        type: string
+        enum:
+          - white
+          - green
+          - yellow
+          - orange
+          - red
+          - purple
+          - blue
+          - sky
+          - lime
+          - pink
+          - black
+          - silver
+          - peachpuff
+          - crimson
+          - plum
+          - darkgreen
+          - slateblue
+          - magenta
+          - gold
+          - navy
+          - gray
+          - saddlebrown
+          - paleturquoise
+          - mistyrose
+          - indigo
+        x-nullable: true
+      createdAt:
+        description: |
+           creation date
+        type: string
+      modifiedAt:
+        type: string
+      customFields:
+        description: |
+           list of custom fields
+        type: array
+        items:
+          $ref: "#/definitions/CardsCustomfields"
+        x-nullable: true
+      dateLastActivity:
+        description: |
+           Date of last activity
+        type: string
+      description:
+        description: |
+           description of the card
+        type: string
+        x-nullable: true
+      requestedBy:
+        description: |
+           who requested the card (ID of the user)
+        type: string
+        x-nullable: true
+      assignedBy:
+        description: |
+           who assigned the card (ID of the user)
+        type: string
+        x-nullable: true
+      labelIds:
+        description: |
+           list of labels ID the card has
+        type: array
+        items:
+          type: string
+          x-nullable: true
+        x-nullable: true
+      members:
+        description: |
+           list of members (user IDs)
+        type: array
+        items:
+          type: string
+          x-nullable: true
+        x-nullable: true
+      assignees:
+        description: |
+           who is assignee of the card (user ID),
+           maximum one ID of assignee in array.
+        type: array
+        items:
+          type: string
+          x-nullable: true
+        x-nullable: true
+      receivedAt:
+        description: |
+           Date the card was received
+        type: string
+        x-nullable: true
+      startAt:
+        description: |
+           Date the card was started to be worked on
+        type: string
+        x-nullable: true
+      dueAt:
+        description: |
+           Date the card is due
+        type: string
+        x-nullable: true
+      endAt:
+        description: |
+           Date the card ended
+        type: string
+        x-nullable: true
+      spentTime:
+        description: |
+           How much time has been spent on this
+        type: number
+        x-nullable: true
+      isOvertime:
+        description: |
+           is the card over time?
+        type: boolean
+        x-nullable: true
+      userId:
+        description: |
+           user ID of the author of the card
+        type: string
+      sort:
+        description: |
+           Sort value
+        type: number
+      subtaskSort:
+        description: |
+           subtask sort value
+        type: number
+        x-nullable: true
+      type:
+        description: |
+           type of the card
+        type: string
+      linkedId:
+        description: |
+           ID of the linked card
+        type: string
+        x-nullable: true
+      vote:
+        description: |
+           vote object, see below
+        $ref: "#/definitions/CardsVote"
+        x-nullable: true
+    required:
+      - archived
+      - swimlaneId
+      - createdAt
+      - modifiedAt
+      - dateLastActivity
+      - userId
+      - sort
+      - type
+  CardsVote:
+    type: object
+    properties:
+      question:
+        type: string
+      positive:
+        description: |
+           list of members (user IDs)
+        type: array
+        items:
+          type: string
+          x-nullable: true
+      negative:
+        description: |
+           list of members (user IDs)
+        type: array
+        items:
+          type: string
+          x-nullable: true
+      end:
+        type: string
+      public:
+        type: boolean
+    required:
+      - question
+      - public
+  CardsCustomfields:
+    type: object
   ChecklistItems:
     type: object
     description:  An item in a checklist
@@ -2131,3 +2937,196 @@ definitions:
       - createdAt
       - modifiedAt
       - type
+  Users:
+    type: object
+    description:  A User in wekan
+    properties:
+      username:
+        description: |
+           the username of the user
+        type: string
+        x-nullable: true
+      emails:
+        description: |
+           the list of emails attached to a user
+        type: array
+        items:
+          $ref: "#/definitions/UsersEmails"
+        x-nullable: true
+      createdAt:
+        description: |
+           creation date of the user
+        type: string
+      modifiedAt:
+        type: string
+      profile:
+        description: |
+           profile settings
+        $ref: "#/definitions/UsersProfile"
+        x-nullable: true
+      services:
+        description: |
+           services field of the user
+        type: object
+        x-nullable: true
+      heartbeat:
+        description: |
+           last time the user has been seen
+        type: string
+        x-nullable: true
+      isAdmin:
+        description: |
+           is the user an admin of the board?
+        type: boolean
+        x-nullable: true
+      createdThroughApi:
+        description: |
+           was the user created through the API?
+        type: boolean
+        x-nullable: true
+      loginDisabled:
+        description: |
+           loginDisabled field of the user
+        type: boolean
+        x-nullable: true
+      authenticationMethod:
+        description: |
+           authentication method of the user
+        type: string
+    required:
+      - createdAt
+      - modifiedAt
+      - authenticationMethod
+  UsersEmails:
+    type: object
+    properties:
+      address:
+        description: |
+           The email address
+        type: string
+      verified:
+        description: |
+           Has the email been verified
+        type: boolean
+    required:
+      - address
+      - verified
+  UsersProfile:
+    type: object
+    properties:
+      avatarUrl:
+        description: |
+           URL of the avatar of the user
+        type: string
+      emailBuffer:
+        description: |
+           list of email buffers of the user
+        type: array
+        items:
+          type: string
+          x-nullable: true
+      fullname:
+        description: |
+           full name of the user
+        type: string
+      showDesktopDragHandles:
+        description: |
+           does the user want to hide system messages?
+        type: boolean
+      hiddenSystemMessages:
+        description: |
+           does the user want to hide system messages?
+        type: boolean
+      hiddenMinicardLabelText:
+        description: |
+           does the user want to hide minicard label texts?
+        type: boolean
+      initials:
+        description: |
+           initials of the user
+        type: string
+      invitedBoards:
+        description: |
+           board IDs the user has been invited to
+        type: array
+        items:
+          type: string
+          x-nullable: true
+      language:
+        description: |
+           language of the user
+        type: string
+      notifications:
+        description: |
+           enabled notifications for the user
+        type: array
+        items:
+          $ref: "#/definitions/UsersProfileNotifications"
+      activity:
+        description: |
+           The id of the activity this notification references
+        type: string
+      read:
+        description: |
+           the date on which this notification was read
+        type: string
+      showCardsCountAt:
+        description: |
+           showCardCountAt field of the user
+        type: number
+      startDayOfWeek:
+        description: |
+           startDayOfWeek field of the user
+        type: number
+      starredBoards:
+        description: |
+           list of starred board IDs
+        type: array
+        items:
+          type: string
+          x-nullable: true
+      icode:
+        description: |
+           icode
+        type: string
+      boardView:
+        description: |
+           boardView field of the user
+        type: string
+        enum:
+          - board-view-lists
+          - board-view-swimlanes
+          - board-view-cal
+      listSortBy:
+        description: |
+           default sort list for user
+        type: string
+        enum:
+          - -modifiedat
+          - modifiedat
+          - -title
+          - title
+          - -sort
+          - sort
+      templatesBoardId:
+        description: |
+           Reference to the templates board
+        type: string
+      cardTemplatesSwimlaneId:
+        description: |
+           Reference to the card templates swimlane Id
+        type: string
+      listTemplatesSwimlaneId:
+        description: |
+           Reference to the list templates swimlane Id
+        type: string
+      boardTemplatesSwimlaneId:
+        description: |
+           Reference to the board templates swimlane Id
+        type: string
+    required:
+      - activity
+      - templatesBoardId
+      - cardTemplatesSwimlaneId
+      - listTemplatesSwimlaneId
+      - boardTemplatesSwimlaneId

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно