Skip to content

Instantly share code, notes, and snippets.

View dubeboy's full-sized avatar
🌞
I may be slow to respond.

Divine Dube dubeboy

🌞
I may be slow to respond.
View GitHub Profile
package za.co.dubedivine.groceryapp.model
import javax.persistence.Entity
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType
import javax.persistence.Id
@Entity
data class GroceryItem(var name: String, var isAvailable: Boolean) {
[
{
"name": "Beans",
"id": 1,
"available": true
},
{
"name": "Eggs",
"id": 2,
"available": false
package za.co.dubedivine.groceryapp.controller
import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("groceries")
class GroceriesController(private val groceryRepository: GroceryItemRepository) {
}
package za.co.dubedivine.groceryapp.controller
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import za.co.dubedivine.groceryapp.model.GroceryItem
import za.co.dubedivine.groceryapp.model.responseModel.StatusResponseEntity
import za.co.dubedivine.groceryapp.repository.GroceryItemRepository
@RestController