# Project

In the 'project.go' file, change the struct and constructor to:

```go
type projectService struct {
	txProvider     database.TxProvider
	repo           repositories.ProjectRepo
	cerberusClient cerberus.CerberusClient
}

func NewProjectService(
	txProvider database.TxProvider,
	repo repositories.ProjectRepo,
	cerberusClient cerberus.CerberusClient) ProjectService {
	return &projectService{
		txProvider:     txProvider,
		repo:           repo,
		cerberusClient: cerberusClient,
	}
}
```

And the 'Create' function:

```go
.
.
.
err = s.cerberusClient.ExecuteWithCtx(ctx, s.cerberusClient.CreateResourceCmd(project.Id, accountId, common.Project_RT))
if err != nil {
	if rbe := tx.Rollback(); rbe != nil {
		err = fmt.Errorf("rollback error (%v) after %w", rbe, err)
	}
	return repositories.Project{}, err
}

return project, tx.Commit()
```

This simply creates a corresponding Project resource on Cerberus every time a project is created.

Because of the way we've set up our policies, new resources under an account will already be included in the account permissions, so you don't have to create default permissions here.

However, you might choose to not have transitive permissions, and thus would be required to create default permissions for every resource created, otherwise it would be inaccessible if you also have controller checks in place.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.a11n.io/tutorial/implementation/backend/services/project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
