-
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.
Make possible to reorder tasks manually #14
- Draft implementation with database.
- Loading branch information
Showing
9 changed files
with
74 additions
and
15 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
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/org/motivepick/domain/entity/TasksOrderEntity.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,15 @@ | ||
package org.motivepick.domain.entity | ||
|
||
import com.vladmihalcea.hibernate.type.array.ListArrayType | ||
import org.hibernate.annotations.Type | ||
import org.hibernate.annotations.TypeDef | ||
import javax.persistence.Column | ||
import javax.persistence.Entity | ||
import javax.persistence.FetchType.LAZY | ||
import javax.persistence.JoinColumn | ||
import javax.persistence.ManyToOne | ||
|
||
@Entity(name = "TASKS_ORDER") | ||
@TypeDef(name = "ListArray", typeClass = ListArrayType::class) | ||
class TasksOrderEntity(@ManyToOne(fetch = LAZY) @JoinColumn(name = "USER_ID", nullable = false) var user: User, | ||
@Type(type = "ListArray") @Column(nullable = false, columnDefinition = "BIGINT[]") var orderedIds: List<Long?>) : AbstractEntity() |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/org/motivepick/repository/TasksOrderRepository.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 org.motivepick.repository | ||
|
||
import org.motivepick.domain.entity.TasksOrderEntity | ||
import org.springframework.data.repository.PagingAndSortingRepository | ||
|
||
interface TasksOrderRepository : PagingAndSortingRepository<TasksOrderEntity, Long> { | ||
|
||
fun findByUserAccountId(accountId: String): TasksOrderEntity? | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> | ||
|
||
<changeSet id="202004092347" author="Sergey Yaskov"> | ||
<createTable tableName="TASKS_ORDER"> | ||
<column name="ID" autoIncrement="true" type="BIGINT"> | ||
<constraints primaryKey="true" primaryKeyName="PK__ID__TASKS_ORDER"/> | ||
</column> | ||
|
||
<column name="USER_ID" type="BIGINT"> | ||
<constraints nullable="false" foreignKeyName="FK__TASKS_ORDER__USER_ID__USER_ACCOUNT__ID" | ||
references="USER_ACCOUNT(ID)"/> | ||
</column> | ||
|
||
<column name="ORDERED_IDS" type="BIGINT[]"> | ||
<constraints nullable="false"/> | ||
</column> | ||
</createTable> | ||
</changeSet> | ||
</databaseChangeLog> |
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