Skip to content

Commit

Permalink
sync: hosted cloud (apitable#1720)
Browse files Browse the repository at this point in the history
Signed-off-by: wangkailang <[email protected]>
Co-authored-by: Caedman Ziwen Lan <[email protected]>
Co-authored-by: Kilian <[email protected]>
Co-authored-by: Zoe <[email protected]>
Co-authored-by: chalme <[email protected]>
Co-authored-by: Aria <[email protected]>
Co-authored-by: XuKecheng <[email protected]>
Co-authored-by: xukecheng <[email protected]>
Co-authored-by: Chambers <[email protected]>
Co-authored-by: ziqiang <[email protected]>
Co-authored-by: Evie Wanmei Huang <[email protected]>
Co-authored-by: jeremyyin <[email protected]>
Co-authored-by: William Chan <[email protected]>
Co-authored-by: wangkailang <[email protected]>
Co-authored-by: yanmingZhang <[email protected]>
Co-authored-by: Jover <[email protected]>
Co-authored-by: paylm penglong feng <[email protected]>
Co-authored-by: Caedman Ziwen Lan <[email protected]>
  • Loading branch information
18 people authored Apr 17, 2024
1 parent 69aeb70 commit 5002ce3
Show file tree
Hide file tree
Showing 165 changed files with 3,318 additions and 1,097 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ test-ut-room-docker:
-e MYSQL_HOST=test-mysql \
-e REDIS_HOST=test-redis \
-e RABBITMQ_HOST=test-rabbitmq \
-e TZ=UTC \
unit-test-room pnpm run test:ut:room:cov
@echo "${GREEN}finished unit test, clean up images...${RESET}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import cn.hutool.core.util.StrUtil;
import com.apitable.automation.model.ActionVO;
import com.apitable.automation.model.AutomationRunTaskVO;
import com.apitable.automation.model.AutomationSimpleVO;
import com.apitable.automation.model.AutomationTaskSimpleVO;
import com.apitable.automation.model.AutomationVO;
Expand Down Expand Up @@ -47,6 +48,7 @@
import com.apitable.workspace.mapper.NodeDescMapper;
import com.apitable.workspace.ro.NodeUpdateOpRo;
import com.apitable.workspace.service.INodeService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
Expand Down Expand Up @@ -215,13 +217,29 @@ public ResponseData<Void> deleteRobot(@PathVariable String resourceId,
}

/**
* Get automation run history.
* Get automation run history detail.
*
* @param pageSize page query parameter
* @param pageNum page query parameter
* @param taskId task id
* @return {@link ResponseData}
*/
@GetResource(path = "/run-history/{taskId}", requiredPermission = false, requiredLogin = false)
@Parameter(name = "taskId", description = "task id", required = true, schema = @Schema(type = "string"), in = ParameterIn.PATH, example = "123****")
@Operation(summary = "Get automation run history task details")
@ApiResponses(@ApiResponse(responseCode = "200", useReturnTypeSchema = true))
public ResponseData<AutomationRunTaskVO> getRunHistoryTaskDetail(
@PathVariable String taskId) {
return ResponseData.success(iAutomationRunHistoryService.getByTaskDetail(taskId));
}

/**
* get automation run history.
*
* @param pageSize page size of automation run history
* @param pageNum page number
* @param shareId share id
* @param resourceId resource id
* @param robotId robot id
* @return {@link ResponseData}
* @return response
*/
@GetResource(path = "/{resourceId}/roots/{robotId}/run-history", requiredPermission = false, requiredLogin = false)
@Parameters({
Expand All @@ -243,8 +261,10 @@ public ResponseData<List<AutomationTaskSimpleVO>> getRunHistory(
iPermissionService.checkPermissionBySessionOrShare(resourceId, shareId,
NodePermission.READ_NODE,
status -> ExceptionUtil.isTrue(status, PermissionException.NODE_OPERATION_DENIED));
String spaceId = iNodeService.getSpaceIdByNodeId(resourceId);
Page<Void> page = Page.of(pageNum, pageSize);
return ResponseData.success(
iAutomationRunHistoryService.getRobotRunHistory(robotId, pageSize, pageNum));
iAutomationRunHistoryService.getRobotRunHistory(spaceId, robotId, page));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* APITable Ltd. <[email protected]>
* Copyright (C) 2022 APITable Ltd. <https://apitable.com>
*
* This code file is part of APITable Enterprise Edition.
*
* It is subject to the APITable Commercial License and conditional on having a fully paid-up license from APITable.
*
* Access to this code file or other code files in this `enterprise` directory and its subdirectories does not constitute permission to use this code or APITable Enterprise Edition features.
*
* Unless otherwise noted, all files Copyright © 2022 APITable Ltd.
*
* For purchase of APITable Enterprise Edition license, please contact <[email protected]>.
*/

package com.apitable.automation.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
* <p>
* Automation - Action Type Table.
* </p>
*
* @author Mybatis Generator Tool
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode
@TableName(keepGlobalPrefix = true, value = "automation_action_type")
public class AutomationActionTypeEntity implements Serializable {

private static final long serialVersionUID = 1L;

/**
* Primary Key.
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;

/**
* Service ID (link#xxxx_automation_service#service_id).
*/
private String serviceId;

/**
* Custom action prototype ID.
*/
private String actionTypeId;

/**
* Name.
*/
private String name;

/**
* Description.
*/
private String description;

/**
* Input JSON normal form.
*/
private String inputJsonSchema;

/**
* Output JSON normal form.
*/
private String outputJsonSchema;

/**
* Call interface.
*/
private String endpoint;

/**
* Internationalized Language Pack.
*/
private String i18n;

/**
* Delete Tag(0: No, 1: Yes).
*/
@TableLogic
private Integer isDeleted;

/**
* Creator.
*/
@TableField(fill = FieldFill.INSERT)
private Long createdBy;

/**
* Last Update By.
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updatedBy;

/**
* Create Time.
*/
private LocalDateTime createdAt;

/**
* Update Time.
*/
private LocalDateTime updatedAt;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* APITable <https://github.com/apitable/apitable>
* Copyright (C) 2022 APITable Ltd. <https://apitable.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.apitable.automation.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigInteger;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
* <p>
* Automation - Run history table.
* </p>
*
* @author Mybatis Generator Tool
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode
@TableName(keepGlobalPrefix = true, value = "automation_run_history")
public class AutomationRunHistoryEntity implements Serializable {

private static final long serialVersionUID = 1L;

/**
* Primary Key.
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private BigInteger id;

/**
* Task ID.
*/
private String taskId;

/**
* Custom Robot ID.
*/
private String robotId;

/**
* Space ID.
*/
private String spaceId;

/**
* Running status (0: Running, 1: Success, 2: Failure).
*/
private Integer status;

/**
* Run Context Details.
*/
private String data;

/**
* Create Time.
*/
private LocalDateTime createdAt;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* APITable <https://github.com/apitable/apitable>
* Copyright (C) 2022 APITable Ltd. <https://apitable.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


package com.apitable.automation.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* automation action type.
*/
@Getter
@AllArgsConstructor
public enum AutomationActionType {

SEND_MAIL("sendMail"),

SEND_REQUEST("sendRequest"),


;


private final String type;
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,11 @@ int updateActionTypeIdAndInputByRobotId(@Param("robotId") String robotId,
String updatedActionTypeId,
@Param("updatedInput") String updatedInput);

/**
* query by action id.
*
* @param actionId action id
* @return AutomationActionEntity
*/
AutomationActionEntity selectByActionId(@Param("actionId") String actionId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* APITable <https://github.com/apitable/apitable>
* Copyright (C) 2022 APITable Ltd. <https://apitable.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.apitable.automation.mapper;

import com.apitable.automation.entity.AutomationActionTypeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

/**
* action type mapping.
*/
public interface AutomationActionTypeMapper extends BaseMapper<AutomationActionTypeEntity> {

/**
* Get action type by endpoint.
*
* @param endpoint invocation interface
* @return action type
*/
String getActionTypeIdByEndpoint(@Param("endpoint") String endpoint);

Long selectIdByActionTypeId(@Param("actionTypeId") String actionTypeId);

/**
* query endpoint.
*
* @param actionTypeId action type id
* @return endpoint
*/
String selectEndpointByActionTypeId(@Param("actionTypeId") String actionTypeId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,12 @@ List<RobotTriggerDto> getRobotTriggers(@Param("seqId") String seqId,
*/
int updateUpdatedByRobotId(@Param("robotId") String robotId,
@Param("updatedBy") Long updatedBy);

/**
* query robot id exists.
*
* @param robotIds robot id
* @return resource id of robot
*/
List<String> selectResourceIdsByRobotIds(@Param("robotIds") List<String> robotIds);
}
Loading

0 comments on commit 5002ce3

Please sign in to comment.