Skip to content

Commit

Permalink
Merge branch 'feature/ticket-default' into 'develop'
Browse files Browse the repository at this point in the history
Feature/ticket default

See merge request !130
  • Loading branch information
strassl committed Jan 30, 2017
2 parents 7b627f5 + fb2f76e commit 1669c1b
Show file tree
Hide file tree
Showing 30 changed files with 208 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import javax.persistence.*
@Table(name = "project")
open class Project protected constructor() {
companion object {
fun create(name: String, description: String, creationDate: Date, iconMimeInfo: String?, icon: ByteArray?): Project {
fun create(name: String, description: String, creationDate: Date, iconMimeInfo: String?, icon: ByteArray?, ticketTemplate: String): Project {
val p = Project()
p.id = UUID.randomUUID()
p.name = name
p.description = description
p.ticketTemplate = ticketTemplate
p.disabled = false
p.creationDate = creationDate
p.iconMimeInfo = iconMimeInfo
Expand All @@ -41,6 +42,9 @@ open class Project protected constructor() {
@Column(name = "description", nullable = false)
lateinit open var description: String

@Column(name = "ticket_template", nullable = true)
lateinit open var ticketTemplate: String

@Column(name = "creation_date", nullable = false)
lateinit open var creationDate: Date

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ open class Ticket protected constructor() {
o.parentChangedEventsSrc = mutableListOf()
o.mentionAddedEvents = mutableListOf()
o.mentionRemovedEvents = mutableListOf()
o.kanbanCells = mutableSetOf()
return o
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class ProjectController @Inject constructor(

@PostMapping
open fun createProject(@RequestBody req: CreateProjectRequestJson): ProjectResultJson {
val project = projectService.createProject(CreateProject(req.name, req.description, req.icon))
val project = projectService.createProject(CreateProject(req.name, req.description, req.ticketTemplate, req.icon))
return ProjectResultJson(project)
}

Expand All @@ -73,7 +73,7 @@ open class ProjectController @Inject constructor(
@PutMapping(value = "/{id}")
open fun updateProject(@PathVariable(name = "id") id: UUID,
@RequestBody req: UpdateProjectRequestJson): ProjectResultJson {
val project = projectService.updateProject(id, UpdateProject(req.name, req.description, req.disabled, req.icon))
val project = projectService.updateProject(id, UpdateProject(req.name, req.description, req.ticketTemplate, req.disabled, req.icon))
return ProjectResultJson(project)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ package io.ticktag.restinterface.project.schema
data class CreateProjectRequestJson(
val name: String,
val description: String,
val ticketTemplate: String,
val icon: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class ProjectResultJson(
val id: UUID,
val name: String,
val description: String,
val ticketTemplate: String,
val disabled: Boolean,
val creationDate: Date,
val icon: String?
) {
constructor(p: ProjectResult) : this(id = p.id, name = p.name, description = p.description, disabled = p.disabled, creationDate = p.creationDate, icon = createBase64StringWithMimeInfo(p.iconMimeInfo, p.icon))
constructor(p: ProjectResult) : this(id = p.id, name = p.name, description = p.description, ticketTemplate = p.ticketTemplate,
disabled = p.disabled, creationDate = p.creationDate, icon = createBase64StringWithMimeInfo(p.iconMimeInfo, p.icon))
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package io.ticktag.restinterface.project.schema
data class UpdateProjectRequestJson(
val name: String?,
val description: String?,
val ticketTemplate: String?,
val disabled: Boolean?,
val icon: String?
)
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.ticktag.service.project.dto

import java.util.*
import javax.validation.constraints.Size

data class CreateProject(
@field:Size(min = 3, max = 30) val name: String,
@field:Size(min = 3, max = 255) val description: String,
@field:Size(min = 0, max = 50000) val ticketTemplate: String,
val icon: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ data class ProjectResult(
val id: UUID,
val name: String,
val description: String,
val ticketTemplate: String,
val disabled: Boolean,
val creationDate: Date,
val iconMimeInfo: String?,
val icon: String?

) {
constructor(p: Project) : this(id = p.id, name = p.name, description = p.description, disabled= p.disabled, creationDate = p.creationDate, iconMimeInfo= p.iconMimeInfo, icon = if(p.icon == null) null else Base64.getEncoder().encodeToString(p.icon))
constructor(id: UUID, name: String, description: String, disabled: Boolean, creationDate: Date, iconMimeInfo: String?, icon: ByteArray?) : this(id = id, name = name, description = description, disabled = disabled, creationDate = creationDate, iconMimeInfo= iconMimeInfo, icon = if(icon == null) null else Base64.getEncoder().encodeToString(icon))
constructor(p: Project) : this(id = p.id, name = p.name, description = p.description, ticketTemplate = p.ticketTemplate, disabled= p.disabled, creationDate = p.creationDate, iconMimeInfo= p.iconMimeInfo, icon = if(p.icon == null) null else Base64.getEncoder().encodeToString(p.icon))
constructor(id: UUID, name: String, description: String, ticketTemplate: String, disabled: Boolean, creationDate: Date, iconMimeInfo: String?, icon: ByteArray?) : this(id = id, name = name, description = description, ticketTemplate = ticketTemplate, disabled = disabled, creationDate = creationDate, iconMimeInfo= iconMimeInfo, icon = if(icon == null) null else Base64.getEncoder().encodeToString(icon))
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.ticktag.service.project.dto

import java.util.*
import javax.validation.constraints.Size

data class UpdateProject(
@field:Size(min = 3, max = 30) val name: String?,
@field:Size(min = 3, max = 255) val description: String?,
@field:Size(min = 0, max = 50000) val ticketTemplate: String?,
val disabled: Boolean?,
val icon: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class ProjectServiceImpl @Inject constructor(
iconMimeInfo = tempImg.mimeType
}
val creationDate = Date()
val newProject = Project.create(name, description, creationDate, iconMimeInfo, icon)
val newProject = Project.create(name, description, creationDate, iconMimeInfo, icon, project.ticketTemplate)
projects.insert(newProject)
return ProjectResult(newProject)
}
Expand Down Expand Up @@ -81,6 +81,9 @@ open class ProjectServiceImpl @Inject constructor(
if (project.description != null) {
projectToUpdate.description = project.description
}
if (project.ticketTemplate != null) {
projectToUpdate.ticketTemplate = project.ticketTemplate
}
if (project.disabled != null) {
projectToUpdate.disabled = project.disabled
}
Expand Down
108 changes: 54 additions & 54 deletions backend/src/main/resources/samples.sql

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions backend/src/main/resources/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ BEGIN;


CREATE TABLE IF NOT EXISTS "project" (
"id" UUID PRIMARY KEY,
"name" TEXT NOT NULL,
"description" TEXT NOT NULL,
"creation_date" TIMESTAMP NOT NULL,
"icon_mime_info" TEXT,
"icon" BYTEA,
"disabled" BOOLEAN NOT NULL
"id" UUID PRIMARY KEY,
"name" TEXT NOT NULL,
"description" TEXT NOT NULL,
"creation_date" TIMESTAMP NOT NULL,
"icon_mime_info" TEXT,
"icon" BYTEA,
"ticket_template" TEXT NOT NULL,
"disabled" BOOLEAN NOT NULL
);

CREATE TABLE IF NOT EXISTS "assignment_tag" (
Expand Down
8 changes: 4 additions & 4 deletions backend/src/main/resources/sql/testBaseSamples.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ INSERT INTO public."user" (id, username, mail, name, password_hash, role, curren
--######################################## PROJECT ###################################################################
--####################################################################################################################
INSERT INTO "project" VALUES
('00000000-0002-0000-0000-000000000101', 'Project One', 'Incredible Stuff ', '2016-07-03 08:49:05', NULL, NULL, FALSE),
('00000000-0002-0000-0000-000000000102', 'Project Two', 'Amazing Too', '2016-08-26 21:57:39', NULL, NULL, FALSE),
('00000000-0002-0000-0000-000000000103', 'Project Three', 'Quite Astonishing', '2016-01-17 16:00:33', NULL, NULL, FALSE),
('00000000-0002-0000-0000-000000000104', 'Project Four', 'Pretty Boring', '2016-01-17 16:00:33', NULL, NULL, FALSE);
('00000000-0002-0000-0000-000000000101', 'Project One', 'Incredible Stuff ', '2016-07-03 08:49:05', NULL, NULL, '', FALSE),
('00000000-0002-0000-0000-000000000102', 'Project Two', 'Amazing Too', '2016-08-26 21:57:39', NULL, NULL, '', FALSE),
('00000000-0002-0000-0000-000000000103', 'Project Three', 'Quite Astonishing', '2016-01-17 16:00:33', NULL, NULL, '', FALSE),
('00000000-0002-0000-0000-000000000104', 'Project Four', 'Pretty Boring', '2016-01-17 16:00:33', NULL, NULL, '', FALSE);
--######################################## MEMBERS ###################################################################
--####################################################################################################################
INSERT INTO "member" VALUES
Expand Down
Loading

0 comments on commit 1669c1b

Please sign in to comment.