Skip to content

Commit

Permalink
Add active indicator column to tags table (#1154)
Browse files Browse the repository at this point in the history
* add active indicator column to tags table
  • Loading branch information
CollinBeczak authored Oct 23, 2024
1 parent 6ab3acd commit 03d0b13
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/org/maproulette/framework/model/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ case class Tag(
description: Option[String] = None,
created: DateTime = DateTime.now(),
modified: DateTime = DateTime.now(),
tagType: String = "challenges"
tagType: String = "challenges",
active: Boolean = true
) extends CacheObject[Long]

/**
Expand Down
17 changes: 11 additions & 6 deletions app/org/maproulette/framework/repository/TagRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ object TagRepository {
get[Long]("tags.id") ~
get[String]("tags.name") ~
get[Option[String]]("tags.description") ~
get[String]("tags.tag_type") map {
case id ~ name ~ description ~ tagType =>
new Tag(id, name.toLowerCase, description, tagType = tagType)
get[String]("tags.tag_type") ~
get[Boolean]("tags.active") map {
case id ~ name ~ description ~ tagType ~ active =>
new Tag(id, name.toLowerCase, description, tagType = tagType, active = active)
}
}

Expand All @@ -209,9 +210,13 @@ object TagRepository {
get[Long]("tags.id") ~
get[String]("tags.name") ~
get[Option[String]]("tags.description") ~
get[String]("tags.tag_type") map {
case taskId ~ id ~ name ~ description ~ tagType => {
new TaskTag(taskId, new Tag(id, name.toLowerCase, description, tagType = tagType))
get[String]("tags.tag_type") ~
get[Boolean]("tags.active") map {
case taskId ~ id ~ name ~ description ~ tagType ~ active => {
new TaskTag(
taskId,
new Tag(id, name.toLowerCase, description, tagType = tagType, active = active)
)
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions conf/evolutions/default/96.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# --- !Ups
ALTER TABLE IF EXISTS tags
ADD COLUMN active Boolean DEFAULT true;;

# --- !Downs
ALTER TABLE IF EXISTS tags
DROP COLUMN active;;

0 comments on commit 03d0b13

Please sign in to comment.