NAME

App::Dochazka::REST::Model::Interval - activity intervals data model

VERSION

Version 0.080

SYNOPSIS

use App::Dochazka::REST::Model::Interval;

...

DESCRIPTION

A description of the activity interval data model follows.

Intervals in the database

Activity intervals are stored in the intervals database table, which has the following structure:

CREATE TABLE intervals (
   iid         serial PRIMARY KEY,
   eid         integer REFERENCES employees (eid) NOT NULL,
   aid         integer REFERENCES activities (aid) NOT NULL,
   intvl       tsrange NOT NULL,
   long_desc   text,
   remark      text,
   EXCLUDE USING gist (eid WITH =, intvl WITH &&)
);

Note the use of the tsrange operator introduced in PostgreSQL 9.2.

In addition to the Interval ID (iid), which is assigned by PostgreSQL, the Employee ID (eid), and the Activity ID (aid), which are provided by the client, an interval can optionally have a long description (long_desc), which is the employee's description of what she did during the interval, and an admin remark (remark).

Intervals in the Perl API

In the data model, individual activity intervals (records in the intervals table) are represented by "interval objects". All methods and functions for manipulating these objects are contained in this module. The most important methods are:

For basic activity interval workflow, see t/010-interval.t.

EXPORTS

This module provides the following exports:

METHODS

spawn

Constructor. See Employee.pm->spawn for general comments.

reset

Instance method. Resets object, either to its primal state (no arguments) or to the state given in PARAMHASH.

Accessor methods

Basic accessor methods for all the fields of schedintvl table. These functions return whatever value happens to be associated with the object, with no guarantee that it matches the database.

iid

Accessor method.

eid

Accessor method.

aid

Accessor method.

intvl

Accessor method.

long_desc

Accessor method.

remark

Accessor method.

load_by_iid

Instance method. Given an IID, loads a single interval into the object, rewriting whatever was there before. Returns a status object.

insert

Instance method. Attempts to INSERT a record. Field values are taken from the object. Returns a status object.

update

Instance method. Attempts to UPDATE a record. Field values are taken from the object. Returns a status object.

delete

Instance method. Attempts to DELETE a record. Field values are taken from the object. Returns a status object.

AUTHOR

Nathan Cutler, <presnypreklad@gmail.com>