Main entities

Go to Studio and create main app classes.

Main app classes

Hall

Create a hall class that defines a room where a movie is shown. Cinema can consist of several halls.

Create string name and description attributes. Check Required and Unique boxes for the name attribute.

Seat

Create a seat class that defines a place for which a ticket is for sale.

Create a required reference hall attribute to bind seat to hall. Check Eager loading box to load hall instance with seat. Create required integer row and column attributes. Add a Unique validator with a filter "hall, row" for the column attribute. This will check the seat uniqueness inside hall and row.

Poster

Create a poster class that defines a movie cover.

Create a required string title attribute. Create a required file file attribute. Add File behavior for the class. This will provide loading and saving of files. Check Image only box. Select title in the Filename attribute field. This will automatically set an uploaded file name to title.

Movie

Create a movie class that defines film characteristics.

Create a required unique string title attribute. Create a text description attribute. Create a required integer duration attribute. It defines the movie length in minutes. Create a reference poster attribute.

Pricing

Create a pricing class defines a ticket price. A hall may have several pricing. You can choose an appropriate pricing when creating a screening. For example, special prices may be set on weekends and holidays or for a new blockbuster.

Create a required string name attribute. Add a Unique validator with a "hall" filter to it. This guarantees the name uniqueness inside a hall. Create a required integer value attribute. This defines ticket price. Create a required reference hall attribute. Check Eager loading box.

Seat price

Create a seatPrice class that defines a special ticket price for a seat. For example, for the first and last rows or places of increased comfort.

Create a required integer value attribute. This defines a ticket price value. Create a required reference seat attribute. This defines a place for which the special price applies. Check Eager loading box.

Create a reference pricing attribute. Check Required, Read only, and Eager loading boxes. Here we see a contradiction in logic. The Required checkbox requires data, and the Read only checkbox prevents receiving client data. Indeed, you cannot directly create an object of the seatPrice class. However, this can be done using a reference attribute of the pricing class, because it passes automatic binding to the owner instance.

Screening

Create a screening class that defines characteristics of a movie demonstration.

Create a date attribute. It defines date and time of a screening. Select Date type and Local date and time view type. The local date is tied to an event place, so users will see the date relative to their time zone.

Create a boolean active attribute. It defines an availability of screening instance for ticket sales. Create required reference movie, hall, pricing attributes. Select Read only box for the hall attribute. This allows you to create screenings only from a hall.

Ticket

Create a ticket class that defines tickets sold.

Create an integer price attribute. It defines a price for which a ticket was sold. Check Read only box. Add an Assigned value behavior. Specify a configuration of expression class {"Class":"component/meta/expression/TicketPriceExpression"} and check On create box. The ticket price is set at the time of creation and remains unchanged in the future.

Create required screening and seat reference attributes. This binds a ticket to seat and screening.

Export metadata and check created entities in the Office module.