Skip to content

Commit

Permalink
DRAFT: BE
Browse files Browse the repository at this point in the history
  • Loading branch information
StaNov committed Nov 26, 2024
1 parent d8ee8ee commit 33c5089
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ open class ProjectModel(
val avatar: Avatar?,
val organizationOwner: SimpleOrganizationModel?,
val baseLanguage: LanguageModel?,
val useNamespaces: Boolean,
val defaultNamespace: NamespaceModel?,
val organizationRole: OrganizationRoleType?,
@Schema(description = "Current user's direct permission", example = "MANAGE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ProjectModelAssembler(
organizationRole = view.organizationRole,
organizationOwner = view.organizationOwner.let { simpleOrganizationModelAssembler.toModel(it) },
baseLanguage = baseLanguage.let { languageModelAssembler.toModel(LanguageDto.fromEntity(it, it.id)) },
useNamespaces = view.useNamespaces,
defaultNamespace = defaultNamespace,
directPermission = view.directPermission?.let { permissionModelAssembler.toModel(it) },
computedPermission = computedPermissionModelAssembler.toModel(computedPermissions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ data class EditProjectRequest(
@field:Pattern(regexp = "^[a-z0-9-]*[a-z]+[a-z0-9-]*$", message = "invalid_pattern")
var slug: String? = null,
var baseLanguageId: Long? = null,
var useNamespaces: Boolean = false,
var defaultNamespaceId: Long? = null,
@field:Size(min = 3, max = 2000)
var description: String? = null,
Expand Down
3 changes: 3 additions & 0 deletions backend/data/src/main/kotlin/io/tolgee/model/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ class Project(
@ColumnDefault("true")
override var icuPlaceholders: Boolean = true

@ColumnDefault("false")
var useNamespaces: Boolean = false

@ColumnDefault("0")
var lastTaskNumber: Long = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface ProjectView {
val description: String?
val slug: String?
val avatarHash: String?
val useNamespaces: Boolean
val defaultNamespace: Namespace?
val organizationOwner: Organization
val organizationRole: OrganizationRoleType?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ open class ProjectWithLanguagesView(
override val description: String?,
override val slug: String?,
override val avatarHash: String?,
override val useNamespaces: Boolean,
override val defaultNamespace: Namespace?,
override val organizationOwner: Organization,
override val organizationRole: OrganizationRoleType?,
Expand All @@ -29,6 +30,7 @@ open class ProjectWithLanguagesView(
description = view.description,
slug = view.slug,
avatarHash = view.avatarHash,
useNamespaces = view.useNamespaces,
defaultNamespace = view.defaultNamespace,
organizationOwner = view.organizationOwner,
organizationRole = view.organizationRole,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ProjectWithStatsView(
view.description,
view.slug,
view.avatarHash,
view.useNamespaces,
view.defaultNamespace,
view.organizationOwner,
view.organizationRole,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface ProjectRepository : JpaRepository<Project, Long> {
companion object {
const val BASE_VIEW_QUERY = """select r.id as id, r.name as name, r.description as description,
r.slug as slug, r.avatarHash as avatarHash,
r.useNamespaces as useNamespaces,
dn as defaultNamespace, o as organizationOwner,
role.type as organizationRole, p as directPermission, r.icuPlaceholders as icuPlaceholders
from Project r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class ProjectService(
project.name = dto.name
project.description = dto.description
project.icuPlaceholders = dto.icuPlaceholders
project.useNamespaces = dto.useNamespaces

if (project.defaultNamespace != null) {
namespaceService.deleteUnusedNamespaces(listOf(project.defaultNamespace!!))
Expand Down
7 changes: 7 additions & 0 deletions backend/data/src/main/resources/db/changelog/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3878,4 +3878,11 @@
<column name="organization_id"/>
</createIndex>
</changeSet>
<changeSet author="stanov (generated)" id="1732537248089-1">
<addColumn tableName="project">
<column defaultValueBoolean="false" name="use_namespaces" type="boolean">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
2 changes: 2 additions & 0 deletions webapp/src/service/apiSchema.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@ export interface components {
slug?: string;
/** Format: int64 */
baseLanguageId?: number;
useNamespaces: boolean;
/** Format: int64 */
defaultNamespaceId?: number;
description?: string;
Expand Down Expand Up @@ -1336,6 +1337,7 @@ export interface components {
avatar?: components["schemas"]["Avatar"];
organizationOwner?: components["schemas"]["SimpleOrganizationModel"];
baseLanguage?: components["schemas"]["LanguageModel"];
useNamespaces: boolean;
defaultNamespace?: components["schemas"]["NamespaceModel"];
organizationRole?: "MEMBER" | "OWNER";
directPermission?: components["schemas"]["PermissionModel"];
Expand Down

0 comments on commit 33c5089

Please sign in to comment.