github.com/erda-project/erda-infra@v1.0.9/providers/component-protocol/components/kanban/operation.go (about)

     1  // Copyright (c) 2021 Terminus, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package kanban
    16  
    17  import (
    18  	"github.com/erda-project/erda-infra/providers/component-protocol/cptype"
    19  )
    20  
    21  // kanban-level
    22  type (
    23  	// OpBoardCreate includes std op and server&client data.
    24  	OpBoardCreate struct {
    25  		cptype.Operation
    26  		ServerData OpBoardCreateServerData `json:"serverData,omitempty"`
    27  		ClientData OpBoardCreateClientData `json:"clientData,omitempty"`
    28  	}
    29  	// OpBoardCreateServerData .
    30  	OpBoardCreateServerData struct{}
    31  	// OpBoardCreateClientData .
    32  	OpBoardCreateClientData struct {
    33  		Title string `json:"title,omitempty"`
    34  	}
    35  )
    36  
    37  // OpKey .
    38  func (o OpBoardCreate) OpKey() cptype.OperationKey { return "boardCreate" }
    39  
    40  // board-level
    41  type (
    42  	// OpBoardLoadMore .
    43  	OpBoardLoadMore struct {
    44  		cptype.Operation
    45  		ServerData OpBoardLoadMoreServerData `json:"serverData,omitempty"`
    46  		ClientData OpBoardLoadMoreClientData `json:"clientData,omitempty"`
    47  	}
    48  	// OpBoardLoadMoreServerData .
    49  	OpBoardLoadMoreServerData struct{}
    50  	// OpBoardLoadMoreClientData .
    51  	OpBoardLoadMoreClientData struct {
    52  		DataRef *Board `json:"dataRef,omitempty"`
    53  
    54  		PageNo   uint64 `json:"pageNo,omitempty"`
    55  		PageSize uint64 `json:"pageSize,omitempty"`
    56  	}
    57  )
    58  
    59  // OpKey .
    60  func (o OpBoardLoadMore) OpKey() cptype.OperationKey { return "boardLoadMore" }
    61  
    62  type (
    63  	// OpBoardUpdate .
    64  	OpBoardUpdate struct {
    65  		cptype.Operation
    66  		ServerData OpBoardUpdateServerData `json:"serverData,omitempty"`
    67  		ClientData OpBoardUpdateClientData `json:"clientData,omitempty"`
    68  	}
    69  	// OpBoardUpdateServerData .
    70  	OpBoardUpdateServerData struct{}
    71  	// OpBoardUpdateClientData .
    72  	OpBoardUpdateClientData struct {
    73  		DataRef *Board `json:"dataRef,omitempty"`
    74  
    75  		// update fields
    76  		Title string `json:"title,omitempty"`
    77  	}
    78  )
    79  
    80  // OpKey .
    81  func (o OpBoardUpdate) OpKey() cptype.OperationKey { return "boardUpdate" }
    82  
    83  type (
    84  	// OpBoardDelete .
    85  	OpBoardDelete struct {
    86  		cptype.Operation
    87  		ServerData OpBoardDeleteServerData `json:"serverData,omitempty"`
    88  		ClientData OpBoardDeleteClientData `json:"clientData,omitempty"`
    89  	}
    90  	// OpBoardDeleteServerData .
    91  	OpBoardDeleteServerData struct{}
    92  	// OpBoardDeleteClientData .
    93  	OpBoardDeleteClientData struct {
    94  		DataRef *Board `json:"dataRef,omitempty"`
    95  	}
    96  )
    97  
    98  // OpKey .
    99  func (o OpBoardDelete) OpKey() cptype.OperationKey { return "boardDelete" }
   100  
   101  // card-level
   102  type (
   103  	// OpCardMoveTo .
   104  	OpCardMoveTo struct {
   105  		cptype.Operation
   106  		ServerData OpCardMoveToServerData `json:"serverData,omitempty"`
   107  		ClientData OpCardMoveToClientData `json:"clientData,omitempty"`
   108  	}
   109  	// OpCardMoveToServerData .
   110  	OpCardMoveToServerData struct {
   111  		AllowedTargetBoardIDs []string `json:"allowedTargetBoardIDs,omitempty"`
   112  	}
   113  	// OpCardMoveToClientData .
   114  	OpCardMoveToClientData struct {
   115  		DataRef *Card `json:"dataRef,omitempty"`
   116  
   117  		TargetBoardID string `json:"targetBoardID,omitempty"`
   118  	}
   119  )
   120  
   121  // OpKey .
   122  func (o OpCardMoveTo) OpKey() cptype.OperationKey { return "cardMoveTo" }