Skip to content

Commit

Permalink
Merge pull request #15 from therealharsh/master
Browse files Browse the repository at this point in the history
merging tags
  • Loading branch information
neelvk authored Oct 11, 2017
2 parents caa37dc + f06d3d3 commit e3938d8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
14 changes: 14 additions & 0 deletions app/controllers/TagController.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package controllers

import play.api._
import play.api.mvc._
import services.logic.TagHandler._

class TagController extends Controller {

def createTag(name: String) = Action {
val tag = create(name)
Ok("Request completed")
}

}
14 changes: 14 additions & 0 deletions app/services/logic/TagHandler.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package services.logic

import services.model.Tag
import java.util.UUID
import org.joda.time.DateTime

object TagHandler {

def create(name: String): Tag = {
val tag = new Tag(UUID.randomUUID(), name, new DateTime)
return tag
}

}
15 changes: 8 additions & 7 deletions app/services/model/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package services.model

import java.util.UUID

import play.api.libs.json.{Format, Json}

case class Tag(id: UUID, name: String)

object Tag {
implicit val tagFormat: Format[Tag] = Json.format[Tag]
}
import org.joda.time.DateTime

/**
* Created by v723840 on 10/11/17.
*/
case class Tag (id: UUID = UUID.randomUUID(),
name: String,
createdAt: DateTime = new DateTime)
2 changes: 2 additions & 0 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ POST /v1/author controllers.AuthorController.create(name: St
POST /v1/question controllers.QuestionController.create()

GET /v1/question/:id controllers.QuestionController.get(id:java.util.UUID)

POST /v1/tag controllers.TagController.createTag(name: String)

0 comments on commit e3938d8

Please sign in to comment.