-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Lukinhasssss/feature/video-graphql-api
Automated PR from feature/video-graphql-api
- Loading branch information
Showing
36 changed files
with
1,083 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ build/ | |
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
.run/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
|
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,17 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Catálogo de Vídeos" type="JetRunConfigurationType"> | ||
<option name="ALTERNATIVE_JRE_PATH" value="JAVA_21" /> | ||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" /> | ||
<envs> | ||
<env name="KEYCLOAK_CLIENT_ID" value="admin-do-catalogo" /> | ||
<env name="KEYCLOAK_CLIENT_SECRET" value="Td5scdSINqzhib0ket0UFUnvEPP6KAal" /> | ||
</envs> | ||
<option name="MAIN_CLASS_NAME" value="com.lukinhasssss.catalogo.infrastructure.CatalogoDeVideosKt" /> | ||
<module name="catalogo-de-videos.infrastructure.main" /> | ||
<shortenClasspath name="NONE" /> | ||
<option name="VM_PARAMETERS" value="-Dspring.profiles.active=development" /> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
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
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
40 changes: 40 additions & 0 deletions
40
...n/kotlin/com/lukinhasssss/catalogo/infrastructure/castmember/CastMemberInMemoryGateway.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,40 @@ | ||
package com.lukinhasssss.catalogo.infrastructure.castmember | ||
|
||
import com.lukinhasssss.catalogo.domain.castmember.CastMember | ||
import com.lukinhasssss.catalogo.domain.castmember.CastMemberGateway | ||
import com.lukinhasssss.catalogo.domain.castmember.CastMemberSearchQuery | ||
import com.lukinhasssss.catalogo.domain.pagination.Pagination | ||
import org.springframework.context.annotation.Profile | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
@Profile("development") | ||
class CastMemberInMemoryGateway( | ||
private val db: MutableMap<String, CastMember> = mutableMapOf() | ||
) : CastMemberGateway { | ||
|
||
override fun save(aMember: CastMember): CastMember { | ||
db[aMember.id] = aMember | ||
return aMember | ||
} | ||
|
||
override fun findById(anId: String): CastMember? { | ||
return db[anId] | ||
} | ||
|
||
override fun findAll(aQuery: CastMemberSearchQuery): Pagination<CastMember> = with(aQuery) { | ||
Pagination( | ||
currentPage = page, | ||
perPage = perPage, | ||
total = db.size.toLong(), | ||
items = db.values.toList() | ||
) | ||
} | ||
|
||
override fun findAllById(ids: Set<String>): List<CastMember> = | ||
db.filterKeys { it in ids }.values.toList() | ||
|
||
override fun deleteById(anId: String) { | ||
if (db.containsKey(anId)) db.remove(anId) | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...main/kotlin/com/lukinhasssss/catalogo/infrastructure/castmember/GqlCastMemberPresenter.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,38 @@ | ||
package com.lukinhasssss.catalogo.infrastructure.castmember | ||
|
||
import com.lukinhasssss.catalogo.application.castmember.get.GetAllCastMembersByIdUseCase | ||
import com.lukinhasssss.catalogo.application.castmember.list.ListCastMemberOutput | ||
import com.lukinhasssss.catalogo.domain.castmember.CastMember | ||
import com.lukinhasssss.catalogo.infrastructure.castmember.models.GqlCastMember | ||
|
||
object GqlCastMemberPresenter { | ||
fun present(output: ListCastMemberOutput) = with(output) { | ||
GqlCastMember( | ||
id = id, | ||
name = name, | ||
type = type.name, | ||
createdAt = createdAt.toString(), | ||
updatedAt = updatedAt.toString() | ||
) | ||
} | ||
|
||
fun present(output: GetAllCastMembersByIdUseCase.Output) = with(output) { | ||
GqlCastMember( | ||
id = id, | ||
name = name, | ||
type = type.name, | ||
createdAt = createdAt, | ||
updatedAt = updatedAt | ||
) | ||
} | ||
|
||
fun present(output: CastMember) = with(output) { | ||
GqlCastMember( | ||
id = id, | ||
name = name, | ||
type = type.name, | ||
createdAt = createdAt.toString(), | ||
updatedAt = updatedAt.toString() | ||
) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...c/main/kotlin/com/lukinhasssss/catalogo/infrastructure/castmember/models/GqlCastMember.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,9 @@ | ||
package com.lukinhasssss.catalogo.infrastructure.castmember.models | ||
|
||
data class GqlCastMember( | ||
val id: String, | ||
val name: String, | ||
val type: String, | ||
val createdAt: String, | ||
val updatedAt: String | ||
) |
14 changes: 6 additions & 8 deletions
14
...ucture/castmember/models/CastMemberDTO.kt → ...e/castmember/models/GqlCastMemberInput.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
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
40 changes: 40 additions & 0 deletions
40
.../main/kotlin/com/lukinhasssss/catalogo/infrastructure/category/CategoryInMemoryGateway.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,40 @@ | ||
package com.lukinhasssss.catalogo.infrastructure.category | ||
|
||
import com.lukinhasssss.catalogo.domain.category.Category | ||
import com.lukinhasssss.catalogo.domain.category.CategoryGateway | ||
import com.lukinhasssss.catalogo.domain.category.CategorySearchQuery | ||
import com.lukinhasssss.catalogo.domain.pagination.Pagination | ||
import org.springframework.context.annotation.Profile | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
@Profile("development") | ||
class CategoryInMemoryGateway( | ||
private val db: MutableMap<String, Category> = mutableMapOf() | ||
) : CategoryGateway { | ||
|
||
override fun save(aCategory: Category): Category { | ||
db[aCategory.id] = aCategory | ||
return aCategory | ||
} | ||
|
||
override fun findById(anID: String): Category? { | ||
return db[anID] | ||
} | ||
|
||
override fun findAll(aQuery: CategorySearchQuery): Pagination<Category> = with(aQuery) { | ||
Pagination( | ||
currentPage = page, | ||
perPage = perPage, | ||
total = db.size.toLong(), | ||
items = db.values.toList() | ||
) | ||
} | ||
|
||
override fun findAllById(ids: Set<String>): List<Category> = | ||
db.filterKeys { it in ids }.values.toList() | ||
|
||
override fun deleteById(anID: String) { | ||
if (db.containsKey(anID)) db.remove(anID) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...src/main/kotlin/com/lukinhasssss/catalogo/infrastructure/category/GqlCategoryPresenter.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,32 @@ | ||
package com.lukinhasssss.catalogo.infrastructure.category | ||
|
||
import com.lukinhasssss.catalogo.application.category.get.GetAllCategoriesByIdUseCase | ||
import com.lukinhasssss.catalogo.application.category.list.ListCategoryOutput | ||
import com.lukinhasssss.catalogo.domain.category.Category | ||
import com.lukinhasssss.catalogo.infrastructure.category.models.GqlCategory | ||
|
||
object GqlCategoryPresenter { | ||
fun present(output: ListCategoryOutput) = with(output) { | ||
GqlCategory( | ||
id = id, | ||
name = name, | ||
description = description | ||
) | ||
} | ||
|
||
fun present(output: GetAllCategoriesByIdUseCase.Output) = with(output) { | ||
GqlCategory( | ||
id = id, | ||
name = name, | ||
description = description | ||
) | ||
} | ||
|
||
fun present(output: Category) = with(output) { | ||
GqlCategory( | ||
id = id, | ||
name = name, | ||
description = description | ||
) | ||
} | ||
} |
Oops, something went wrong.