Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.10.0
current_version = 1.13.0
commit = False
tag = False

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ jobs:
JAVA_FILE_NAME: checkstyle.xml
VALIDATE_SHELL_SHFMT: false
VALIDATE_DOCKERFILE_HADOLINT: false
VALIDATE_JSCPD: false
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image:
tasks:
- name: install dependency
init: |
npm install -g pnpm
npm install -g pnpm@8.13.1
make install
command: |
echo "Happy Coding"
Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.0
1.13.0
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": false,
"[typescriptreact]": {
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# APITable CHANGELOG

## [v1.10.0-beta.3](https://github.com/apitable/apitable/releases/tag/v1.10.0-beta.3) (2024-05-06)


### What's more

* sync: hosted cloud ([#1734](https://github.com/apitable/apitable/pull/1734)) @zoe-icu
* refactor: add changelog ([#1721](https://github.com/apitable/apitable/pull/1721)) @zoe-icu
* chore: upgrade mysql2 ([#11084](https://github.com/apitable/apitable/pull/1734/commits/d299e369b8047f577e915adfe3b627317af3028c)) @zoe-icu
## [v1.10.0-beta.2](https://github.com/apitable/apitable/releases/tag/v1.10.0-beta.2) (2024-04-17)


### Bug fixes

* fix: delete automation trigger ([#1657](https://github.com/apitable/apitable/pull/1657)) @zoe-icu

### What's more

* sync: hosted cloud ([#1720](https://github.com/apitable/apitable/pull/1720)) @zoe-icu
## [v1.10.0-beta](https://github.com/apitable/apitable/releases/tag/v1.10.0-beta) (2024-03-11)


Expand Down
2 changes: 1 addition & 1 deletion backend-server/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.0
1.13.0
1 change: 1 addition & 0 deletions backend-server/application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation libs.spring.boot.thymeleaf
implementation libs.spring.integration.redis
implementation libs.spring.session.redis
implementation libs.spring.boot.oauth2.client
implementation libs.mysql
runtimeOnly libs.mysql
implementation libs.spring.security.cas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ public interface IAutomationTriggerService {
*/
List<TriggerVO> update(Long userId, String triggerId, String spaceId, UpdateTriggerRO data);

/**
* Delete trigger.
*
* @param robotId robot id
* @param triggerId trigger id
* @param userId operator user id
*/
void deleteByDatabus(String robotId, String triggerId, Long userId);


/**
* Delete trigger.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package com.apitable.automation.service.impl;

import static com.apitable.automation.enums.AutomationException.AUTOMATION_ROBOT_NOT_EXIST;
import static com.apitable.automation.enums.AutomationException.AUTOMATION_TRIGGER_LIMIT;
import static com.apitable.automation.enums.AutomationException.AUTOMATION_TRIGGER_NOT_EXIST;
import static com.apitable.automation.model.TriggerSimpleVO.triggerComparator;
Expand All @@ -29,7 +28,6 @@
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.apitable.automation.entity.AutomationRobotEntity;
import com.apitable.automation.entity.AutomationTriggerEntity;
import com.apitable.automation.enums.AutomationTriggerType;
import com.apitable.automation.mapper.AutomationTriggerMapper;
Expand All @@ -47,8 +45,6 @@
import com.apitable.shared.config.properties.LimitProperties;
import com.apitable.shared.util.IdUtil;
import com.apitable.starter.databus.client.api.AutomationDaoApiApi;
import com.apitable.starter.databus.client.model.ApiResponseAutomationTriggerSO;
import com.apitable.starter.databus.client.model.AutomationRobotTriggerRO;
import com.apitable.starter.databus.client.model.AutomationTriggerSO;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import jakarta.annotation.Resource;
Expand All @@ -61,7 +57,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestClientException;

/**
* automation trigger service impl.
Expand Down Expand Up @@ -133,19 +128,11 @@ public List<TriggerVO> update(Long userId, String triggerId, String spaceId,
ExceptionUtil.isNotNull(trigger, AUTOMATION_TRIGGER_NOT_EXIST);
String scheduleTriggerTypeId = iAutomationTriggerTypeService.getTriggerTypeByEndpoint(
AutomationTriggerType.SCHEDULED_TIME_ARRIVE.getType());
if (StrUtil.isNotBlank(data.getTriggerTypeId())) {
// change trigger type to schedule should create schedule
if (!trigger.getTriggerId().equals(scheduleTriggerTypeId)
&& data.getTriggerTypeId().equals(scheduleTriggerTypeId)) {
automationServiceFacade.createSchedule(spaceId, triggerId,
JSONUtil.toJsonStr(JSONUtil.createObj()));
}
// change schedule to another type
if (trigger.getTriggerId().equals(scheduleTriggerTypeId)
&& !data.getTriggerTypeId().equals(scheduleTriggerTypeId)) {
automationServiceFacade.updateSchedule(triggerId,
JSONUtil.toJsonStr(JSONUtil.createObj()));
}
if (StrUtil.isNotBlank(data.getTriggerTypeId())
&& !trigger.getTriggerTypeId().equals(data.getTriggerTypeId())) {
// change trigger type should reset schedule config to empty object {}
automationServiceFacade.updateSchedule(triggerId,
JSONUtil.toJsonStr(JSONUtil.createObj()));
trigger.setTriggerTypeId(data.getTriggerTypeId());
}
if (StrUtil.isNotBlank(data.getPrevTriggerId())) {
Expand All @@ -166,22 +153,6 @@ public List<TriggerVO> update(Long userId, String triggerId, String spaceId,
return formatVoFromEntities(ListUtil.of(trigger));
}

@Override
public void deleteByDatabus(String robotId, String triggerId, Long userId) {
AutomationRobotTriggerRO ro = new AutomationRobotTriggerRO();
ro.setUserId(userId);
ro.setIsDeleted(true);
ro.setTriggerId(triggerId);
try {
ApiResponseAutomationTriggerSO response =
automationDaoApiApi.daoCreateOrUpdateAutomationRobotTrigger(robotId, ro);
ExceptionUtil.isFalse(
AUTOMATION_ROBOT_NOT_EXIST.getCode().equals(response.getCode()),
AUTOMATION_ROBOT_NOT_EXIST);
} catch (RestClientException e) {
log.error("Delete trigger: {}", triggerId, e);
}
}

@Override
@Transactional(rollbackFor = Exception.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ protected ControlRoleDict doExecute(Principal principal, ControlId controlId,
List<Long> unitIds =
iUnitService.getUnitIdsByRefIds(CollUtil.newArrayList(principal.getPrincipal()));
return doExecute(unitIds, controlId, requestWrapper);
} else if (principal.getPrincipalType() == PrincipalType.TAG_ID) {
List<Long> unitIds =
iUnitService.getUnitIdsByRefIds(CollUtil.newArrayList(principal.getPrincipal()));
return doExecute(unitIds, controlId, requestWrapper);
} else {
throw new UnknownPrincipalTypeException(principal.getPrincipalType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public enum PrincipalType {
UNIT_ID(0),
MEMBER_ID(1),
TEAM_ID(2),
ROLE_ID(3);
ROLE_ID(3),
TAG_ID(4);

private final int val;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,15 @@ public List<String> fuzzySearchIfSatisfyCondition(String spaceId, String word) {
public <T extends SocialEvent> void eventCall(T event) {

}

/**
* get union id map.
*
* @param userIds user ids
* @return map
*/
@Override
public Map<Long, String> getUnionIdMap(List<Long> userIds) {
return Collections.emptyMap();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,12 @@ void checkWhetherSpaceCanChangeMainAdmin(String spaceId, Long opMemberId, Long a
List<String> fuzzySearchIfSatisfyCondition(String spaceId, String word);

<T extends SocialEvent> void eventCall(T event);

/**
* get union id map.
*
* @param userIds user ids
* @return map
*/
Map<Long, String> getUnionIdMap(List<Long> userIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Objects;
import org.springframework.web.bind.annotation.RestController;

/**
Expand Down Expand Up @@ -72,7 +73,9 @@ public class InternalOrganizationController {
@Parameter(name = "all", description = "whether to load all departments and members",
schema = @Schema(type = "boolean"), in = ParameterIn.QUERY),
@Parameter(name = "searchEmail", description = "whether to search for emails",
schema = @Schema(type = "boolean"), in = ParameterIn.QUERY)
schema = @Schema(type = "boolean"), in = ParameterIn.QUERY),
@Parameter(name = "type", description = "the return unit type, 1-department, 3-member", schema = @Schema(type = "integer"),
in = ParameterIn.QUERY, example = "3")
})
public ResponseData<List<UnitInfoVo>> loadOrSearch(@Valid LoadSearchDTO params) {
// sharing node/template: un login users invoke processing
Expand All @@ -81,6 +84,11 @@ public ResponseData<List<UnitInfoVo>> loadOrSearch(@Valid LoadSearchDTO params)
List<UnitInfoVo> vos = iOrganizationService.loadOrSearchInfo(userId, spaceId, params, null);
List<UnitInfoVo> existUnitInfo =
vos.stream().filter(unitInfoVo -> !unitInfoVo.getIsDeleted()).collect(toList());
if (null != params.getType()) {
existUnitInfo = existUnitInfo.stream()
.filter(unitInfoVo -> Objects.equals(unitInfoVo.getType(), params.getType()))
.collect(toList());
}
return ResponseData.success(existUnitInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@ public InternalSpaceApiUsageVo getSpaceEntitlementApiUsageVo(String spaceId) {
InternalSpaceApiUsageVo vo = assembler.toApiUsageVo(planFeature);
LocalDate now = ClockManager.me().getLocalDateNow();
CycleDateRange dateRange = SubscriptionDateRange.calculateCycleDate(subscriptionInfo, now);
vo.setApiUsageUsedCount(
iStaticsService.getCurrentMonthApiUsage(spaceId, dateRange.getCycleEndDate()));
vo.setApiCallUsedNumsCurrentMonth(
iStaticsService.getCurrentMonthApiUsage(spaceId, dateRange.getCycleEndDate()));
Long count = iStaticsService.getCurrentMonthApiUsage(spaceId, dateRange.getCycleEndDate());
vo.setApiUsageUsedCount(count);
vo.setApiCallUsedNumsCurrentMonth(count);
vo.setIsAllowOverLimit(true);
return vo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import com.apitable.shared.context.LoginContext;
import com.apitable.shared.context.SessionContext;
import com.apitable.shared.holder.SpaceHolder;
import com.apitable.shared.security.IFrequencyLimitService;
import com.apitable.shared.util.page.PageHelper;
import com.apitable.shared.util.page.PageInfo;
import com.apitable.shared.util.page.PageObjectParam;
Expand Down Expand Up @@ -138,6 +139,9 @@ public class MemberController {
@Resource
private BlackListServiceFacade blackListServiceFacade;

@Resource
private IFrequencyLimitService iFrequencyLimitService;

@Resource
private IRoleService iRoleService;

Expand Down Expand Up @@ -507,12 +511,13 @@ public void downloadTemplate(HttpServletResponse response) {
@Parameter(name = ParamsConstants.SPACE_ID, description = "space id", required = true,
schema = @Schema(type = "string"), in = ParameterIn.HEADER, example = "spcyQkKp9XJEl")
public ResponseData<UploadParseResultVO> uploadExcel(UploadMemberTemplateRo data) {
// human verification
humanVerificationServiceFacade.verifyNonRobot(new NonRobotMetadata(data.getData()));
String spaceId = LoginContext.me().getSpaceId();
// check black space
blackListServiceFacade.checkSpace(spaceId);
iFrequencyLimitService.spaceInviteFrequency(spaceId);
iSpaceService.checkCanOperateSpaceUpdate(spaceId);
// human verification
humanVerificationServiceFacade.verifyNonRobot(new NonRobotMetadata(data.getData()));
SubscriptionInfo subscriptionInfo =
entitlementServiceFacade.getSpaceSubscription(spaceId);
if (subscriptionInfo.isFree() && iMemberService.shouldPreventInvitation(spaceId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import jakarta.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
Expand Down Expand Up @@ -289,7 +290,9 @@ public ResponseData<SubUnitResultVo> getSubUnitList(
@Parameter(name = "all", description = "whether to load all departments and members",
schema = @Schema(type = "boolean"), in = ParameterIn.QUERY),
@Parameter(name = "searchEmail", description = "whether to search for emails",
schema = @Schema(type = "boolean"), in = ParameterIn.QUERY)
schema = @Schema(type = "boolean"), in = ParameterIn.QUERY),
@Parameter(name = "type", description = "the return unit type, 1-department, 3-member", schema = @Schema(type = "integer"),
in = ParameterIn.QUERY, example = "3")
})
public ResponseData<List<UnitInfoVo>> loadOrSearch(@Valid LoadSearchDTO params) {
// sharing node/template: un login users invoke processing
Expand Down Expand Up @@ -321,6 +324,11 @@ public ResponseData<List<UnitInfoVo>> loadOrSearch(@Valid LoadSearchDTO params)
iOrganizationService.loadOrSearchInfo(userId, spaceId, params, sharer);
List<UnitInfoVo> existUnitInfo =
vos.stream().filter(unitInfoVo -> !unitInfoVo.getIsDeleted()).collect(toList());
if (null != params.getType()) {
existUnitInfo = existUnitInfo.stream()
.filter(unitInfoVo -> Objects.equals(unitInfoVo.getType(), params.getType()))
.collect(toList());
}
return ResponseData.success(existUnitInfo);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ public class LoadSearchDTO {
private Boolean searchEmail;

private String userId;

private Integer type;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.apitable.organization.dto;

import lombok.Data;

/**
* tag info dto.
*/
@Data
public class TagInfoDto {

private Long id;

private Long unitId;

private String tagName;

}
Loading