Skip to content

Commit

Permalink
Merge pull request #1 from N7ghtm4r3/1.0.2
Browse files Browse the repository at this point in the history
1.0.2
  • Loading branch information
N7ghtm4r3 authored Jan 19, 2024
2 parents f130add + 7ddb9f2 commit 918c6d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pandoro

**v1.0.1**
**v1.0.2**

This project, based on Java and the
Spring Boot framework, is an open source management software useful in managing your personal projects and group
Expand All @@ -19,15 +19,15 @@ Add the JitPack repository to your build file

```gradle
dependencies {
implementation 'com.tecknobit.pandoro:Pandoro:1.0.1'
implementation 'com.tecknobit.pandoro:Pandoro:1.0.2'
}
```
#### Gradle (Kotlin)
```gradle
dependencies {
implementation("com.tecknobit.pandoro:Pandoro:1.0.1")
implementation("com.tecknobit.pandoro:Pandoro:1.0.2")
}
```
Expand All @@ -40,7 +40,7 @@ Add the JitPack repository to your build file
<dependency>
<groupId>com.tecknobit.pandoro</groupId>
<artifactId>Pandoro</artifactId>
<version>1.0.0</version>
<version>1.0.2</version>
</dependency>
```

Expand All @@ -59,7 +59,7 @@ steps:
- iOS -> planned
- <a href="https://github.com/N7ghtm4r3/Pandoro-Desktop/releases/tag/1.0.1">Pandoro desktop version</a>
- <a href="https://github.com/Rhythmss/pandoro-webapp">Pandoro webapp version</a>
- <a href="https://github.com/N7ghtm4r3/Pandoro/releases/tag/1.0.1">Backend service "out-of-the-box"</a>
- <a href="https://github.com/N7ghtm4r3/Pandoro/releases/tag/1.0.2">Backend service "out-of-the-box"</a>

## Usages

Expand Down Expand Up @@ -212,8 +212,6 @@ Thank you for your help!

[![](https://img.shields.io/badge/Spring_Boot-F2F4F9?style=for-the-badge&logo=spring-boot)](https://spring.io/projects/spring-boot)

[![](https://jitpack.io/v/N7ghtm4r3/Pandoro.svg)](https://jitpack.io/#N7ghtm4r3/Pandoro)

## Business contact

If you need to contact me for a project
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/tecknobit/pandoro/services/GroupsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tecknobit.apimanager.annotations.Wrapper;
import com.tecknobit.pandoro.helpers.ChangelogsCreator.ChangelogOperator;
import com.tecknobit.pandoro.records.Group;
import com.tecknobit.pandoro.records.Project;
import com.tecknobit.pandoro.records.users.GroupMember;
import com.tecknobit.pandoro.records.users.GroupMember.Role;
import com.tecknobit.pandoro.records.users.PublicUser;
Expand All @@ -11,6 +12,7 @@
import com.tecknobit.pandoro.services.repositories.UsersRepository;
import com.tecknobit.pandoro.services.repositories.groups.GroupMembersRepository;
import com.tecknobit.pandoro.services.repositories.groups.GroupsRepository;
import com.tecknobit.pandoro.services.repositories.projects.ProjectsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -72,6 +74,12 @@ public class GroupsHelper extends ChangelogOperator {
@Autowired
private UsersRepository usersRepository;

/**
* {@code projectsRepository} instance for the projects repository
*/
@Autowired
private ProjectsRepository projectsRepository;

/**
* {@code groupsRepository} instance for the groups repository
*/
Expand Down Expand Up @@ -320,6 +328,9 @@ public void leaveGroup(String memberId, String groupId) {
*/
public void leaveGroup(String memberId, String groupId, boolean deleteGroup) {
membersRepository.leaveGroup(memberId, groupId);
for (Project project : getGroup(memberId, groupId).getProjects())
if (project.getAuthor().getId().equals(memberId))
groupsRepository.removeGroupProject(project.getId(), groupId);
if (deleteGroup)
deleteGroup(memberId, groupId);
else
Expand All @@ -335,7 +346,7 @@ public void leaveGroup(String memberId, String groupId, boolean deleteGroup) {
public void deleteGroup(String memberId, String groupId) {
List<GroupMember> members = membersRepository.getGroupMembers(groupId);
String groupName = groupsRepository.getGroup(memberId, groupId).getName();
groupsRepository.deleteGroup(memberId, groupId);
groupsRepository.deleteGroup(groupId);
for (GroupMember member : members)
changelogsCreator.groupDeleted(groupName, member.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public interface GroupsRepository extends JpaRepository<Group, String> {
*/
@Query(
value = "SELECT groups.* FROM " + GROUPS_KEY + " AS groups LEFT JOIN " + GROUP_MEMBERS_TABLE
+ " ON groups." + IDENTIFIER_KEY + " = group_members." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE
+ "." + IDENTIFIER_KEY + "=:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "."
+ INVITATION_STATUS_KEY + " = " + "'JOINED'",
+ " ON groups." + IDENTIFIER_KEY + " = group_members." + GROUP_MEMBER_KEY + " WHERE "
+ GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + "=:" + AUTHOR_KEY + " AND "
+ GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = " + "'JOINED'",
nativeQuery = true
)
List<Group> getGroups(@Param(AUTHOR_KEY) String userId);
Expand Down Expand Up @@ -172,19 +172,14 @@ void removeGroupProject(
/**
* Method to execute the query to delete an existing {@link Group}
*
* @param userId: the user identifier
* @param groupId: the group identifier
*/
@Modifying(clearAutomatically = true)
@Transactional
@Query(
value = "DELETE FROM " + GROUPS_KEY + " WHERE " + GROUPS_KEY + ".id=:" + GROUP_IDENTIFIER_KEY
+ " AND " + GROUPS_KEY + ".author=:" + AUTHOR_KEY,
value = "DELETE FROM " + GROUPS_KEY + " WHERE " + GROUPS_KEY + ".id=:" + GROUP_IDENTIFIER_KEY,
nativeQuery = true
)
void deleteGroup(
@Param(AUTHOR_KEY) String userId,
@Param(GROUP_IDENTIFIER_KEY) String groupId
);
void deleteGroup(@Param(GROUP_IDENTIFIER_KEY) String groupId);

}

0 comments on commit 918c6d3

Please sign in to comment.