-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tag repository, service and CRUD endpoints (#14971)
- Loading branch information
Showing
17 changed files
with
915 additions
and
4 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
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
23 changes: 23 additions & 0 deletions
23
airbyte-config/config-models/src/main/resources/types/Tag.yaml
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,23 @@ | ||
--- | ||
"$schema": http://json-schema.org/draft-07/schema# | ||
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/Tag.yaml | ||
title: Tag | ||
description: Tag for organizing and grouping resources | ||
type: object | ||
required: | ||
- tagId | ||
- workspaceId | ||
- name | ||
- color | ||
additionalProperties: false | ||
properties: | ||
tagId: | ||
type: string | ||
format: uuid | ||
workspaceId: | ||
type: string | ||
format: uuid | ||
name: | ||
type: string | ||
color: | ||
type: string |
21 changes: 21 additions & 0 deletions
21
airbyte-data/src/main/kotlin/io/airbyte/data/repositories/TagRepository.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,21 @@ | ||
package io.airbyte.data.repositories | ||
|
||
import io.airbyte.data.repositories.entities.Tag | ||
import io.micronaut.data.jdbc.annotation.JdbcRepository | ||
import io.micronaut.data.model.query.builder.sql.Dialect | ||
import io.micronaut.data.repository.PageableRepository | ||
import java.util.UUID | ||
|
||
@JdbcRepository(dialect = Dialect.POSTGRES, dataSource = "config") | ||
interface TagRepository : PageableRepository<Tag, UUID> { | ||
fun findByWorkspaceId(workspaceId: UUID): List<Tag> | ||
|
||
fun countByWorkspaceId(workspaceId: UUID): Int | ||
|
||
fun findByIdForUpdate(id: UUID): Tag | ||
|
||
fun findByIdAndWorkspaceId( | ||
id: UUID, | ||
workspaceId: UUID, | ||
): Tag | ||
} |
22 changes: 22 additions & 0 deletions
22
airbyte-data/src/main/kotlin/io/airbyte/data/repositories/entities/Tag.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,22 @@ | ||
package io.airbyte.data.repositories.entities | ||
|
||
import io.micronaut.data.annotation.AutoPopulated | ||
import io.micronaut.data.annotation.DateCreated | ||
import io.micronaut.data.annotation.DateUpdated | ||
import io.micronaut.data.annotation.Id | ||
import io.micronaut.data.annotation.MappedEntity | ||
import java.util.UUID | ||
|
||
@MappedEntity("tag") | ||
data class Tag( | ||
@field:Id | ||
@AutoPopulated | ||
var id: UUID? = null, | ||
var workspaceId: UUID, | ||
var name: String, | ||
var color: String, | ||
@DateCreated | ||
var createdAt: java.time.OffsetDateTime? = null, | ||
@DateUpdated | ||
var updatedAt: java.time.OffsetDateTime? = null, | ||
) |
22 changes: 22 additions & 0 deletions
22
airbyte-data/src/main/kotlin/io/airbyte/data/services/TagService.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,22 @@ | ||
package io.airbyte.data.services | ||
|
||
import io.airbyte.config.Tag | ||
import java.util.UUID | ||
|
||
/** | ||
* A service that manages tags | ||
*/ | ||
interface TagService { | ||
fun getTag( | ||
tagId: UUID, | ||
workspaceId: UUID, | ||
): Tag | ||
|
||
fun getTagsByWorkspaceId(workspaceId: UUID): List<Tag> | ||
|
||
fun updateTag(tag: Tag): Tag | ||
|
||
fun deleteTag(tagId: UUID) | ||
|
||
fun createTag(tag: Tag): Tag | ||
} |
Oops, something went wrong.