Skip to content

Commit

Permalink
Merge pull request #23 from nick-ching23/bug
Browse files Browse the repository at this point in the history
Added check for org that's already registered && removed unnecessary method in RecordMapper
  • Loading branch information
nl2878 authored Nov 28, 2024
2 parents fa2f90a + c80edea commit 4e80833
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public ResponseEntity<?> numFlags(@RequestParam String userId,
*/
@PostMapping("/register")
public ResponseEntity<?> register(@RequestBody LoginRequest loginRequest) {
if (veritasService.checkRegistered(loginRequest.getOrgId())) {
return new ResponseEntity<>("Organization already registered", HttpStatus.OK);
}
try {
return veritasService.register(loginRequest);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pineapple.veritas.entity.Record;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
* Maps record-related operations to SQL statements.
*/
@Mapper
public interface RecordMapper extends BaseMapper<Record> {

@Update("UPDATE records SET numFlags = #{numFlags} WHERE orgID = #{orgId} AND userID = #{userId}")
int updateByCompositeKey(@Param("userId") String userId,
@Param("orgId") String orgId,
@Param("numFlags") int numFlags);
}
public interface RecordMapper extends BaseMapper<Record> { }

0 comments on commit 4e80833

Please sign in to comment.