Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Controller("thing")
- @VirtualAction("new", "create", Protect(Role("admin")))
- @VirtualAction("edit", "update", Protect(OwnerRelation))
- class ThingController : ApplicationController {
- @Action
- @Protect(Role("admin"))
- void create ( Request req, Response res ) {...}
- @Action
- void index ( Request req, Response res ) {...}
- @Action
- @Protect(Role("member"))
- void show ( Request req, Response res ) {...}
- @Action
- @Protect(OwnerRelation)
- void update ( Request req, Response res ) {...}
- @Action("delete")
- @Protect(Role("admin"))
- void remove ( Request req, Response res ) {...}
- }
- @Model("thing")
- @ForbidMassAssignment
- class Thing : Model {
- @Attr
- @Shallow
- @Validate(Present, Unique, Length("<=", 128))
- A!string name;
- @Attr
- @Shallow
- @Validate(Length("[]", 16, 256))
- A!string description;
- @Attr(BelongsTo, User)
- @Shallow
- @Validate(Present)
- A!User user;
- @Attr(HasMany, Tag, Through(Tagging))
- @Validate(NoDuplicate)
- A!(Tagging[]) tags;
- @Attr
- @Validate(Present)
- A!ulong size;
- @Attr
- @Validate(Present)
- A!ulong weight;
- @property
- ulong ratio () {...}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement