<% /*
    $Revision$
    $Id$

    File:           model_contours.inc

    Description:    CAD contour model.
    Parameters:
    Context:

    Notes:
*/
%>
<!-- #include file="../ALG/alg.inc" -->
<%

model_cadcontours =
{
    table: "cad_imp_contour",
    primary: "cad_imp_contour_key",
    aliasprefix: "CAD.",
    records_name: "cadcontours",
    record_name: "cadcontour",
    fields: {"id"      : { dbs: "cad_imp_contour_key",      typ: "key", filter: "exact" },
             "name"    : { dbs: "cad_imp_contour_nr",       typ: "varchar", filter: "like"  },
             "cadarea" : { dbs: "cad_imp_contour_opp",      typ: "float"  },
             "cadalt1" : { dbs: "cad_imp_contour_opp_alt1", typ: "float"  },
             "cadalt2" : { dbs: "cad_imp_contour.cad_imp_contour_opp_alt2", typ: "float"  },
             "concept" : { dbs: "cad_imp_contour_concept",  typ: "number" }
            },

    _check_authorization: function(params, method)
        {
        },
    _analyze_fields: function (fields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
        {
        },
    REST_GET: function _GET(params, jsondata)
        {
            model_cadcontours._check_authorization(params, "GET");
            var query = api2.sqlfields(params, model_cadcontours);

            var wheres = api2.sqlfilter(params, model_cadcontours);
            query.wheres = query.wheres.concat(wheres);

            var sql = "SELECT " + query.selects.join(", ")
                    + "  FROM " + query.tables.join(", ")
                    + (query.wheres.length ? " WHERE " + query.wheres.join(" AND " ) : "")

            var json = api2.sql2json (params, sql, model_cadcontours);

            return json;
        },
    REST_PUT: function (params, jsondata, the_key) /* update cad contour */
        {
        },
    REST_POST: function (params, jsondata) /* new cad contour */
        {
        },
    REST_DELETE: function (params, the_key) /* delete cad contour */
        {
        }
}
%>