Skip to content
Snippets Groups Projects
Commit baf14d8b authored by Sarthak Shrivastava's avatar Sarthak Shrivastava
Browse files

Fixed small bug with My Organizations not populating correctly.

parent 6f0685e9
No related branches found
No related tags found
No related merge requests found
......@@ -39,3 +39,18 @@ p {
.blue-button:hover {
background-color: #2980b9;
}
.dark-red-button {
background-color: #8b0000; /* Dark red color */
color: #fff;
border: 1px solid #6b0000; /* Dark red border color */
padding: 8px 16px;
margin: 0 10px;
font-size: 14px;
cursor: pointer;
max-width: 10%;
}
.dark-red-button:hover {
background-color: #6b0000; /* Dark red color on hover */
}
\ No newline at end of file
......@@ -77,7 +77,7 @@ const OrganizationDetails = ({token}) => {
<button className="blue-button">Requests</button>
<button className="blue-button">Items</button>
<button className="blue-button">Listings</button>
<button className="blue-button" onClick={handleLeaveButtonClick}>Leave Organization</button>
<button className="dark-red-button" onClick={handleLeaveButtonClick}>Leave Organization</button>
</div>
</div>
);
......
......@@ -24,7 +24,7 @@ public class MyOrgRosterRepository implements OrgRosterRepository{
String nativeQuery = "SELECT DISTINCT o.* " +
"FROM ORGANIZATION o " +
"JOIN ORGANIZATION_ROSTER r ON o.organization_id = r.organization_id " +
"WHERE r.user_email = :userEmail OR o.owner_email = :userEmail";
"WHERE r.user_email = :userEmail";
List<Organization> organizations = entityManager
.createNativeQuery(nativeQuery, Organization.class)
.setParameter("userEmail", userEmail)
......@@ -120,8 +120,9 @@ public class MyOrgRosterRepository implements OrgRosterRepository{
Query promoteManagerNativeQuery = entityManager.createNativeQuery(promoteManagerQuery);
promoteManagerNativeQuery.setParameter("orgId", orgId);
int updatedRows = promoteManagerNativeQuery.executeUpdate();
int updatedRows = promoteManagerNativeQuery.executeUpdate();
System.out.println("updated a random manager to be the owner, " + updatedRows);
if (updatedRows > 0) {
// Update owner_email in Organization table
String updateOwnerEmailQuery = "UPDATE organization SET owner_email = (SELECT user_email FROM organization_roster WHERE organization_id = :orgId AND type = 'OWNER') WHERE organization_id = :orgId";
......@@ -144,7 +145,7 @@ public class MyOrgRosterRepository implements OrgRosterRepository{
promoteMemberNativeQuery.setParameter("orgId", orgId);
int updatedRows = promoteMemberNativeQuery.executeUpdate();
System.out.println("updated a random member to be the owner, " + updatedRows);
if (updatedRows > 0) {
// Update owner_email in Organization table
String updateOwnerEmailQuery = "UPDATE organization SET owner_email = (SELECT user_email FROM organization_roster WHERE organization_id = :orgId AND type = 'OWNER') WHERE organization_id = :orgId";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment