Remove org model; make AppUser global with super admin
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s
This commit is contained in:
@@ -7,5 +7,4 @@ import java.util.UUID
|
||||
interface AppUserRepo : JpaRepository<AppUser, UUID> {
|
||||
fun findByFirebaseUid(firebaseUid: String): AppUser?
|
||||
fun existsByFirebaseUid(firebaseUid: String): Boolean
|
||||
fun findByOrgId(orgId: UUID): List<AppUser>
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.util.UUID
|
||||
|
||||
interface GuestVehicleRepo : JpaRepository<GuestVehicle, UUID> {
|
||||
fun findByOrgIdAndVehicleNumberIgnoreCase(orgId: UUID, vehicleNumber: String): GuestVehicle?
|
||||
fun findByPropertyIdAndVehicleNumberIgnoreCase(propertyId: UUID, vehicleNumber: String): GuestVehicle?
|
||||
fun findByGuestIdIn(guestIds: List<UUID>): List<GuestVehicle>
|
||||
fun existsByOrgIdAndVehicleNumberIgnoreCase(orgId: UUID, vehicleNumber: String): Boolean
|
||||
fun existsByPropertyIdAndVehicleNumberIgnoreCase(propertyId: UUID, vehicleNumber: String): Boolean
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.android.trisolarisserver.repo
|
||||
|
||||
import com.android.trisolarisserver.models.property.Organization
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.util.UUID
|
||||
|
||||
interface OrganizationRepo : JpaRepository<Organization, UUID> {
|
||||
fun findByName(name: String): Organization?
|
||||
fun findByNameIgnoreCase(name: String): Organization?
|
||||
fun existsByNameIgnoreCase(name: String): Boolean
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.android.trisolarisserver.repo
|
||||
|
||||
import com.android.trisolarisserver.models.property.PendingUser
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.util.UUID
|
||||
|
||||
interface PendingUserRepo : JpaRepository<PendingUser, UUID> {
|
||||
fun findByFirebaseUid(firebaseUid: String): PendingUser?
|
||||
}
|
||||
@@ -5,6 +5,6 @@ import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.util.UUID
|
||||
|
||||
interface PropertyRepo : JpaRepository<Property, UUID> {
|
||||
fun existsByOrgIdAndCode(orgId: UUID, code: String): Boolean
|
||||
fun existsByOrgIdAndCodeAndIdNot(orgId: UUID, code: String, id: UUID): Boolean
|
||||
fun existsByCode(code: String): Boolean
|
||||
fun existsByCodeAndIdNot(code: String, id: UUID): Boolean
|
||||
}
|
||||
|
||||
@@ -25,16 +25,6 @@ interface PropertyUserRepo : JpaRepository<PropertyUser, PropertyUserId> {
|
||||
@Param("userId") userId: UUID
|
||||
): Set<Role>
|
||||
|
||||
@Query("""
|
||||
select pu.property.id
|
||||
from PropertyUser pu
|
||||
where pu.user.id = :userId
|
||||
and pu.property.org.id = :orgId
|
||||
""")
|
||||
fun findPropertyIdsByOrgAndUser(
|
||||
@Param("orgId") orgId: UUID,
|
||||
@Param("userId") userId: UUID
|
||||
): List<UUID>
|
||||
|
||||
@Query("""
|
||||
select case when count(pu) > 0 then true else false end
|
||||
@@ -49,16 +39,4 @@ interface PropertyUserRepo : JpaRepository<PropertyUser, PropertyUserId> {
|
||||
@Param("roles") roles: Set<Role>
|
||||
): Boolean
|
||||
|
||||
@Query("""
|
||||
select case when count(pu) > 0 then true else false end
|
||||
from PropertyUser pu join pu.roles r
|
||||
where pu.user.id = :userId
|
||||
and pu.property.org.id = :orgId
|
||||
and r in :roles
|
||||
""")
|
||||
fun hasAnyRoleInOrg(
|
||||
@Param("orgId") orgId: UUID,
|
||||
@Param("userId") userId: UUID,
|
||||
@Param("roles") roles: Set<Role>
|
||||
): Boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user