

# Service Design Specification
**auteurlabb-projectportfolio-service** documentation
**Version:** `1.0.33`

## Scope

This document provides a structured architectural overview of the `projectPortfolio` microservice, detailing its configuration, data model, authorization logic, business rules, and API design. It has been automatically generated based on the service definition within Mindbricks, ensuring that the information reflects the source of truth used during code generation and deployment.

The document is intended to serve multiple audiences:

* **Service architects** can use it to validate design decisions and ensure alignment with broader architectural goals.
* **Developers and maintainers** will find it useful for understanding the structure and behavior of the service, facilitating easier debugging, feature extension, and integration with other systems.
* **Stakeholders and reviewers** can use it to gain a clear understanding of the service's capabilities and domain logic.

> **Note for Frontend Developers**: While this document is valuable for understanding business logic and data interactions, please refer to the [Service API Documentation](#) for endpoint-level specifications and integration details.

> **Note for Backend Developers**: Since the code for this service is automatically generated by Mindbricks, you typically won't need to implement or modify it manually. However, this document is especially valuable when you're building other services—whether within Mindbricks or externally—that need to interact with or depend on this service. It provides a clear reference to the service's data contracts, business rules, and API structure, helping ensure compatibility and correct integration.



## `ProjectPortfolio` Service Settings

Handles the lifecycle of film projects and access management, allowing filmmakers & studios to submit, update, publish (public/private), withdraw projects, and manage project access for investors/bookmarks. Enforces admin approval & efficient searching/filtering. Connects projects to user (and optionally studio) ownership.

### Service Overview

This service is configured to listen for HTTP requests on port `3001`, 
serving both the main API interface and default administrative endpoints.

The following routes are available by default:

* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`

The service uses a **PostgreSQL** database for data storage, with the database name set to `auteurlabb-projectportfolio-service`.

This service is accessible via the following environment-specific URLs:

* **Preview:** `https://auteurlabb.prw.mindbricks.com/projectportfolio-api`
* **Staging:** `https://auteurlabb-stage.mindbricks.co/projectportfolio-api`
* **Production:** `https://auteurlabb.mindbricks.co/projectportfolio-api`

                                 

### Authentication & Security
- **Login Required**: Yes

This service requires user authentication for access. It supports both JWT and RSA-based authentication mechanisms, ensuring secure user sessions and data integrity.
If a crud route also is configured to require login, 
it will check a valid JWT token in the request query/header/bearer/cookie. If the token is valid, it will extract the user information from the token and make the fetched session data available in the request context.

  
### Service Data Objects
The service uses a **PostgreSQL** database for data storage, with the database name set to `auteurlabb-projectportfolio-service`.

Data deletion is managed using a **soft delete** strategy. Instead of removing records from the database, they are flagged as inactive by setting the `isActive` field to `false`.



| Object Name | Description | Public Access |
|-------------|-------------|---------------|
| `filmProject` | A film project submitted by a filmmaker or studio with all required metadata, visibility, and lifecycle status. | accessPrivate | 
| `accessGrant` | Access grants to private projects, allowing selected users to view restricted projects (requested/granted/revoked/denied). | accessPrivate | 
| `projectBookmark` | User bookmarks/follows for projects. Each bookmark is per user+project. | accessProtected | 
| `investmentOffer` | Tracks investment offers from investors to film projects. Each offer has an amount, optional message, and status workflow (pending/accepted/rejected/withdrawn). | accessPrivate | 
| `userFollow` | Tracks user-to-user follow relationships. A follower follows a target user (filmmaker, studio, investor). | accessProtected | 




## filmProject Data Object

### Object Overview
**Description:** A film project submitted by a filmmaker or studio with all required metadata, visibility, and lifecycle status.

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Enabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessPrivate — If enabled, anonymous users may access this object’s data depending on API-level rules.




### Composite Indexes

- **owner_title_unique**: [ownerUserId, title] 
This composite index is defined to optimize query performance for complex queries involving multiple fields.

The index also defines a conflict resolution strategy for duplicate key violations.

When a new record would violate this composite index, the following action will be taken:

**On Duplicate**: `throwError`

An error will be thrown, preventing the insertion of conflicting data.






### Properties Schema


**Display Label Property:** `title` — This property is the default display label for records of this data object. Relation dropdowns and record references in the frontend will show the value of this property as the human-readable label.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `title` | String | Yes | Project title, unique per owner |
| `description` | Text | Yes | Project description (for details page/fulltext search) |
| `synopsis` | Text | No | Short synopsis or tagline |
| `budget` | Double | Yes | Estimated budget (USD) |
| `cast` | String | No | List of major cast members (names) |
| `genre` | String | No | Project genres/tags |
| `projectType` | Enum | Yes | Origin: filmmaker or studio |
| `ownerUserId` | ID | Yes | User ID of project owner (filmmaker/studio admin) |
| `studioId` | ID | No | (Optional) User ID of the studio (for studio projects) |
| `isPublic` | Boolean | Yes | Project public visibility flag |
| `approvalStatus` | Enum | Yes | Project approval/publication workflow status |
| `mediaUrls` | String | No | Project demo reel/trailer/cover media URLs |
| `featured` | Boolean | No | Platform feature flag (for promoted projects) |
| `publishedAt` | Date | No | Publication date |
| `accessPolicy` | Enum | Yes | Access policy (open: any authorized user, restricted: need grant) |
| `director` | String | No | Director of the film project |
| `fundingGoal` | Double | No | Funding goal amount (USD) |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.


### Array Properties 

`cast` `genre` `mediaUrls`

Array properties can hold multiple values and are indicated by the `[]` suffix in their type. Avoid using arrays in properties that are used for relations, as they will not work correctly.
Note that using connection objects instead of arrays is recommended for relations, as they provide better performance and flexibility.


### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **title**: 'default'
- **description**: 'text'
- **budget**: 0.0
- **projectType**: filmmaker
- **ownerUserId**: '00000000-0000-0000-0000-000000000000'
- **approvalStatus**: pending
- **accessPolicy**: open

### Always Create with Default Values
Some of the default values are set to be always used when creating a new object, even if the property value is provided in the request body. It ensures that the property is always initialized with a default value when the object is created.

- **approvalStatus**: Will be created with value `pending`


### Constant Properties

`projectType` `ownerUserId` `studioId`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


### Auto Update Properties

`title` `description` `synopsis` `budget` `cast` `genre` `isPublic` `approvalStatus` `mediaUrls` `featured` `publishedAt` `accessPolicy` `director` `fundingGoal`

An update crud API created with the option `Auto Params` enabled will automatically update these properties with the provided values in the request body. 
If you want to update any property in your own business logic not by user input, you can set the `Allow Auto Update` option to false.
These properties will be added to the update API's body parameters and can be updated by the user if any value is provided in the request body.

 


### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an addtional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the index property to sort by the enum value or when your enum options represent a sequence of values.

- **projectType**: [filmmaker, studio]

- **approvalStatus**: [pending, approved, rejected, withdrawn]

- **accessPolicy**: [open, restricted]


 

 

### Elastic Search Indexing

`title` `description` `synopsis` `budget` `cast` `genre` `projectType` `ownerUserId` `studioId` `isPublic` `approvalStatus` `mediaUrls` `featured` `publishedAt` `accessPolicy` `director` `fundingGoal`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`title` `budget` `projectType` `ownerUserId` `studioId` `isPublic` `approvalStatus` `featured` `publishedAt` `accessPolicy` `fundingGoal`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.





### Secondary Key Properties

`ownerUserId`

Secondary key properties are used to create an additional indexed identifiers for the data object, allowing for alternative access patterns.
Different than normal indexed properties, secondary keys will act as primary keys and Mindbricks will provide automatic secondary key db utility functions to access the data object by the secondary key.


### Relation Properties

`ownerUserId` `studioId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
You can define relations in the data object properties, which will be used to create foreign key constraints in the database.
For complex joins operations, Mindbricks supportsa BFF pattern, where you can view dynamic and static views based on Elastic Search Indexes.
Use db level relations for simple one-to-one or one-to-many relationships, and use BFF views for complex joins that require multiple data objects to be joined together.

- **ownerUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes

- **studioId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: No


### Session Data Properties

`ownerUserId`

Session data properties are used to store data that is specific to the user session, allowing for personalized experiences and temporary data storage.
If a property is configured as session data, it will be automatically mapped to the related field in the user session during CRUD operations.
Note that session data properties can not be mutated by the user, but only by the system.

- **ownerUserId**: ID property will be mapped to the session parameter `userId`.

This property is also used to store the owner of the session data, allowing for ownership checks and access control.





### Filter Properties

`title` `description` `synopsis` `budget` `genre` `projectType` `isPublic` `approvalStatus` `featured` `accessPolicy` `director` `fundingGoal`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **title**: String  has a filter named `title`

- **description**: Text  has a filter named `description`

- **synopsis**: Text  has a filter named `synopsis`

- **budget**: Double  has a filter named `budget`

- **genre**: String  has a filter named `genre`

- **projectType**: Enum  has a filter named `projectType`

- **isPublic**: Boolean  has a filter named `isPublic`

- **approvalStatus**: Enum  has a filter named `approvalStatus`

- **featured**: Boolean  has a filter named `featured`

- **accessPolicy**: Enum  has a filter named `accessPolicy`

- **director**: String  has a filter named `director`

- **fundingGoal**: Double  has a filter named `fundingGoal`





## accessGrant Data Object

### Object Overview
**Description:** Access grants to private projects, allowing selected users to view restricted projects (requested/granted/revoked/denied).

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Enabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessPrivate — If enabled, anonymous users may access this object’s data depending on API-level rules.




### Composite Indexes

- **project_user_unique**: [projectId, granteeUserId] 
This composite index is defined to optimize query performance for complex queries involving multiple fields.

The index also defines a conflict resolution strategy for duplicate key violations.

When a new record would violate this composite index, the following action will be taken:

**On Duplicate**: `throwError`

An error will be thrown, preventing the insertion of conflicting data.






### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `projectId` | ID | Yes | Film project ID for which access is granted/requested |
| `granteeUserId` | ID | Yes | ID of user being granted/requesting access |
| `grantedByUserId` | ID | No | Who granted/revoked the access (or null for self-request) |
| `status` | Enum | Yes | requested (pending); granted (success); revoked; denied |
| `requestMessage` | Text | No | Message from requester (for context) |
| `dateGranted` | Date | No | Timestamp when access status last updated |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **projectId**: '00000000-0000-0000-0000-000000000000'
- **granteeUserId**: '00000000-0000-0000-0000-000000000000'
- **status**: requested


### Constant Properties

`projectId` `granteeUserId` `grantedByUserId`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


### Auto Update Properties

`status` `requestMessage` `dateGranted`

An update crud API created with the option `Auto Params` enabled will automatically update these properties with the provided values in the request body. 
If you want to update any property in your own business logic not by user input, you can set the `Allow Auto Update` option to false.
These properties will be added to the update API's body parameters and can be updated by the user if any value is provided in the request body.

 


### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an addtional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the index property to sort by the enum value or when your enum options represent a sequence of values.

- **status**: [requested, granted, revoked, denied]


 

 

### Elastic Search Indexing

`projectId` `granteeUserId` `grantedByUserId` `status` `dateGranted`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`projectId` `granteeUserId` `grantedByUserId` `status` `dateGranted`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.





### Secondary Key Properties

`projectId` `granteeUserId`

Secondary key properties are used to create an additional indexed identifiers for the data object, allowing for alternative access patterns.
Different than normal indexed properties, secondary keys will act as primary keys and Mindbricks will provide automatic secondary key db utility functions to access the data object by the secondary key.


### Relation Properties

`projectId` `granteeUserId` `grantedByUserId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
You can define relations in the data object properties, which will be used to create foreign key constraints in the database.
For complex joins operations, Mindbricks supportsa BFF pattern, where you can view dynamic and static views based on Elastic Search Indexes.
Use db level relations for simple one-to-one or one-to-many relationships, and use BFF views for complex joins that require multiple data objects to be joined together.

- **projectId**: ID
Relation to `filmProject`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes

- **granteeUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes

- **grantedByUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: No





### Filter Properties

`projectId` `granteeUserId` `status`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **projectId**: ID  has a filter named `projectId`

- **granteeUserId**: ID  has a filter named `granteeUserId`

- **status**: Enum  has a filter named `status`





## projectBookmark Data Object

### Object Overview
**Description:** User bookmarks/follows for projects. Each bookmark is per user+project.

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Disabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessProtected — If enabled, anonymous users may access this object’s data depending on API-level rules.




### Composite Indexes

- **bookmark_unique**: [projectId, userId] 
This composite index is defined to optimize query performance for complex queries involving multiple fields.

The index also defines a conflict resolution strategy for duplicate key violations.

When a new record would violate this composite index, the following action will be taken:

**On Duplicate**: `throwError`

An error will be thrown, preventing the insertion of conflicting data.






### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `projectId` | ID | Yes | The project being bookmarked |
| `userId` | ID | Yes | The user who bookmarked this project |
| `createdAtBookmark` | Date | No | When bookmark was made |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **projectId**: '00000000-0000-0000-0000-000000000000'
- **userId**: '00000000-0000-0000-0000-000000000000'


### Constant Properties

`projectId` `userId` `createdAtBookmark`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


 



 

 

### Elastic Search Indexing

`projectId` `userId` `createdAtBookmark`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`projectId` `userId` `createdAtBookmark`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.





### Secondary Key Properties

`projectId` `userId`

Secondary key properties are used to create an additional indexed identifiers for the data object, allowing for alternative access patterns.
Different than normal indexed properties, secondary keys will act as primary keys and Mindbricks will provide automatic secondary key db utility functions to access the data object by the secondary key.


### Relation Properties

`projectId` `userId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
You can define relations in the data object properties, which will be used to create foreign key constraints in the database.
For complex joins operations, Mindbricks supportsa BFF pattern, where you can view dynamic and static views based on Elastic Search Indexes.
Use db level relations for simple one-to-one or one-to-many relationships, and use BFF views for complex joins that require multiple data objects to be joined together.

- **projectId**: ID
Relation to `filmProject`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes

- **userId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes


### Session Data Properties

`userId`

Session data properties are used to store data that is specific to the user session, allowing for personalized experiences and temporary data storage.
If a property is configured as session data, it will be automatically mapped to the related field in the user session during CRUD operations.
Note that session data properties can not be mutated by the user, but only by the system.

- **userId**: ID property will be mapped to the session parameter `userId`.

This property is also used to store the owner of the session data, allowing for ownership checks and access control.



### Context Data Properties

`createdAtBookmark`

Context data properties are used to store data that is specific to the request context, allowing for dynamic data retrieval based on the current request.
If a property is configured as context data, it will be automatically mapped to the related field in the request context during CRUD operations.

- **createdAtBookmark**: Date property will be mapped to the context parameter `createdAt`.


### Formula Properties

`createdAtBookmark`

Formula properties are used to define calculated fields that derive their values from other properties or external data.
These properties are automatically calculated based on the defined formula and can be used for dynamic data retrieval.

- **createdAtBookmark**: Date  
  - Formula: ``
  
  - Calculate After Instance: No
  


### Filter Properties

`projectId` `userId`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **projectId**: ID  has a filter named `projectId`

- **userId**: ID  has a filter named `userId`





## investmentOffer Data Object

### Object Overview
**Description:** Tracks investment offers from investors to film projects. Each offer has an amount, optional message, and status workflow (pending/accepted/rejected/withdrawn).

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Enabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessPrivate — If enabled, anonymous users may access this object’s data depending on API-level rules.




### Composite Indexes

- **investor_project_unique**: [projectId, investorUserId] 
This composite index is defined to optimize query performance for complex queries involving multiple fields.

The index also defines a conflict resolution strategy for duplicate key violations.

When a new record would violate this composite index, the following action will be taken:

**On Duplicate**: `throwError`

An error will be thrown, preventing the insertion of conflicting data.






### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `projectId` | ID | Yes | Film project receiving the investment offer |
| `investorUserId` | ID | Yes | Investor who made the offer |
| `offerAmount` | Double | Yes | Investment amount in USD |
| `message` | Text | No | Cover letter or terms from the investor |
| `status` | Enum | No | Offer lifecycle status |
| `respondedAt` | Date | No | When the project owner responded |
| `responseNote` | Text | No | Project owner note on accept/reject |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **projectId**: '00000000-0000-0000-0000-000000000000'
- **investorUserId**: '00000000-0000-0000-0000-000000000000'
- **offerAmount**: 0.0
- **status**: pending

### Always Create with Default Values
Some of the default values are set to be always used when creating a new object, even if the property value is provided in the request body. It ensures that the property is always initialized with a default value when the object is created.

- **status**: Will be created with value `pending`


### Constant Properties

`projectId` `investorUserId`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


### Auto Update Properties

`offerAmount` `message` `status` `respondedAt` `responseNote`

An update crud API created with the option `Auto Params` enabled will automatically update these properties with the provided values in the request body. 
If you want to update any property in your own business logic not by user input, you can set the `Allow Auto Update` option to false.
These properties will be added to the update API's body parameters and can be updated by the user if any value is provided in the request body.

 


### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an addtional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the index property to sort by the enum value or when your enum options represent a sequence of values.

- **status**: [pending, accepted, rejected, withdrawn]


 

 

### Elastic Search Indexing

`projectId` `investorUserId` `offerAmount` `status`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`projectId` `investorUserId` `offerAmount` `status`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.





### Secondary Key Properties

`projectId` `investorUserId`

Secondary key properties are used to create an additional indexed identifiers for the data object, allowing for alternative access patterns.
Different than normal indexed properties, secondary keys will act as primary keys and Mindbricks will provide automatic secondary key db utility functions to access the data object by the secondary key.


### Relation Properties

`projectId` `investorUserId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
You can define relations in the data object properties, which will be used to create foreign key constraints in the database.
For complex joins operations, Mindbricks supportsa BFF pattern, where you can view dynamic and static views based on Elastic Search Indexes.
Use db level relations for simple one-to-one or one-to-many relationships, and use BFF views for complex joins that require multiple data objects to be joined together.

- **projectId**: ID
Relation to `filmProject`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes

- **investorUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes


### Session Data Properties

`investorUserId`

Session data properties are used to store data that is specific to the user session, allowing for personalized experiences and temporary data storage.
If a property is configured as session data, it will be automatically mapped to the related field in the user session during CRUD operations.
Note that session data properties can not be mutated by the user, but only by the system.

- **investorUserId**: ID property will be mapped to the session parameter `userId`.

This property is also used to store the owner of the session data, allowing for ownership checks and access control.





### Filter Properties

`projectId` `investorUserId` `offerAmount` `status`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **projectId**: ID  has a filter named `projectId`

- **investorUserId**: ID  has a filter named `investorUserId`

- **offerAmount**: Double  has a filter named `offerAmount`

- **status**: Enum  has a filter named `status`





## userFollow Data Object

### Object Overview
**Description:** Tracks user-to-user follow relationships. A follower follows a target user (filmmaker, studio, investor).

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Enabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessProtected — If enabled, anonymous users may access this object’s data depending on API-level rules.




### Composite Indexes

- **follower_target_unique**: [followerUserId, followingUserId] 
This composite index is defined to optimize query performance for complex queries involving multiple fields.

The index also defines a conflict resolution strategy for duplicate key violations.

When a new record would violate this composite index, the following action will be taken:

**On Duplicate**: `throwError`

An error will be thrown, preventing the insertion of conflicting data.






### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `followerUserId` | ID | Yes | The user who is following |
| `followingUserId` | ID | Yes | The user being followed |
| `followedAt` | Date | No | When the follow relationship was created |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **followerUserId**: '00000000-0000-0000-0000-000000000000'
- **followingUserId**: '00000000-0000-0000-0000-000000000000'


### Constant Properties

`followerUserId` `followingUserId` `followedAt`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


 



 

 

### Elastic Search Indexing

`followerUserId` `followingUserId` `followedAt`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`followerUserId` `followingUserId` `followedAt`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.





### Secondary Key Properties

`followerUserId` `followingUserId`

Secondary key properties are used to create an additional indexed identifiers for the data object, allowing for alternative access patterns.
Different than normal indexed properties, secondary keys will act as primary keys and Mindbricks will provide automatic secondary key db utility functions to access the data object by the secondary key.


### Relation Properties

`followerUserId` `followingUserId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
You can define relations in the data object properties, which will be used to create foreign key constraints in the database.
For complex joins operations, Mindbricks supportsa BFF pattern, where you can view dynamic and static views based on Elastic Search Indexes.
Use db level relations for simple one-to-one or one-to-many relationships, and use BFF views for complex joins that require multiple data objects to be joined together.

- **followerUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes

- **followingUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

On Delete: Set Null
Required: Yes


### Session Data Properties

`followerUserId`

Session data properties are used to store data that is specific to the user session, allowing for personalized experiences and temporary data storage.
If a property is configured as session data, it will be automatically mapped to the related field in the user session during CRUD operations.
Note that session data properties can not be mutated by the user, but only by the system.

- **followerUserId**: ID property will be mapped to the session parameter `userId`.

This property is also used to store the owner of the session data, allowing for ownership checks and access control.





### Filter Properties

`followerUserId` `followingUserId`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **followerUserId**: ID  has a filter named `followerUserId`

- **followingUserId**: ID  has a filter named `followingUserId`







## Business Logic



projectPortfolio has got 18 Business APIs to manage its internal and crud logic. 
For the details of each business API refer to its chapter.

* [Create Filmproject](/businessLogic/createfilmproject)

* [Update Filmproject](/businessLogic/updatefilmproject)

* [Get Filmproject](/businessLogic/getfilmproject)

* [List Filmprojects](/businessLogic/listfilmprojects)

* [Create Accessgrant](/businessLogic/createaccessgrant)

* [Update Accessgrant](/businessLogic/updateaccessgrant)

* [Get Accessgrant](/businessLogic/getaccessgrant)

* [List Accessgrants](/businessLogic/listaccessgrants)

* [Create Bookmark](/businessLogic/createbookmark)

* [Delete Bookmark](/businessLogic/deletebookmark)

* [List Bookmarks](/businessLogic/listbookmarks)

* [Create Investmentoffer](/businessLogic/createinvestmentoffer)

* [Respond Toinvestmentoffer](/businessLogic/respondtoinvestmentoffer)

* [List Investmentoffers](/businessLogic/listinvestmentoffers)

* [Withdraw Investmentoffer](/businessLogic/withdrawinvestmentoffer)

* [Follow User](/businessLogic/followuser)

* [Unfollow User](/businessLogic/unfollowuser)

* [List Userfollows](/businessLogic/listuserfollows)


















## Service Library


### Functions

#### isUserGrantedAccess.js
```js
const { fetchRemoteObjectByMQuery } = require('serviceCommon');
module.exports = async function isUserGrantedAccess(projectId, userId) {
  if(!projectId || !userId) return false;
  const grant = await fetchRemoteObjectByMQuery('accessGrant', { projectId, granteeUserId: userId, status: 'granted' });
  return !!grant;
};
```

#### listProjectIdsGrantedToUser.js
```js
const { fetchRemoteListByMQuery } = require('serviceCommon');
module.exports = async function listProjectIdsGrantedToUser(userId) {
  if(!userId) return [];
  const grants = await fetchRemoteListByMQuery('accessGrant', { granteeUserId: userId, status: 'granted' }, 0, 1000);
  return grants.map(g=>g.projectId);
};
```












---

*This document was generated from the service architecture definition and should be kept in sync with implementation changes.*