Skip to content

Commit

Permalink
after week 7, first part
Browse files Browse the repository at this point in the history
  • Loading branch information
Dierk Koenig committed Nov 1, 2019
1 parent 0d76458 commit 421fb0c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ dataSource:
environments:
development:
dataSource:
# logSql: true
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
Expand Down
7 changes: 7 additions & 0 deletions grails-app/controllers/webec/BookingController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@ package webec

class BookingController {

def probiere() {
// find the last names of all people that booked
// room named "1.313"
def booker = Person.findByLastName('Holz')
def result = Booking.findAllByBooker(booker)*.room
render text: result.toString()
}
static scaffold = Booking
}
2 changes: 2 additions & 0 deletions grails-app/domain/webec/Booking.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Booking {
static String PM2 = "15:15 18:00"
static List<String> SLOTS = [AM, PM1, PM2]

String toString() { "$booker.lastName booked room $room.name at $day, slot $slot"}

static constraints = {
slot inList: Booking.SLOTS
}
Expand Down
3 changes: 2 additions & 1 deletion grails-app/init/webec/BootStrap.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package webec

import grails.web.servlet.context.support.GrailsEnvironment
import org.codehaus.groovy.runtime.DateGroovyMethods

class BootStrap {
Expand All @@ -19,7 +20,7 @@ class BootStrap {
new Booking(booker: dierk, room: oben, day: today + i, slot: Booking.AM).save(failOnError:true)
}

new Booking(booker: dierk, room: oben, day: today, slot: Booking.AM).save(failOnError:true)
new Booking(booker: dieter, room: oben, day: today, slot: Booking.AM).save(failOnError:true)

}

Expand Down

0 comments on commit 421fb0c

Please sign in to comment.