Overview
The CommonGrants.Models namespace contains a standard models that are used by CommonGrants API routes.
Models
Section titled “Models”OpportunityA funding opportunity
AwardA grant award resulting from an opportunity
CompetitionA competition for a funding opportunity
ApplicationAn application to a funding opportunity
Applicant TypeThe type of applicant eligible to apply for a funding opportunity
FormA form for a funding opportunity
FormResponseA response to a form
MappingA mapping of a form response to a proposal
ProposalA proposal to a funding opportunity
OrganizationAn organization that can apply to or host funding opportunities
PersonA person affiliated with an organization or grant application
RevisionAn append-only record of a change to a resource, used for org profile syncing
The most common use for the CommonGrants.Models namespace is extending the OpportunityBase model with a set of custom fields. The quickstart has a more in depth tutorial, but here’s a quick example of how you can add support for custom fields:
import "@common-grants/core"
// Exposes the `Fields` and `Models` namespaces so that they can be accessed// without a `CommonGrants` prefixusing CommonGrants;
model Agency extends Fields.CustomField { name: "Agency"; type: Fields.CustomFieldType.string; value: string; description: "The agency managing the funding opportunity.";}
// Create a custom Opportunity type using the templatemodel CustomOpportunity extends Models.OpportunityBase { @example(#{ agency: #{ name: "Agency", type: Fields.CustomFieldType.string, value: "Department of Energy", description: "The agency managing the funding opportunity.", }, }) customFields: { agency: Agency; };}