template

package
v0.0.0-...-0c3f707 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ApacheStyleTemplateID is template ID of the Apache Style
	ApacheStyleTemplateID = "fb4cc144-a76c-4c17-8a52-c648f158fded"
	// ASWFStyleTemplateID is template id for ASWF
	ASWFStyleTemplateID = "18b8ad08-d7d4-4d75-ad25-30bbfffd59cf"
)
View Source
var (
	// ErrTemplateNotFound error
	ErrTemplateNotFound = errors.New("template not found")
)

Functions

func Configure

func Configure(api *operations.ClaAPI, service ServiceInterface, eventsService events.Service)

Configure API call

Types

type CLAGroup

type CLAGroup struct {
}

CLAGroup structure

type DBProjectDocumentModel

type DBProjectDocumentModel struct {
	DocumentName            string `dynamodbav:"document_name"`
	DocumentFileID          string `dynamodbav:"document_file_id"`
	DocumentPreamble        string `dynamodbav:"document_preamble"`
	DocumentLegalEntityName string `dynamodbav:"document_legal_entity_name"`
	DocumentAuthorName      string `dynamodbav:"document_author_name"`
	DocumentContentType     string `dynamodbav:"document_content_type"`
	DocumentS3URL           string `dynamodbav:"document_s3_url"`
	DocumentMajorVersion    string `dynamodbav:"document_major_version"`
	DocumentMinorVersion    string `dynamodbav:"document_minor_version"`
	DocumentCreationDate    string `dynamodbav:"document_creation_date"`
}

DBProjectDocumentModel is a data model for the CLA Group Project documents

type DBProjectModel

type DBProjectModel struct {
	DateCreated                      string                   `dynamodbav:"date_created"`
	DateModified                     string                   `dynamodbav:"date_modified"`
	ProjectExternalID                string                   `dynamodbav:"project_external_id"`
	ProjectID                        string                   `dynamodbav:"project_id"`
	ProjectName                      string                   `dynamodbav:"project_name"`
	Version                          string                   `dynamodbav:"version"`
	ProjectCclaEnabled               bool                     `dynamodbav:"project_ccla_enabled"`
	ProjectCclaRequiresIclaSignature bool                     `dynamodbav:"project_ccla_requires_icla_signature"`
	ProjectIclaEnabled               bool                     `dynamodbav:"project_icla_enabled"`
	ProjectCorporateDocuments        []DBProjectDocumentModel `dynamodbav:"project_corporate_documents"`
	ProjectIndividualDocuments       []DBProjectDocumentModel `dynamodbav:"project_individual_documents"`
	ProjectMemberDocuments           []DBProjectDocumentModel `dynamodbav:"project_member_documents"`
	ProjectACL                       []string                 `dynamodbav:"project_acl"`
}

DBProjectModel data model

type DocumentTab

type DocumentTab struct {
	// Note: these are arranged to optimize structure memory alignment - see the lint: maligned
	DocumentTabType                     string `json:"document_tab_type"`
	DocumentTabID                       string `json:"document_tab_id"`
	DocumentTabName                     string `json:"document_tab_name"`
	DocumentTabAnchorString             string `json:"document_tab_anchor_string"`
	DocumentTabPage                     int64  `json:"document_tab_page"`
	DocumentTabWidth                    int64  `json:"document_tab_width"`
	DocumentTabAnchorXOffset            int64  `json:"document_tab_anchor_x_offset"`
	DocumentTabAnchorYOffset            int64  `json:"document_tab_anchor_y_offset"`
	DocumentTabPositionX                int64  `json:"document_tab_position_x"`
	DocumentTabPositionY                int64  `json:"document_tab_position_y"`
	DocumentTabHeight                   int64  `json:"document_tab_height"`
	DocumentTabIsLocked                 bool   `json:"document_tab_is_locked"`
	DocumentTabIsRequired               bool   `json:"document_tab_is_required"`
	DocumentTabAnchorIgnoreIfNotPresent bool   `json:"document_tab_anchor_ignore_if_not_present"`
}

DocumentTab structure

type DynamoProjectCorporateDocuments

type DynamoProjectCorporateDocuments struct {
	DynamoProjectDocument []DynamoProjectDocument `json:":project_corporate_documents"`
}

DynamoProjectCorporateDocuments model

type DynamoProjectDocument

type DynamoProjectDocument struct {
	DocumentName            string        `json:"document_name"`
	DocumentFileID          string        `json:"document_file_id"`
	DocumentContentType     string        `json:"document_content_type"`
	DocumentMajorVersion    int           `json:"document_major_version"`
	DocumentMinorVersion    int           `json:"document_minor_version"`
	DocumentCreationDate    string        `json:"document_creation_date"`
	DocumentPreamble        string        `json:"document_preamble"`
	DocumentLegalEntityName string        `json:"document_legal_entity_name"`
	DocumentAuthorName      string        `json:"document_author_name"`
	DocumentS3URL           string        `json:"document_s3_url"`
	DocumentTabs            []DocumentTab `json:"document_tabs"`
}

DynamoProjectDocument model

type DynamoProjectIndividualDocuments

type DynamoProjectIndividualDocuments struct {
	DynamoProjectDocument []DynamoProjectDocument `json:":project_individual_documents"`
}

DynamoProjectIndividualDocuments model

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository object/struct

func NewRepository

func NewRepository(awsSession *session.Session, stage string) Repository

NewRepository creates a new instance of the Repository service

func (Repository) CLAGroupTemplateExists

func (r Repository) CLAGroupTemplateExists(ctx context.Context, templateID string) bool

CLAGroupTemplateExists return true if the specified template ID exists, false otherwise

func (Repository) GetCLADocuments

func (r Repository) GetCLADocuments(claGroupID string, claType string) ([]models.ClaGroupDocument, error)

GetCLADocuments fetches the cla documents inside of the CLA Group, it's separate method for perf reasons

func (Repository) GetCLAGroup

func (r Repository) GetCLAGroup(claGroupID string) (*models.ClaGroup, error)

GetCLAGroup This method belongs in the contract group package. We are leaving it here because it accesses DynamoDB, but the contract group Repository is designed to connect to postgres

func (Repository) GetTemplate

func (r Repository) GetTemplate(templateID string) (models.Template, error)

GetTemplate returns the template based on the template ID

func (Repository) GetTemplateName

func (r Repository) GetTemplateName(ctx context.Context, templateID string) (string, error)

GetTemplateName returns the template name when provided the template ID

func (Repository) GetTemplates

func (r Repository) GetTemplates(ctx context.Context) ([]models.Template, error)

GetTemplates returns a list containing all the template models

func (Repository) UpdateDynamoContractGroupTemplates

func (r Repository) UpdateDynamoContractGroupTemplates(ctx context.Context, claGroupID string, template models.Template, pdfUrls models.TemplatePdfs, projectCCLAEnabled, projectICLAEnabled bool) error

UpdateDynamoContractGroupTemplates updates the templates in the data store

type RepositoryInterface

type RepositoryInterface interface {
	GetTemplates(ctx context.Context) ([]models.Template, error)
	GetTemplateName(ctx context.Context, templateID string) (string, error)
	GetTemplate(templateID string) (models.Template, error)
	CLAGroupTemplateExists(ctx context.Context, templateID string) bool
	GetCLAGroup(claGroupID string) (*models.ClaGroup, error)
	GetCLADocuments(claGroupID string, claType string) ([]models.ClaGroupDocument, error)
	UpdateDynamoContractGroupTemplates(ctx context.Context, ContractGroupID string, template models.Template, pdfUrls models.TemplatePdfs, projectCCLAEnabled, projectICLAEnabled bool) error
}

RepositoryInterface interface functions

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service object/struct

func NewService

func NewService(stage string, templateRepo RepositoryInterface, docRaptorClient docraptor.Client, awsSession *session.Session) Service

NewService API call

func (Service) CLAGroupTemplateExists

func (s Service) CLAGroupTemplateExists(ctx context.Context, templateID string) bool

CLAGroupTemplateExists return true if the specified template ID exists, false otherwise

func (Service) CreateCLAGroupTemplate

func (s Service) CreateCLAGroupTemplate(ctx context.Context, claGroupID string, claGroupFields *models.CreateClaGroupTemplate) (models.TemplatePdfs, error)

CreateCLAGroupTemplate service method

func (Service) CreateTemplatePreview

func (s Service) CreateTemplatePreview(ctx context.Context, claGroupFields *models.CreateClaGroupTemplate, templateFor string) ([]byte, error)

CreateTemplatePreview returns a PDF using the specified CLA Group field values and template identifier

func (Service) GetCLATemplatePreview

func (s Service) GetCLATemplatePreview(ctx context.Context, claGroupID, claType string, watermark bool) ([]byte, error)

GetCLATemplatePreview returns a preview of the specified CLA Group and CLA type

func (Service) GetTemplateName

func (s Service) GetTemplateName(ctx context.Context, templateID string) (string, error)

GetTemplateName returns the template name when provided the template ID

func (Service) GetTemplates

func (s Service) GetTemplates(ctx context.Context) ([]models.Template, error)

GetTemplates API call

func (Service) InjectProjectInformationIntoTemplate

func (s Service) InjectProjectInformationIntoTemplate(template models.Template, metaFields []*models.MetaField) (string, string, error)

InjectProjectInformationIntoTemplate service function

func (Service) SaveTemplateToS3

func (s Service) SaveTemplateToS3(bucket, filepath string, template io.ReadCloser) (string, error)

SaveTemplateToS3 uploads the specified template contents to S3 storage

type ServiceInterface

type ServiceInterface interface {
	GetTemplates(ctx context.Context) ([]models.Template, error)
	GetTemplateName(ctx context.Context, templateID string) (string, error)
	CreateCLAGroupTemplate(ctx context.Context, claGroupID string, claGroupFields *models.CreateClaGroupTemplate) (models.TemplatePdfs, error)
	CreateTemplatePreview(ctx context.Context, claGroupFields *models.CreateClaGroupTemplate, templateFor string) ([]byte, error)
	GetCLATemplatePreview(ctx context.Context, claGroupID, claType string, watermark bool) ([]byte, error)
	CLAGroupTemplateExists(ctx context.Context, templateID string) bool
}

ServiceInterface interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL