-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix get photos bug with many2many (#176)
* Fix get photos bug with many2many Also made a new PhotoTagReferenceDto to help handle this better. * add responseentity to get request * remove unused imports and smal cleanup * Update src/main/kotlin/no/fg/hilflingbackend/controller/MotiveController.kt Co-authored-by: Sindre J. I. Sivertsen <sindrejohan1@gmail.com> * Update src/main/kotlin/no/fg/hilflingbackend/controller/PhotoController.kt Co-authored-by: Sindre J. I. Sivertsen <sindrejohan1@gmail.com> * cleanup * remove unused method * remove unused method * lint Co-authored-by: Caroline Sandsbråten <carolinesandsbraten@Carolines-MBP.dhcp.wlan.samfundet.no> Co-authored-by: Sindre J. I. Sivertsen <sindrejohan1@gmail.com>
- Loading branch information
1 parent
5c76de1
commit 42e9ccb
Showing
9 changed files
with
137 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/no/fg/hilflingbackend/dto/PhotoTagReferenceDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package no.fg.hilflingbackend.dto | ||
|
||
import no.fg.hilflingbackend.model.Photo | ||
import no.fg.hilflingbackend.model.PhotoTag | ||
import no.fg.hilflingbackend.model.PhotoTagReference | ||
import java.util.UUID | ||
|
||
data class PhotoTagReferenceDto( | ||
val photoTagReferenceId: PhotoTagReferenceId = PhotoTagReferenceId(), | ||
val photoTag: PhotoTag, | ||
val photo: Photo | ||
) | ||
|
||
data class PhotoTagReferenceId( | ||
override val id: UUID = UUID.randomUUID() | ||
) : UuidId { | ||
override fun toString(): String = id.toString() | ||
} | ||
|
||
fun PhotoTagReferenceDto.toEntity(): PhotoTagReference { | ||
val dto = this | ||
return PhotoTagReference { | ||
id = dto.photoTagReferenceId.id | ||
photo = dto.photo | ||
photoTag = dto.photoTag | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.