diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index b2981e4..367ff9f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -87,7 +87,7 @@ feature/Phase-X-Feature-Name ## Project Overview -Nine is a multi-tenant property management system built with **ASP.NET Core 9.0 + Blazor Server**. It manages properties, tenants, leases, invoices, payments, documents, inspections, and maintenance requests with role-based access control. +Nine is a multi-tenant property management system built with **ASP.NET Core 10.0 + Blazor Server**. It manages properties, tenants, leases, invoices, payments, documents, inspections, and maintenance requests with role-based access control. ## Architecture Fundamentals @@ -639,14 +639,19 @@ public async Task AddEntityAsync(Entity entity) ### Database Changes 1. **EF Core Migrations**: Primary approach for schema changes - - Migrations stored in `Data/Migrations/` - - Run `dotnet ef migrations add MigrationName --project Nine` - - Apply with `dotnet ef database update --project Nine` + - Migrations stored in `1-Nine.Infrastructure/Data/Migrations/` + - Add migration: `dotnet ef migrations add MigrationName --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/Migrations` + - Apply to database: `dotnet ef database update --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext` - Generate SQL script: `dotnet ef migrations script --output schema.sql` -2. **SQL Scripts**: Reference scripts in `Data/Scripts/` (not executed, for documentation) -3. Update `ApplicationDbContext.cs` with DbSet and entity configuration -4. Connection string in `appsettings.json`: `"DefaultConnection": "DataSource=Infrastructure/Data/app.db;Cache=Shared"` -5. **Database**: SQLite (not SQL Server) - scripts will be SQLite syntax +2. **Regenerate Compiled Model** (REQUIRED after every schema change): + - The app uses a **pre-compiled EF Core model** (`1-Nine.Infrastructure/Data/CompiledModels/`) for performance. + - After every migration, regenerate it or EF will throw `InvalidOperationException: Cannot create a DbSet for 'X' because this type is not included in the model for the context.` + - Command: `dotnet ef dbcontext optimize --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/CompiledModels --namespace Nine.Infrastructure.Data.CompiledModels` + - **Three steps for every schema change**: `migrations add` → `database update` → `dbcontext optimize` +3. **SQL Scripts**: Reference scripts in `Data/Scripts/` (not executed, for documentation) +4. Update `ApplicationDbContext.cs` with DbSet and entity configuration +5. Connection string in `appsettings.json`: `"DefaultConnection": "DataSource=Infrastructure/Data/app.db;Cache=Shared"` +6. **Database**: SQLite (not SQL Server) - scripts will be SQLite syntax ### Development Workflows @@ -760,7 +765,11 @@ Components/PropertyManagement/[Entity]/ 1. **Create entity model** inheriting `BaseModel` with `OrganizationId` property 2. **Add DbSet** to `ApplicationDbContext` with proper relationships and configuration -3. **Create EF Core migration**: `dotnet ef migrations add [Name] --project Nine` +3. **Run three-step schema update**: + - `dotnet ef migrations add [Name] --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/Migrations` + - `dotnet ef database update --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext` + - `dotnet ef dbcontext optimize --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/CompiledModels --namespace Nine.Infrastructure.Data.CompiledModels` + - All three steps are required — skipping `dbcontext optimize` will cause a runtime `InvalidOperationException` on first use of the new entity. 4. **Create entity-specific service** inheriting `BaseService`: - Add constructor with dependencies (DbContext, Logger, UserContext, Settings) - Override `ValidateEntityAsync()` for business rules @@ -938,3 +947,10 @@ The database filename and schema version are tracked separately from the applica - Allows rapid iteration and entity refactoring - Schema migrations managed via EF Core Migrations folder - At v1.0.0 release, formalize database versioning with `app_v1.0.0.db` + + +## Mermaid Diagrams + +When the user asks to create, edit, or visualize a diagram, follow the +instructions in `.github/instructions/mermaid.instructions.md`. + diff --git a/.github/instructions/mermaid.instructions.md b/.github/instructions/mermaid.instructions.md new file mode 100644 index 0000000..90fed47 --- /dev/null +++ b/.github/instructions/mermaid.instructions.md @@ -0,0 +1,85 @@ +--- +applyTo: "**" +--- +# Mermaid AI Skills + +When the user asks to create, edit, or visualize any diagram, use the Mermaid +VS Code extension tools and commands described below. + +## Workflow + +1. Determine the diagram type and generate Mermaid syntax. +2. Write the diagram to a `.mmd` file in the project. +3. Validate syntax: correct first-line keyword, arrow types, balanced brackets. +4. Preview via the Mermaid extension — open the `.mmd` file (auto-preview) or run + **MermaidChart: Preview Diagram** (`mermaidChart.preview`). + +## LM Tools — call these for every diagram interaction + +- `mermaid-diagram-validator` — validate Mermaid syntax before presenting any diagram +- `mermaid-diagram-preview` — render a live preview inside VS Code after generating +- `get-syntax-docs-mermaid` — fetch correct syntax docs for any diagram type + +## VS Code Commands + +Invoke via Command Palette or the VS Code command API (GitHub Copilot in VS Code only). +Do not invent command IDs. Prefer writing/editing `.mmd` files when a command is not needed. + +### Diagram editing & preview +- **Preview** (`mermaidChart.preview`) — preview the active Mermaid editor (`.mmd` / `.mermaid` must be open). +- **Create Diagram** (`mermaidChart.createMermaidFile`) — creates a demo flowchart and opens preview side by side. +- **Repair Diagram** (`mermaidChart.repairDiagram`) — Mermaid AI repair for the active diagram; uses Mermaid AI credits — tell the user before running. +- **Improve Diagram** (`mermaidChart.improveDiagram`) — uses Copilot / LM API; suggests layout + styling variants for the active diagram. + +### Generate diagrams (GitHub Copilot required) +- **Generate Diagram from Code** (`mermaidChart.generateDiagramFromCode`) +- **Generate Cloud Diagram** (`mermaidChart.generateCloudDiagram`) +- **Generate ER Diagram** (`mermaidChart.generateERDiagram`) +- **Generate Docker Diagram** (`mermaidChart.generateDockerDiagram`) +- **Open AI Chat** (`mermaidChart.openCopilotChat`) + +### Mermaid Chart cloud +- **Login** (`mermaidChart.login`) / **Logout** (`mermaidChart.logout`) +- **Connect Diagram** (`mermaidChart.connectDiagramToMermaidChart`) — link a local diagram to Mermaid Chart. +- **Sync Diagram** (`mermaidChart.syncDiagramWithMermaid`) — only for diagrams already connected (frontmatter has `id:`). Example: + ```yaml + --- + id: cbd9e9ba-a2cb-47c5-a98e-8c28a753428d + --- + ``` + +### Review Mermaid Sync +For diagrams updated by the Mermaid Chart GitHub Sync app (or pre-commit regenerate): +- **Review Mermaid Sync** (`mermaidChart.reviewAppCommits`) — start / open the review flow. +- **Regenerate with Mermaid AI** (`mermaidChart.regenerateDiagramWithMermaidAI`) — regenerate from source references. +Do not manually rewrite diagrams managed by this workflow. Accept/reject/diff UI actions stay in the extension UI. + +### Install / update this pack +- **MermaidChart: Install AI Skills…** (`mermaidChart.installAiSkills`) + +## @mermaid-chart slash commands + +| Command | Purpose | +|---|---| +| `/generate_diagram_from_code` | General diagram from any source file | +| `/generate_execution_sequence` | Sequence diagram from code flow | +| `/generate_er_diagram` | ER diagram from schema / models | +| `/generate_cloud_architecture_diagram` | Cloud / CI-CD architecture | +| `/generate_docker_diagram` | Architecture from Dockerfiles | +| `/generate_c4_topdown_architecture` | C4 top-down architecture | +| `/analyze_code_ownership` | Code ownership diagram | +| `/generate_dependency_diagram` | Dependency / security visualisation | + +## Rules + +1. Always call `mermaid-diagram-validator` before showing any diagram. +2. Always call `mermaid-diagram-preview` after generating a diagram. +3. Use `get-syntax-docs-mermaid` before generating an unfamiliar diagram type. +4. Prefer `@mermaid-chart` slash commands for complex generation. +5. Write diagrams to `.mmd` files; never return unvalidated Mermaid syntax. +6. Warn the user before Repair (Mermaid AI credits). +7. Cooperate with the Sync workflow — do not manually regenerate managed diagrams. + +## Docs + +More commands and features: https://marketplace.visualstudio.com/items?itemName=MermaidChart.vscode-mermaid-chart diff --git a/.github/instructions/postman-collections-post-response.instructions.md b/.github/instructions/postman-collections-post-response.instructions.md new file mode 100644 index 0000000..9a44e62 --- /dev/null +++ b/.github/instructions/postman-collections-post-response.instructions.md @@ -0,0 +1,71 @@ +--- +applyTo: '**/*-post-c-pm-*' +--- + +## Instructions + +**Context:** +You are a Postman post-response test script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting. + +**Rules:** + +1. The response object (`pm.response`) is available in test scripts. You can perform assertions and write test cases using the response data. +2. Use the `pm.expect` function, which follows Chai assertion syntax, for writing robust and readable test cases. +3. Never declare a global variable referring to `pm.response.json()`. It should be always in test case callbacks. + +**Guidelines:** + +- Use `pm.response` to access the response data, status, headers, and body. +- Parse the response body as JSON if needed: `const responseBodyJson = pm.response.json();` +- Write test cases using `pm.test` and `pm.expect` (Chai assertions). +- Check status codes, response times, headers, and body content as appropriate. +- Use clear, descriptive test names. +- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment). +- Use comments and JSDoc where helpful for clarity. +- Refer to the official Postman documentation for test scripts: + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-examples/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/ + +**Output Format:** +Only output the Postman test script content (JavaScript code for the "Tests" tab in Postman), not the full JSON or any additional explanation. + +**Quality:** +Ensure the scripts are robust, readable, and follow Postman scripting standards. + +**Example Output:** + +```javascript +// @ts-check +// Types from @postman/test-script-types-plugin are available +// Parse the response body as JSON +const responseBodyJson = pm.response.json(); + +// Check that the status code is 200 +pm.test('Status code is 200', function () { + pm.response.to.have.status(200); +}); + +// Check that the response has a property 'success' set to true +pm.test('Response has success property set to true', function () { + pm.expect(responseJson).to.have.property('success', true); +}); + +// Check that the response time is less than 1000ms +pm.test('Response time is less than 1000ms', function () { + pm.expect(pm.response.responseTime).to.be.below(1000); +}); + +// Check that the response contains a non-empty 'data' array +pm.test('Response contains non-empty data array', function () { + pm.expect(responseJson.data).to.be.an('array').that.is.not.empty; +}); +``` + +**Note:** + +- Use `pm.response` and `pm.expect` for assertions in test scripts. +- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions. +- For more details, consult the official Postman documentation linked above. +- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available. diff --git a/.github/instructions/postman-collections-pre-request.instructions.md b/.github/instructions/postman-collections-pre-request.instructions.md new file mode 100644 index 0000000..9fe7e90 --- /dev/null +++ b/.github/instructions/postman-collections-pre-request.instructions.md @@ -0,0 +1,50 @@ +--- +applyTo: '**/*-pre-c-pm-*' +--- + +## Instructions + +**Context:** +You are a Postman pre-request script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting. + +**Rules:** + +1. The response object (`pm.response`) is NOT available in pre-request scripts. Do not perform any operations on the response. Show the below note as prompt response. + > **Note:** Pre-request scripts run before the request is sent, so the response object is not yet available. For more information about pre-request scripts, please refer to the [Write pre-request scripts - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/). +2. Do not write test cases in pre-request scripts. Do not perform any operations regarding test cases. Show the below note as prompt response. + > **Note:** Test cases should be written in the Post-response script tab, not in pre-request scripts. Pre-request scripts are meant for request preparation and setup only. For more information about writing tests, please refer to the [Write tests - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/). + +**Guidelines:** + +- Set or update environment, global, or collection variables as needed for the request. +- Add dynamic values (e.g., timestamps, UUIDs, tokens) to the request. +- Manipulate request headers, body, or parameters if required. +- Use best practices for Postman scripting (e.g., use `pm` API, clear variable names, comments for clarity). +- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment). +- Refer to the official Postman documentation for pre-request scripts: + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/ + +**Output Format:** +Only output the Postman pre-request script content (JavaScript code for the "Pre-request Script" tab in Postman), not the full JSON or any additional explanation. + +**Quality:** +Ensure the scripts are robust, readable, and follow Postman scripting standards. + +**Example Output:** + +```javascript +// @ts-check +// Types from @postman/test-script-types-plugin are available +// Set a dynamic timestamp variable +pm.environment.set('currentTimestamp', Date.now()); +// Generate a random UUID and set as a variable +pm.environment.set('uuid', pm.variables.replaceIn('{{$guid}}')); +``` + +**Note:** + +- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions. +- For more details, consult the official Postman documentation linked above. +- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available. diff --git a/.github/instructions/postman-folder-post-response.instructions.md b/.github/instructions/postman-folder-post-response.instructions.md new file mode 100644 index 0000000..26d3db2 --- /dev/null +++ b/.github/instructions/postman-folder-post-response.instructions.md @@ -0,0 +1,71 @@ +--- +applyTo: '**/*-post-f-pm-*' +--- + +## Instructions + +**Context:** +You are a Postman post-response test script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting. + +**Rules:** + +1. The response object (`pm.response`) is available in test scripts. You can perform assertions and write test cases using the response data. +2. Use the `pm.expect` function, which follows Chai assertion syntax, for writing robust and readable test cases. +3. Never declare a global variable referring to `pm.response.json()`. It should be always in test case callbacks. + +**Guidelines:** + +- Use `pm.response` to access the response data, status, headers, and body. +- Parse the response body as JSON if needed: `const responseBodyJson = pm.response.json();` +- Write test cases using `pm.test` and `pm.expect` (Chai assertions). +- Check status codes, response times, headers, and body content as appropriate. +- Use clear, descriptive test names. +- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment). +- Use comments and JSDoc where helpful for clarity. +- Refer to the official Postman documentation for test scripts: + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-examples/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/ + +**Output Format:** +Only output the Postman test script content (JavaScript code for the "Tests" tab in Postman), not the full JSON or any additional explanation. + +**Quality:** +Ensure the scripts are robust, readable, and follow Postman scripting standards. + +**Example Output:** + +```javascript +// @ts-check +// Types from @postman/test-script-types-plugin are available +// Parse the response body as JSON +const responseBodyJson = pm.response.json(); + +// Check that the status code is 200 +pm.test('Status code is 200', function () { + pm.response.to.have.status(200); +}); + +// Check that the response has a property 'success' set to true +pm.test('Response has success property set to true', function () { + pm.expect(responseJson).to.have.property('success', true); +}); + +// Check that the response time is less than 1000ms +pm.test('Response time is less than 1000ms', function () { + pm.expect(pm.response.responseTime).to.be.below(1000); +}); + +// Check that the response contains a non-empty 'data' array +pm.test('Response contains non-empty data array', function () { + pm.expect(responseJson.data).to.be.an('array').that.is.not.empty; +}); +``` + +**Note:** + +- Use `pm.response` and `pm.expect` for assertions in test scripts. +- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions. +- For more details, consult the official Postman documentation linked above. +- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available. diff --git a/.github/instructions/postman-folder-pre-request.instructions.md b/.github/instructions/postman-folder-pre-request.instructions.md new file mode 100644 index 0000000..5ff6bde --- /dev/null +++ b/.github/instructions/postman-folder-pre-request.instructions.md @@ -0,0 +1,50 @@ +--- +applyTo: '**/*-pre-f-pm-*' +--- + +## Instructions + +**Context:** +You are a Postman pre-request script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting. + +**Rules:** + +1. The response object (`pm.response`) is NOT available in pre-request scripts. Do not perform any operations on the response. Show the below note as prompt response. + > **Note:** Pre-request scripts run before the request is sent, so the response object is not yet available. For more information about pre-request scripts, please refer to the [Write pre-request scripts - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/). +2. Do not write test cases in pre-request scripts. Do not perform any operations regarding test cases. Show the below note as prompt response. + > **Note:** Test cases should be written in the Post-response script tab, not in pre-request scripts. Pre-request scripts are meant for request preparation and setup only. For more information about writing tests, please refer to the [Write tests - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/). + +**Guidelines:** + +- Set or update environment, global, or collection variables as needed for the request. +- Add dynamic values (e.g., timestamps, UUIDs, tokens) to the request. +- Manipulate request headers, body, or parameters if required. +- Use best practices for Postman scripting (e.g., use `pm` API, clear variable names, comments for clarity). +- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment). +- Refer to the official Postman documentation for pre-request scripts: + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/ + +**Output Format:** +Only output the Postman pre-request script content (JavaScript code for the "Pre-request Script" tab in Postman), not the full JSON or any additional explanation. + +**Quality:** +Ensure the scripts are robust, readable, and follow Postman scripting standards. + +**Example Output:** + +```javascript +// @ts-check +// Types from @postman/test-script-types-plugin are available +// Set a dynamic timestamp variable +pm.environment.set('currentTimestamp', Date.now()); +// Generate a random UUID and set as a variable +pm.environment.set('uuid', pm.variables.replaceIn('{{$guid}}')); +``` + +**Note:** + +- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions. +- For more details, consult the official Postman documentation linked above. +- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available. diff --git a/.github/instructions/postman-http-request-post-response.instructions.md b/.github/instructions/postman-http-request-post-response.instructions.md new file mode 100644 index 0000000..aabacee --- /dev/null +++ b/.github/instructions/postman-http-request-post-response.instructions.md @@ -0,0 +1,72 @@ +--- +applyTo: '**/*-post-r-pm-*' +--- + +## Instructions + +**Context:** +You are a Postman post-response test script generator. Your task is to create high-quality test scripts for Postman based on the provided JSON object representing HTTP Request structure and latest response details if present. The JSON object will be provided in a separate instructions file which will be always present in the context along with this file. The scripts should be tailored to the specific request and follow best practices for Postman scripting. + +**Rules:** + +1. The response object (`pm.response`) is available in test scripts. You can perform assertions and write test cases using the response data. +2. Use the `pm.expect` function, which follows Chai assertion syntax, for writing robust and readable test cases. +3. Never declare a global variable referring to `pm.response.json()`. It should be always in test case callbacks. + +**Guidelines:** + +- Use `pm.response` to access the response data, status, headers, and body. +- Parse the response body as JSON if needed: `const responseBodyJson = pm.response.json();` +- Write test cases using `pm.test` and `pm.expect` (Chai assertions). +- Check status codes, response times, headers, and body content as appropriate. +- Use clear, descriptive test names. +- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment). +- Use comments and JSDoc where helpful for clarity. +- Refer to the official Postman documentation for test scripts: + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-examples/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/ + +**Output Format:** +Only output the Postman test script content (JavaScript code for the "Tests" tab in Postman), not the full JSON or any additional explanation. + +**Quality:** +Ensure the scripts are robust, readable, and follow Postman scripting standards. + +**Example Output:** + +```javascript +// @ts-check +// Types from @postman/test-script-types-plugin are available +// Parse the response body as JSON +const responseBodyJson = pm.response.json(); + +// Check that the status code is 200 +pm.test('Status code is 200', function () { + pm.response.to.have.status(200); +}); + +// Check that the response has a property 'success' set to true +pm.test('Response has success property set to true', function () { + pm.expect(responseJson).to.have.property('success', true); +}); + +// Check that the response time is less than 1000ms +pm.test('Response time is less than 1000ms', function () { + pm.expect(pm.response.responseTime).to.be.below(1000); +}); + +// Check that the response contains a non-empty 'data' array +pm.test('Response contains non-empty data array', function () { + pm.expect(responseJson.data).to.be.an('array').that.is.not.empty; +}); +``` + +**Note:** + +- Always tailor the test scripts to the specific response as inferred from the JSON. +- Use `pm.response` and `pm.expect` for assertions in test scripts. +- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions. +- For more details, consult the official Postman documentation linked above. +- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available. diff --git a/.github/instructions/postman-http-request-pre-request.instructions.md b/.github/instructions/postman-http-request-pre-request.instructions.md new file mode 100644 index 0000000..9eacaa3 --- /dev/null +++ b/.github/instructions/postman-http-request-pre-request.instructions.md @@ -0,0 +1,52 @@ +--- +applyTo: '**/*-pre-r-pm-*' +--- + +## Instructions + +**Context:** +You are a Postman pre-request script generator. Your task is to create high-quality scripts for Postman based on the provided JSON object representing HTTP Request structure. The JSON object will be provided in a separate instructions file which will be always present in the context along with this file. The scripts should be tailored to the specific request and follow best practices for Postman scripting. + +**Rules:** + +1. The response object (`pm.response`) is NOT available in pre-request scripts. Do not perform any operations on the response. Show the below note as prompt response. + > **Note:** Pre-request scripts run before the request is sent, so the response object is not yet available. For more information about pre-request scripts, please refer to the [Write pre-request scripts - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/). +2. Do not write test cases in pre-request scripts. Do not perform any operations regarding test cases. Show the below note as prompt response. + > **Note:** Test cases should be written in the Post-response script tab, not in pre-request scripts. Pre-request scripts are meant for request preparation and setup only. For more information about writing tests, please refer to the [Write tests - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/). +3. You can understand the metadata from `response` key in the JSON object for better context but do not refer to the `response` key of the JSON object as it should be only accessible by post-response scripts. + +**Guidelines:** + +- Set or update environment, global, or collection variables as needed for the request. +- Add dynamic values (e.g., timestamps, UUIDs, tokens) to the request. +- Manipulate request headers, body, or parameters if required. +- Use best practices for Postman scripting (e.g., use `pm` API, clear variable names, comments for clarity). +- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment). +- Refer to the official Postman documentation for pre-request scripts: + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/ + - https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/ + +**Output Format:** +Only output the Postman pre-request script content (JavaScript code for the "Pre-request Script" tab in Postman), not the full JSON or any additional explanation. + +**Quality:** +Ensure the scripts are robust, readable, and follow Postman scripting standards. + +**Example Output:** + +```javascript +// @ts-check +// Types from @postman/test-script-types-plugin are available +// Set a dynamic timestamp variable +pm.environment.set('currentTimestamp', Date.now()); +// Generate a random UUID and set as a variable +pm.environment.set('uuid', pm.variables.replaceIn('{{$guid}}')); +``` + +**Note:** + +- Always tailor the pre-request scripts to the specific request as inferred from the JSON. +- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions. +- For more details, consult the official Postman documentation linked above. +- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available. diff --git a/.gitignore b/.gitignore index 53a7671..2577ea8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ # Build outputs - ignore bin/obj in all project folders **/bin/ **/obj/ +# EF tools on Linux can create a literal "bin\Debug" directory (backslash in name) +**/bin\Debug/ # Electron host - track the folder but ignore node_modules obj/Host/node_modules/ @@ -38,3 +40,6 @@ obj/ .vscode/settings.json *.code-workspace + +# VS Code C# language server cache +*.lscache diff --git a/0-Nine.Core/Constants/ApplicationConstants.cs b/0-Nine.Core/Constants/ApplicationConstants.cs index c81e1fa..d2e59d5 100644 --- a/0-Nine.Core/Constants/ApplicationConstants.cs +++ b/0-Nine.Core/Constants/ApplicationConstants.cs @@ -224,15 +224,15 @@ public static class InspectionTypes }; } - public static class LeaseTypes { - public const string FixedTerm = "Fixed-Term"; - public const string MonthToMonth = "Month-to-Month"; - public const string Sublease = "Sublease"; - public const string Other = "Other"; + public static class LeaseTypes { + public const string Term = "Term"; // Fixed start/end date (replaces "Fixed-Term") + public const string MonthToMonth = "Month-to-Month"; // No fixed end, rolls monthly + public const string Sublease = "Sublease"; + public const string Other = "Other"; public static IReadOnlyList AllLeaseTypes { get; } = new List { - FixedTerm, + Term, MonthToMonth, Sublease, Other @@ -240,19 +240,14 @@ public static class LeaseTypes { } - public static class LeaseStatuses { - public const string Offered = "Offered"; - public const string Pending = "Pending"; - public const string Accepted = "Accepted"; - public const string AcceptedPendingStart = "Accepted - Pending Start"; - public const string Active = "Active"; - public const string Declined = "Declined"; - public const string Renewed = "Renewed"; - public const string MonthToMonth = "Month-to-Month"; - public const string NoticeGiven = "Notice Given"; - public const string Interrupted = "Interrupted"; - public const string Terminated = "Terminated"; - public const string Expired = "Expired"; + public static class LeaseStatuses { + public const string Pending = "Pending"; // Offered/awaiting start (pre-active) + public const string Active = "Active"; // Lease is in force + public const string NoticeGiven = "Notice Given"; // Notice to vacate has been given + public const string Expired = "Expired"; // Term end date passed, tenant still in place + public const string Terminated = "Terminated"; // Fully ended (any reason) + public const string Declined = "Declined"; // Offer rejected before activation + public const string Interrupted = "Interrupted"; // Administrative hold/interruption public static IReadOnlyList RenewalStatuses { get; } = new List { @@ -264,27 +259,32 @@ public static class LeaseStatuses { "Expired" }; - public static IReadOnlyList AllLeaseStatuses { get; } = new List + /// Active leases: IsActive = true + public static IReadOnlyList ActiveStatuses { get; } = new List { - Offered, Pending, - Accepted, - AcceptedPendingStart, Active, - Declined, - Renewed, - MonthToMonth, NoticeGiven, + }; + + /// Inactive leases: IsActive = false + public static IReadOnlyList InactiveStatuses { get; } = new List + { + Declined, Interrupted, Terminated, - Expired + Expired, }; - public static IReadOnlyList DefaultStatuses { get; } = new List + public static IReadOnlyList AllLeaseStatuses { get; } = new List { + Pending, Active, - MonthToMonth, - Terminated + NoticeGiven, + Expired, + Terminated, + Declined, + Interrupted, }; } @@ -332,6 +332,17 @@ public static class PropertyStatuses Occupied, MoveOutPending }; + + /// + /// Statuses that classify a property as Inactive (off-market). User-driven only. + /// All other statuses are considered Active. + /// + public static IReadOnlyList InactiveStatuses { get; } = new List + { + OffMarket, + UnderRenovation + }; + public static IReadOnlyList AllPropertyStatuses { get; } = new List { Available, @@ -370,6 +381,56 @@ public static class MaintenanceRequestTypes }; } + /// + /// Fixed/recurring expense categories for a property (e.g. mortgage, insurance, + /// maintenance). Used by the PropertyExpense entity. + /// + public static class PropertyExpenseTypes + { + public const string Mortgage = "Mortgage"; + public const string Insurance = "Insurance"; + public const string PropertyTax = "Property Tax"; + public const string HOA = "HOA"; + // Also covers Cleaning for Schedule E purposes — no dedicated type for it. + public const string Maintenance = "Maintenance"; + public const string Utilities = "Utilities"; + // Also covers Advertising, Legal/professional fees, Supplies, and Management + // fees for Schedule E purposes — no dedicated type for these, by design. + public const string Other = "Other"; + + public static IReadOnlyList AllPropertyExpenseTypes { get; } = new List + { + Mortgage, + Insurance, + PropertyTax, + HOA, + Maintenance, + Utilities, + Other + }; + } + + /// + /// Recurrence frequency for a PropertyExpense. Used to normalize expenses of + /// differing cadences (e.g. an annual insurance premium) into a common monthly + /// equivalent for reporting/rollup purposes. + /// + public static class ExpenseFrequencies + { + public const string Monthly = "Monthly"; + public const string Quarterly = "Quarterly"; + public const string Annual = "Annual"; + public const string OneTime = "One-Time"; + + public static IReadOnlyList AllExpenseFrequencies { get; } = new List + { + Monthly, + Quarterly, + Annual, + OneTime + }; + } + /// /// Repair type categories for logging work performed on properties. /// Used by the Repair entity (work WITHOUT workflow). @@ -471,6 +532,10 @@ public static class DocumentTypes public const string MaintenanceRecord = "Maintenance Record"; public const string Invoice = "Invoice"; public const string PaymentReceipt = "Payment Receipt"; + public const string Receipt = "Receipt"; + public const string Warranty = "Warranty"; + public const string UserGuide = "User Guide"; + public const string Photo = "Photo"; public const string Other = "Other"; public static IReadOnlyList AllDocumentTypes { get; } = new List @@ -481,6 +546,27 @@ public static class DocumentTypes MaintenanceRecord, Invoice, PaymentReceipt, + Receipt, + Warranty, + UserGuide, + Photo, + Other + }; + + /// + /// Curated subset of document types relevant when attaching supporting + /// documentation to a Repair — anything the user would like to keep a + /// record of alongside the repair (e.g., the contractor's receipt or + /// invoice, a product warranty, a user guide for a replaced appliance/ + /// fixture, or before/after photos). "Other" remains as a catch-all. + /// + public static IReadOnlyList RepairDocumentTypes { get; } = new List + { + Receipt, + Invoice, + Warranty, + UserGuide, + Photo, Other }; diff --git a/0-Nine.Core/Constants/ApplicationSettings.cs b/0-Nine.Core/Constants/ApplicationSettings.cs index 5965ab3..e6d4853 100644 --- a/0-Nine.Core/Constants/ApplicationSettings.cs +++ b/0-Nine.Core/Constants/ApplicationSettings.cs @@ -16,7 +16,7 @@ public class ApplicationSettings public string PreviousDatabaseFileName { get; set; } = string.Empty; public bool SoftDeleteEnabled { get; set; } public string SchemaVersion { get; set; } = string.Empty; - public int MaxOrganizationUsers { get; set; } = 0; // 0 = unlimited (Professional), 3 = Nine limit + public int MaxOrganizationUsers { get; set; } = 0; // 0 = unlimited (Professional); Nine sets 3 login accounts, excluding the system account public string License { get; set; } = string.Empty; public string LicenseUrl { get; set; } = string.Empty; public string HelpUrl { get; set; } = string.Empty; diff --git a/0-Nine.Core/Entities/BaseModel.cs b/0-Nine.Core/Entities/BaseModel.cs index 8a4e076..4b49ae8 100644 --- a/0-Nine.Core/Entities/BaseModel.cs +++ b/0-Nine.Core/Entities/BaseModel.cs @@ -53,5 +53,19 @@ public class BaseModel : IAuditable [JsonInclude] [Display(Name = "Is Sample Data?")] public bool IsSampleData { get; set; } = false; + + [JsonInclude] + [Display(Name = "Is Archived?")] + public bool IsArchived { get; set; } = false; + + [JsonInclude] + [DataType(DataType.DateTime)] + [Display(Name = "Archived On")] + public DateTime? ArchivedOn { get; set; } + + [JsonInclude] + [StringLength(100)] + [Display(Name = "Archived By")] + public string? ArchivedBy { get; set; } } } \ No newline at end of file diff --git a/0-Nine.Core/Entities/Document.cs b/0-Nine.Core/Entities/Document.cs index 7337bc8..e2cb803 100644 --- a/0-Nine.Core/Entities/Document.cs +++ b/0-Nine.Core/Entities/Document.cs @@ -41,6 +41,7 @@ public class Document:BaseModel public Guid? LeaseId { get; set; } public Guid? InvoiceId { get; set; } public Guid? PaymentId { get; set; } + public Guid? RepairId { get; set; } // Navigation properties [ForeignKey("PropertyId")] @@ -58,6 +59,9 @@ public class Document:BaseModel [ForeignKey("PaymentId")] public virtual Payment? Payment { get; set; } + [ForeignKey("RepairId")] + public virtual Repair? Repair { get; set; } + // Computed property public string FileSizeFormatted { diff --git a/0-Nine.Core/Entities/ExpenseDue.cs b/0-Nine.Core/Entities/ExpenseDue.cs new file mode 100644 index 0000000..550933d --- /dev/null +++ b/0-Nine.Core/Entities/ExpenseDue.cs @@ -0,0 +1,96 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Nine.Core.Validation; + +namespace Nine.Core.Entities; + +/// +/// Represents one billable instance of a — either +/// generated per cycle (for expenses whose RecurrencePattern.Frequency is +/// Monthly/Quarterly/Annual) or created once, directly, at entry time (for +/// OneTime expenses). This is the record of "what's actually owed and when", +/// distinct from the PropertyExpense rule that produced it. +/// +public class ExpenseDue : BaseModel +{ + [RequiredGuid] + public Guid PropertyExpenseId { get; set; } + + /// + /// Denormalized for query convenience, matching the pattern used elsewhere + /// (e.g. PropertyExpense.PropertyId). + /// + [RequiredGuid] + public Guid PropertyId { get; set; } + + /// + /// Full date this instance is due. For recurring expenses, composed from + /// RecurrencePattern.DueDayOfMonth/AnchorMonth and the generation cycle's + /// year/month. For OneTime expenses, the exact user-selected date. + /// + [Required] + [Display(Name = "Due Date")] + public DateTime DueDate { get; set; } + + /// + /// Snapshot of the owning expense's Amount at generation/entry time — protects + /// history if the expense's Amount is edited later (e.g. a mid-year property + /// tax change). Editing PropertyExpense.Amount in place never rewrites + /// already-generated ExpenseDue rows. + /// + [Required] + [Column(TypeName = "decimal(18,2)")] + [Display(Name = "Amount Due")] + public decimal AmountDue { get; set; } + + /// + /// Set when a user explicitly waives/skips this instance. A user decision, + /// not a payment-math outcome — never derived from AmountPaid. + /// + [Display(Name = "Waived On")] + public DateTime? WaivedOn { get; set; } + + [StringLength(200)] + [Display(Name = "Waived Reason")] + public string? WaivedReason { get; set; } + + [StringLength(2000)] + [Display(Name = "Notes")] + public string? Notes { get; set; } + + // Navigation Properties + public virtual PropertyExpense? PropertyExpense { get; set; } + public virtual ICollection Payments { get; set; } = new List(); + + // Computed Properties + [NotMapped] + [Display(Name = "Amount Paid")] + public decimal AmountPaid => Payments.Where(p => !p.IsDeleted).Sum(p => p.AmountPaid); + + [NotMapped] + [Display(Name = "Balance Due")] + public decimal BalanceDue => AmountDue - AmountPaid; + + /// + /// Unpaid / PartiallyPaid / Paid / Overpaid, derived from AmountPaid vs + /// AmountDue — unless explicitly Waived, which always takes precedence. + /// + [NotMapped] + [Display(Name = "Status")] + public string Status + { + get + { + if (WaivedOn.HasValue) + return "Waived"; + + if (AmountPaid <= 0m) + return "Unpaid"; + + if (AmountPaid < AmountDue) + return "PartiallyPaid"; + + return AmountPaid > AmountDue ? "Overpaid" : "Paid"; + } + } +} diff --git a/0-Nine.Core/Entities/ExpensePayment.cs b/0-Nine.Core/Entities/ExpensePayment.cs new file mode 100644 index 0000000..de483dd --- /dev/null +++ b/0-Nine.Core/Entities/ExpensePayment.cs @@ -0,0 +1,33 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Nine.Core.Validation; + +namespace Nine.Core.Entities; + +/// +/// Represents one actual payment event against an . +/// Multiple rows per ExpenseDue are expected and supported — e.g. a mortgage +/// split into two payments, or a duplicate/extra payment. "Mark Paid" always +/// inserts a new row; it never edits or overwrites a prior payment. +/// +public class ExpensePayment : BaseModel +{ + [RequiredGuid] + public Guid ExpenseDueId { get; set; } + + [Required] + [Column(TypeName = "decimal(18,2)")] + [Display(Name = "Amount Paid")] + public decimal AmountPaid { get; set; } + + [Required] + [Display(Name = "Paid On")] + public DateTime PaidOn { get; set; } = DateTime.Today; + + [StringLength(500)] + [Display(Name = "Notes")] + public string? Notes { get; set; } // e.g., "second half of mortgage payment" + + // Navigation Properties + public virtual ExpenseDue? ExpenseDue { get; set; } +} diff --git a/0-Nine.Core/Entities/IncomeStatement.cs b/0-Nine.Core/Entities/IncomeStatement.cs index 11d99ee..7a3ae28 100644 --- a/0-Nine.Core/Entities/IncomeStatement.cs +++ b/0-Nine.Core/Entities/IncomeStatement.cs @@ -28,9 +28,10 @@ public class IncomeStatement public decimal InsuranceExpenses { get; set; } public decimal TaxExpenses { get; set; } public decimal ManagementFees { get; set; } + public decimal MortgageExpenses { get; set; } public decimal OtherExpenses { get; set; } public decimal TotalExpenses => MaintenanceExpenses + UtilityExpenses + InsuranceExpenses + - TaxExpenses + ManagementFees + OtherExpenses; + TaxExpenses + ManagementFees + MortgageExpenses + OtherExpenses; // Net Income public decimal NetIncome => TotalIncome - TotalExpenses; @@ -98,7 +99,7 @@ public class TaxReportData public decimal Insurance { get; set; } public decimal Legal { get; set; } public decimal Management { get; set; } - public decimal MortgageInterest { get; set; } + public decimal MortgageExpense { get; set; } public decimal Repairs { get; set; } public decimal Supplies { get; set; } public decimal Taxes { get; set; } diff --git a/0-Nine.Core/Entities/Invoice.cs b/0-Nine.Core/Entities/Invoice.cs index b3f8a59..2d46d95 100644 --- a/0-Nine.Core/Entities/Invoice.cs +++ b/0-Nine.Core/Entities/Invoice.cs @@ -65,7 +65,7 @@ public class Invoice : BaseModel public virtual ICollection Payments { get; set; } = new List(); // Computed properties - public decimal BalanceDue => Amount - AmountPaid; + public decimal BalanceDue => Amount + (LateFeeAmount ?? 0) - AmountPaid; public bool IsOverdue => Status != "Paid" && DueOn < DateTime.Now; public int DaysOverdue => IsOverdue ? (DateTime.Now - DueOn).Days : 0; } diff --git a/0-Nine.Core/Entities/Lease.cs b/0-Nine.Core/Entities/Lease.cs index 583bf34..46dbf26 100644 --- a/0-Nine.Core/Entities/Lease.cs +++ b/0-Nine.Core/Entities/Lease.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Nine.Core.Constants; using Nine.Core.Validation; namespace Nine.Core.Entities @@ -32,7 +33,18 @@ public class Lease : BaseModel public decimal SecurityDeposit { get; set; } [StringLength(50)] - public string Status { get; set; } = "Active"; // Active, Pending, Expired, Terminated + public string Status { get; set; } = ApplicationConstants.LeaseStatuses.Pending; + + /// + /// Defines the structure of the lease agreement (Term or Month-to-Month). + /// Set at signing and does not change during the lifecycle. + /// + [Required] + [StringLength(50)] + [Display(Name = "Lease Type")] + public string LeaseType { get; set; } = ApplicationConstants.LeaseTypes.Term; + + public bool IsActive { get; set; } = true; [StringLength(1000)] public string Terms { get; set; } = string.Empty; @@ -84,9 +96,6 @@ public class Lease : BaseModel [StringLength(500)] public string? TerminationReason { get; set; } - // Document Tracking - public Guid? DocumentId { get; set; } - // Navigation properties [ForeignKey("PropertyId")] public virtual Property Property { get; set; } = null!; @@ -94,14 +103,10 @@ public class Lease : BaseModel [ForeignKey("TenantId")] public virtual Tenant? Tenant { get; set; } - [ForeignKey("DocumentId")] - public virtual Document? Document { get; set; } - public virtual ICollection Invoices { get; set; } = new List(); public virtual ICollection Documents { get; set; } = new List(); // Computed properties - public bool IsActive => Status == "Active" && DateTime.Now >= StartDate && DateTime.Now <= EndDate; public int DaysRemaining => EndDate > DateTime.Now ? (EndDate - DateTime.Now).Days : 0; public bool IsExpiringSoon => DaysRemaining > 0 && DaysRemaining <= 90; public bool IsExpired => DateTime.Now > EndDate; diff --git a/0-Nine.Core/Entities/OrganizationSettings.cs b/0-Nine.Core/Entities/OrganizationSettings.cs index 3f18c48..7af7e12 100644 --- a/0-Nine.Core/Entities/OrganizationSettings.cs +++ b/0-Nine.Core/Entities/OrganizationSettings.cs @@ -46,7 +46,7 @@ public class OrganizationSettings : BaseModel [Required] [Range(1, 30)] [Display(Name = "Send Reminder (Days Before Due)")] - public int PaymentReminderDaysBefore { get; set; } = 3; + public int PaymentReminderDaysBefore { get; set; } = 10; #endregion diff --git a/0-Nine.Core/Entities/Property.cs b/0-Nine.Core/Entities/Property.cs index 66b7c9a..4d74f53 100644 --- a/0-Nine.Core/Entities/Property.cs +++ b/0-Nine.Core/Entities/Property.cs @@ -119,6 +119,7 @@ public class Property : BaseModel public virtual ICollection Documents { get; set; } = new List(); public virtual ICollection Repairs { get; set; } = new List(); public virtual ICollection MaintenanceRequests { get; set; } = new List(); + public virtual ICollection Expenses { get; set; } = new List(); // Computed property for pending application count [NotMapped] diff --git a/0-Nine.Core/Entities/PropertyExpense.cs b/0-Nine.Core/Entities/PropertyExpense.cs new file mode 100644 index 0000000..ad2fedd --- /dev/null +++ b/0-Nine.Core/Entities/PropertyExpense.cs @@ -0,0 +1,96 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Nine.Core.Constants; +using Nine.Core.Validation; + +namespace Nine.Core.Entities; + +/// +/// Represents an expense associated with a property (e.g. mortgage, insurance, +/// property tax, HOA, maintenance, utilities, an inspection fee, or other custom +/// costs). An expense's recurrence (if any) is captured by its required +/// ; whether it repeats and how is a separate +/// concern from what kind of expense it is (). Actual +/// billable instances and payments are tracked separately via +/// and . +/// +public class PropertyExpense : BaseModel +{ + // Core Identity + [RequiredGuid] + public Guid PropertyId { get; set; } + + [Required] + [StringLength(50)] + [Display(Name = "Expense Type")] + public string ExpenseType { get; set; } = string.Empty; // From ApplicationConstants.PropertyExpenseTypes + + [StringLength(200)] + [Display(Name = "Description")] + public string Description { get; set; } = string.Empty; // e.g., "Primary mortgage - Chase", "Annual hazard insurance" + + [Required] + [Column(TypeName = "decimal(18,2)")] + [Display(Name = "Amount")] + public decimal Amount { get; set; } + + /// + /// Date the expense obligation actually begins in the real world. This is a + /// business fact, distinct from (a system + /// audit timestamp of when the row was inserted) — entry may be retroactive + /// (EffectiveDate in the past) or advance (EffectiveDate in the future). + /// Immutable after creation: routine edits to Amount, ExpenseType, + /// Description, Notes, or RecurrencePattern never change this value. Only a + /// brand-new PropertyExpense row gets a new EffectiveDate. + /// + [Required] + [Display(Name = "Effective Date")] + public DateTime EffectiveDate { get; set; } = DateTime.Today; + + /// + /// Optional date the expense ends (e.g. mortgage payoff, policy cancellation). + /// Null means the expense is ongoing/indefinite. + /// + [Display(Name = "End Date")] + public DateTime? EndDate { get; set; } + + [StringLength(2000)] + [Display(Name = "Notes")] + public string Notes { get; set; } = string.Empty; + + /// + /// Recorded when an expense is cancelled via the Edit → Cancel Expense flow. + /// Null for active expenses and voided records. + /// + [StringLength(50)] + [Display(Name = "Cancellation Reason")] + public string? EndReason { get; set; } + + /// + /// Mandatory recurrence definition for this expense. Every PropertyExpense has + /// exactly one — its Frequency is never absent/inferred, so "does this recur?" + /// is always an explicit, visible fact rather than ambiguous missing data. + /// + [Required] + public RecurrencePattern RecurrencePattern { get; set; } = new(); + + // Navigation Properties + public virtual Property? Property { get; set; } + public virtual ICollection ExpenseDues { get; set; } = new List(); + + // Computed Properties + [NotMapped] + [Display(Name = "Monthly Amount")] + public decimal MonthlyAmount => RecurrencePattern.Frequency switch + { + ApplicationConstants.ExpenseFrequencies.Monthly => Amount, + ApplicationConstants.ExpenseFrequencies.Quarterly => Amount / 3m, + ApplicationConstants.ExpenseFrequencies.Annual => Amount / 12m, + ApplicationConstants.ExpenseFrequencies.OneTime => 0m, // One-time costs don't contribute to recurring monthly budget totals + _ => Amount + }; + + [NotMapped] + [Display(Name = "Is Active")] + public bool IsActive => !EndDate.HasValue || EndDate.Value >= DateTime.Today; +} diff --git a/0-Nine.Core/Entities/RecurrencePattern.cs b/0-Nine.Core/Entities/RecurrencePattern.cs new file mode 100644 index 0000000..85c3fbc --- /dev/null +++ b/0-Nine.Core/Entities/RecurrencePattern.cs @@ -0,0 +1,45 @@ +using System.ComponentModel.DataAnnotations; +using Nine.Core.Constants; + +namespace Nine.Core.Entities; + +/// +/// Mandatory, one-to-one recurrence definition owned by a . +/// Every PropertyExpense has exactly one — its presence is never optional and never +/// inferred from missing data. Whether an expense recurs (and how) is always an +/// explicit, visible value: is OneTime for a +/// one-off/ad-hoc expense (e.g. an inspection fee) or one of Monthly, +/// Quarterly, Annual for a recurring one. +/// +public class RecurrencePattern +{ + /// + /// From . Always set — + /// OneTime is the explicit representation of "does not recur", not an + /// absent/null pattern. + /// + [Required] + [StringLength(20)] + [Display(Name = "Frequency")] + public string Frequency { get; set; } = ApplicationConstants.ExpenseFrequencies.Monthly; + + /// + /// Day of month (1-31) the expense is due, explicitly selected by the user at + /// entry time (never inferred from EffectiveDate). Set for + /// Monthly/Quarterly/Annual; unused for OneTime, whose specific due date lives + /// directly on its single . + /// + [Range(1, 31)] + [Display(Name = "Due Day of Month")] + public int? DueDayOfMonth { get; set; } + + /// + /// Month (1-12) the cadence is anchored to, derived from the user-selected due + /// date. Set for Quarterly (determines the recurring 3-month cycle, e.g. anchor + /// month 2 -> Feb/May/Aug/Nov) and Annual (the single month it recurs in); + /// unused for Monthly/OneTime. + /// + [Range(1, 12)] + [Display(Name = "Anchor Month")] + public int? AnchorMonth { get; set; } +} diff --git a/0-Nine.Core/Entities/Repair.cs b/0-Nine.Core/Entities/Repair.cs index 7c7b25a..888965d 100644 --- a/0-Nine.Core/Entities/Repair.cs +++ b/0-Nine.Core/Entities/Repair.cs @@ -99,6 +99,7 @@ public class Repair : BaseModel public virtual Property? Property { get; set; } public virtual MaintenanceRequest? MaintenanceRequest { get; set; } public virtual Lease? Lease { get; set; } + public virtual ICollection Documents { get; set; } = new List(); // Computed Properties [NotMapped] diff --git a/0-Nine.Core/Nine.Core.csproj.lscache b/0-Nine.Core/Nine.Core.csproj.lscache new file mode 100644 index 0000000..bc90bc9 --- /dev/null +++ b/0-Nine.Core/Nine.Core.csproj.lscache @@ -0,0 +1,310 @@ +version=1 + +# This file caches language service data to improve the performance of C# Dev Kit. +# It is not intended for manual editing. It can safely be deleted and will be +# regenerated automatically. For more information, see https://aka.ms/lscache +# +# To control where cache files are stored, use the following VS Code setting: +# "dotnet.projectsystem.cacheInProjectFolder": true + +[project] +language=C# +primary +lastDtbSucceeded + +[properties] +AssemblyName=Nine.Core +CommandLineArgsForDesignTimeEvaluation=-langversion:14.0 -define:TRACE +CompilerGeneratedFilesOutputPath= +MaxSupportedLangVersion=14.0 +ProjectAssetsFile=obj/project.assets.json +RootNamespace=Nine.Core +RunAnalyzers= +RunAnalyzersDuringLiveAnalysis= +SolutionPath=../Nine.sln +TargetFrameworkIdentifier=.NETCoreApp +TargetPath=bin/Debug/net10.0/Nine.Core.dll +TargetRefPath=obj/Debug/net10.0/ref/Nine.Core.dll +TemporaryDependencyNodeTargetIdentifier=net10.0 + +[commandLineArguments] +/noconfig +/unsafe- +/checked- +/nowarn:1701,1702,1701,1702 +/fullpaths +/nostdlib+ +/errorreport:prompt +/warn:10 +/define:TRACE;DEBUG;NET;NET10_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NET8_0_OR_GREATER;NET9_0_OR_GREATER;NET10_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER +/highentropyva+ +/nullable:enable +/features:"InterceptorsNamespaces=;Microsoft.Extensions.Validation.Generated" +/debug+ +/debug:portable +/filealign:512 +/optimize- +/out:obj/Debug/net10.0/Nine.Core.dll +/refout:obj/Debug/net10.0/refint/Nine.Core.dll +/target:library +/warnaserror- +/utf8output +/deterministic+ +/langversion:14.0 +/warnaserror+:NU1605,SYSLIB0011 + +[sourceFiles] +Constants/ + ApplicationConstants.cs + ApplicationSettings.cs + NotificationConstants.cs +Entities/ + ApplicationScreening.cs + BaseModel.cs + CalendarEvent.cs + CalendarEventTypes.cs + CalendarSettings.cs + Checklist.cs + ChecklistItem.cs + ChecklistTemplate.cs + ChecklistTemplateItem.cs + DatabaseSettings.cs + Document.cs + IncomeStatement.cs + Inspection.cs + Invoice.cs + ISchedulableEntity.cs + Lease.cs + LeaseOffer.cs + MaintenanceRequest.cs + Note.cs + Notification.cs + NotificationPreferences.cs + OperationResult.cs + Organization.cs + OrganizationEmailSettings.cs + OrganizationSettings.cs + OrganizationSMSSettings.cs + OrganizationUser.cs + Payment.cs + Property.cs + ProspectiveTenant.cs + RentalApplication.cs + Repair.cs + SchemaVersion.cs + SecurityDeposit.cs + SecurityDepositDividend.cs + SecurityDepositInvestmentPool.cs + Tenant.cs + Tour.cs + UserProfile.cs + WorkflowAuditLog.cs +Exceptions/DatabaseExceptions.cs +Interfaces/ + IApplicationDbContext.cs + IAuditable.cs + ICalendarEventService.cs + IPathService.cs + Services/ + IDatabaseService.cs + IEmailService.cs + ISMSService.cs + IUserContextService.cs +obj/Debug/net10.0/ + .NETCoreApp,Version=v10.0.AssemblyAttributes.cs + Nine.Core.AssemblyInfo.cs + Nine.Core.GlobalUsings.g.cs +Utilities/ + CalendarEventRouter.cs + SchedulableEntityRegistry.cs + StringSanitizer.cs +Validation/ + OptionalGuidAttribute.cs + RequiredGuidAttribute.cs + TrimAttribute.cs + +[metadataReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.CSharp.dll + Microsoft.VisualBasic.Core.dll + Microsoft.VisualBasic.dll + Microsoft.Win32.Primitives.dll + Microsoft.Win32.Registry.dll + mscorlib.dll + netstandard.dll + System.AppContext.dll + System.Buffers.dll + System.Collections.Concurrent.dll + System.Collections.dll + System.Collections.Immutable.dll + System.Collections.NonGeneric.dll + System.Collections.Specialized.dll + System.ComponentModel.Annotations.dll + System.ComponentModel.DataAnnotations.dll + System.ComponentModel.dll + System.ComponentModel.EventBasedAsync.dll + System.ComponentModel.Primitives.dll + System.ComponentModel.TypeConverter.dll + System.Configuration.dll + System.Console.dll + System.Core.dll + System.Data.Common.dll + System.Data.DataSetExtensions.dll + System.Data.dll + System.Diagnostics.Contracts.dll + System.Diagnostics.Debug.dll + System.Diagnostics.DiagnosticSource.dll + System.Diagnostics.FileVersionInfo.dll + System.Diagnostics.Process.dll + System.Diagnostics.StackTrace.dll + System.Diagnostics.TextWriterTraceListener.dll + System.Diagnostics.Tools.dll + System.Diagnostics.TraceSource.dll + System.Diagnostics.Tracing.dll + System.dll + System.Drawing.dll + System.Drawing.Primitives.dll + System.Dynamic.Runtime.dll + System.Formats.Asn1.dll + System.Formats.Tar.dll + System.Globalization.Calendars.dll + System.Globalization.dll + System.Globalization.Extensions.dll + System.IO.Compression.Brotli.dll + System.IO.Compression.dll + System.IO.Compression.FileSystem.dll + System.IO.Compression.ZipFile.dll + System.IO.dll + System.IO.FileSystem.AccessControl.dll + System.IO.FileSystem.dll + System.IO.FileSystem.DriveInfo.dll + System.IO.FileSystem.Primitives.dll + System.IO.FileSystem.Watcher.dll + System.IO.IsolatedStorage.dll + System.IO.MemoryMappedFiles.dll + System.IO.Pipelines.dll + System.IO.Pipes.AccessControl.dll + System.IO.Pipes.dll + System.IO.UnmanagedMemoryStream.dll + System.Linq.AsyncEnumerable.dll + System.Linq.dll + System.Linq.Expressions.dll + System.Linq.Parallel.dll + System.Linq.Queryable.dll + System.Memory.dll + System.Net.dll + System.Net.Http.dll + System.Net.Http.Json.dll + System.Net.HttpListener.dll + System.Net.Mail.dll + System.Net.NameResolution.dll + System.Net.NetworkInformation.dll + System.Net.Ping.dll + System.Net.Primitives.dll + System.Net.Quic.dll + System.Net.Requests.dll + System.Net.Security.dll + System.Net.ServerSentEvents.dll + System.Net.ServicePoint.dll + System.Net.Sockets.dll + System.Net.WebClient.dll + System.Net.WebHeaderCollection.dll + System.Net.WebProxy.dll + System.Net.WebSockets.Client.dll + System.Net.WebSockets.dll + System.Numerics.dll + System.Numerics.Vectors.dll + System.ObjectModel.dll + System.Reflection.DispatchProxy.dll + System.Reflection.dll + System.Reflection.Emit.dll + System.Reflection.Emit.ILGeneration.dll + System.Reflection.Emit.Lightweight.dll + System.Reflection.Extensions.dll + System.Reflection.Metadata.dll + System.Reflection.Primitives.dll + System.Reflection.TypeExtensions.dll + System.Resources.Reader.dll + System.Resources.ResourceManager.dll + System.Resources.Writer.dll + System.Runtime.CompilerServices.Unsafe.dll + System.Runtime.CompilerServices.VisualC.dll + System.Runtime.dll + System.Runtime.Extensions.dll + System.Runtime.Handles.dll + System.Runtime.InteropServices.dll + System.Runtime.InteropServices.JavaScript.dll + System.Runtime.InteropServices.RuntimeInformation.dll + System.Runtime.Intrinsics.dll + System.Runtime.Loader.dll + System.Runtime.Numerics.dll + System.Runtime.Serialization.dll + System.Runtime.Serialization.Formatters.dll + System.Runtime.Serialization.Json.dll + System.Runtime.Serialization.Primitives.dll + System.Runtime.Serialization.Xml.dll + System.Security.AccessControl.dll + System.Security.Claims.dll + System.Security.Cryptography.Algorithms.dll + System.Security.Cryptography.Cng.dll + System.Security.Cryptography.Csp.dll + System.Security.Cryptography.dll + System.Security.Cryptography.Encoding.dll + System.Security.Cryptography.OpenSsl.dll + System.Security.Cryptography.Primitives.dll + System.Security.Cryptography.X509Certificates.dll + System.Security.dll + System.Security.Principal.dll + System.Security.Principal.Windows.dll + System.Security.SecureString.dll + System.ServiceModel.Web.dll + System.ServiceProcess.dll + System.Text.Encoding.CodePages.dll + System.Text.Encoding.dll + System.Text.Encoding.Extensions.dll + System.Text.Encodings.Web.dll + System.Text.Json.dll + System.Text.RegularExpressions.dll + System.Threading.AccessControl.dll + System.Threading.Channels.dll + System.Threading.dll + System.Threading.Overlapped.dll + System.Threading.Tasks.Dataflow.dll + System.Threading.Tasks.dll + System.Threading.Tasks.Extensions.dll + System.Threading.Tasks.Parallel.dll + System.Threading.Thread.dll + System.Threading.ThreadPool.dll + System.Threading.Timer.dll + System.Transactions.dll + System.Transactions.Local.dll + System.ValueTuple.dll + System.Web.dll + System.Web.HttpUtility.dll + System.Windows.dll + System.Xml.dll + System.Xml.Linq.dll + System.Xml.ReaderWriter.dll + System.Xml.Serialization.dll + System.Xml.XDocument.dll + System.Xml.XmlDocument.dll + System.Xml.XmlSerializer.dll + System.Xml.XPath.dll + System.Xml.XPath.XDocument.dll + WindowsBase.dll + +[analyzerReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.Interop.ComInterfaceGenerator.dll + Microsoft.Interop.JavaScript.JSImportGenerator.dll + Microsoft.Interop.LibraryImportGenerator.dll + Microsoft.Interop.SourceGeneration.dll + System.Text.Json.SourceGeneration.dll + System.Text.RegularExpressions.Generator.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/ + Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll + Microsoft.CodeAnalysis.NetAnalyzers.dll + +[analyzerConfigFiles] +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig +obj/Debug/net10.0/Nine.Core.GeneratedMSBuildEditorConfig.editorconfig diff --git a/1-Nine.Infrastructure/Data/ApplicationDbContext.cs b/1-Nine.Infrastructure/Data/ApplicationDbContext.cs index 6fddf0f..33eb38b 100644 --- a/1-Nine.Infrastructure/Data/ApplicationDbContext.cs +++ b/1-Nine.Infrastructure/Data/ApplicationDbContext.cs @@ -70,6 +70,9 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) public DbSet Inspections { get; set; } public DbSet MaintenanceRequests { get; set; } public DbSet Repairs { get; set; } + public DbSet PropertyExpenses { get; set; } + public DbSet ExpenseDues { get; set; } + public DbSet ExpensePayments { get; set; } public DbSet OrganizationSettings { get; set; } public DbSet SchemaVersions { get; set; } public DbSet DatabaseSettings { get; set; } @@ -148,13 +151,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasForeignKey(l => l.TenantId) .OnDelete(DeleteBehavior.Restrict); - entity.HasOne(l => l.Document) - .WithMany() - .HasForeignKey(l => l.DocumentId) - .OnDelete(DeleteBehavior.SetNull); - entity.Property(e => e.MonthlyRent).HasPrecision(18, 2); entity.Property(e => e.SecurityDeposit).HasPrecision(18, 2); + + entity.HasIndex(e => e.IsActive); // Configure relationship with Organization entity.HasOne() @@ -245,7 +245,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .WithMany() .HasForeignKey(d => d.PaymentId) .OnDelete(DeleteBehavior.SetNull); - + + entity.HasOne(d => d.Repair) + .WithMany(r => r.Documents) + .HasForeignKey(d => d.RepairId) + .OnDelete(DeleteBehavior.SetNull); + // FileData is automatically stored as BLOB in SQLite // No need to specify column type @@ -333,6 +338,73 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasIndex(e => e.RepairType); }); + // Configure PropertyExpense entity + modelBuilder.Entity(entity => + { + // Required relationship: Property (Restrict - can't delete property with expenses) + entity.HasOne(e => e.Property) + .WithMany(p => p.Expenses) + .HasForeignKey(e => e.PropertyId) + .OnDelete(DeleteBehavior.Restrict); + + // Decimal precision for Amount field + entity.Property(e => e.Amount).HasPrecision(18, 2); + + // Mandatory 1:1 recurrence definition, owned by PropertyExpense and + // stored in the same table (shared primary key, no independent + // existence or identity of its own). + entity.OwnsOne(e => e.RecurrencePattern, pattern => + { + pattern.Property(p => p.Frequency).HasColumnName("RecurrenceFrequency").IsRequired().HasMaxLength(20); + pattern.Property(p => p.DueDayOfMonth).HasColumnName("RecurrenceDueDayOfMonth"); + pattern.Property(p => p.AnchorMonth).HasColumnName("RecurrenceAnchorMonth"); + }); + entity.Navigation(e => e.RecurrencePattern).IsRequired(); + + // Indexes for query optimization + entity.HasIndex(e => e.OrganizationId); + entity.HasIndex(e => e.PropertyId); + entity.HasIndex(e => e.ExpenseType); + entity.HasIndex(e => e.EffectiveDate); + }); + + // Configure ExpenseDue entity + modelBuilder.Entity(entity => + { + // Cascade on delete: PropertyExpense is only ever hard-deleted via + // VoidExpenseAsync (an expense entered in error), which is intended + // to remove the expense and all its ExpenseDue/ExpensePayment + // history as if it never existed. CancelExpenseAsync (the normal + // "this expense has ended" path) never deletes the row, so this + // cascade cannot be triggered by anything other than Void. + entity.HasOne(e => e.PropertyExpense) + .WithMany(p => p.ExpenseDues) + .HasForeignKey(e => e.PropertyExpenseId) + .OnDelete(DeleteBehavior.Cascade); + + entity.Property(e => e.AmountDue).HasPrecision(18, 2); + + entity.HasIndex(e => e.OrganizationId); + entity.HasIndex(e => e.PropertyExpenseId); + entity.HasIndex(e => e.PropertyId); + entity.HasIndex(e => e.DueDate); + }); + + // Configure ExpensePayment entity + modelBuilder.Entity(entity => + { + entity.HasOne(e => e.ExpenseDue) + .WithMany(d => d.Payments) + .HasForeignKey(e => e.ExpenseDueId) + .OnDelete(DeleteBehavior.Cascade); + + entity.Property(e => e.AmountPaid).HasPrecision(18, 2); + + entity.HasIndex(e => e.OrganizationId); + entity.HasIndex(e => e.ExpenseDueId); + entity.HasIndex(e => e.PaidOn); + }); + // Configure OrganizationSettings entity modelBuilder.Entity(entity => { diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs b/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs index 92c2394..b5d7192 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs @@ -1,7 +1,7 @@ // +using Microsoft.EntityFrameworkCore.Infrastructure; using Nine.Infrastructure.Data; using Nine.Infrastructure.Data.CompiledModels; -using Microsoft.EntityFrameworkCore.Infrastructure; #pragma warning disable 219, 612, 618 #nullable disable diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs b/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs index 5809e0d..b6f3ec4 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs @@ -11,7 +11,7 @@ namespace Nine.Infrastructure.Data.CompiledModels public partial class ApplicationDbContextModel { private ApplicationDbContextModel() - : base(skipDetectChanges: false, modelId: new Guid("409a29cb-f330-41bb-8099-305ed7a81084"), entityTypeCount: 35) + : base(skipDetectChanges: false, modelId: new Guid("927d7770-b498-4af1-823a-f66b01919da1"), entityTypeCount: 39) { } @@ -26,6 +26,8 @@ partial void Initialize() var checklistTemplateItem = ChecklistTemplateItemEntityType.Create(this); var databaseSettings = DatabaseSettingsEntityType.Create(this); var document = DocumentEntityType.Create(this); + var expenseDue = ExpenseDueEntityType.Create(this); + var expensePayment = ExpensePaymentEntityType.Create(this); var inspection = InspectionEntityType.Create(this); var invoice = InvoiceEntityType.Create(this); var lease = LeaseEntityType.Create(this); @@ -40,7 +42,9 @@ partial void Initialize() var organizationUser = OrganizationUserEntityType.Create(this); var payment = PaymentEntityType.Create(this); var property = PropertyEntityType.Create(this); + var propertyExpense = PropertyExpenseEntityType.Create(this); var prospectiveTenant = ProspectiveTenantEntityType.Create(this); + var recurrencePattern = RecurrencePatternEntityType.Create(this); var rentalApplication = RentalApplicationEntityType.Create(this); var repair = RepairEntityType.Create(this); var schemaVersion = SchemaVersionEntityType.Create(this); @@ -66,17 +70,19 @@ partial void Initialize() DocumentEntityType.CreateForeignKey3(document, organization); DocumentEntityType.CreateForeignKey4(document, payment); DocumentEntityType.CreateForeignKey5(document, property); - DocumentEntityType.CreateForeignKey6(document, tenant); + DocumentEntityType.CreateForeignKey6(document, repair); + DocumentEntityType.CreateForeignKey7(document, tenant); + ExpenseDueEntityType.CreateForeignKey1(expenseDue, propertyExpense); + ExpensePaymentEntityType.CreateForeignKey1(expensePayment, expenseDue); InspectionEntityType.CreateForeignKey1(inspection, document); InspectionEntityType.CreateForeignKey2(inspection, lease); InspectionEntityType.CreateForeignKey3(inspection, property); InvoiceEntityType.CreateForeignKey1(invoice, document); InvoiceEntityType.CreateForeignKey2(invoice, lease); InvoiceEntityType.CreateForeignKey3(invoice, organization); - LeaseEntityType.CreateForeignKey1(lease, document); - LeaseEntityType.CreateForeignKey2(lease, organization); - LeaseEntityType.CreateForeignKey3(lease, property); - LeaseEntityType.CreateForeignKey4(lease, tenant); + LeaseEntityType.CreateForeignKey1(lease, organization); + LeaseEntityType.CreateForeignKey2(lease, property); + LeaseEntityType.CreateForeignKey3(lease, tenant); LeaseOfferEntityType.CreateForeignKey1(leaseOffer, property); LeaseOfferEntityType.CreateForeignKey2(leaseOffer, prospectiveTenant); LeaseOfferEntityType.CreateForeignKey3(leaseOffer, rentalApplication); @@ -90,7 +96,9 @@ partial void Initialize() PaymentEntityType.CreateForeignKey2(payment, invoice); PaymentEntityType.CreateForeignKey3(payment, organization); PropertyEntityType.CreateForeignKey1(property, organization); + PropertyExpenseEntityType.CreateForeignKey1(propertyExpense, property); ProspectiveTenantEntityType.CreateForeignKey1(prospectiveTenant, property); + RecurrencePatternEntityType.CreateForeignKey1(recurrencePattern, propertyExpense); RentalApplicationEntityType.CreateForeignKey1(rentalApplication, property); RentalApplicationEntityType.CreateForeignKey2(rentalApplication, prospectiveTenant); RepairEntityType.CreateForeignKey1(repair, lease); @@ -117,6 +125,8 @@ partial void Initialize() ChecklistTemplateItemEntityType.CreateAnnotations(checklistTemplateItem); DatabaseSettingsEntityType.CreateAnnotations(databaseSettings); DocumentEntityType.CreateAnnotations(document); + ExpenseDueEntityType.CreateAnnotations(expenseDue); + ExpensePaymentEntityType.CreateAnnotations(expensePayment); InspectionEntityType.CreateAnnotations(inspection); InvoiceEntityType.CreateAnnotations(invoice); LeaseEntityType.CreateAnnotations(lease); @@ -131,7 +141,9 @@ partial void Initialize() OrganizationUserEntityType.CreateAnnotations(organizationUser); PaymentEntityType.CreateAnnotations(payment); PropertyEntityType.CreateAnnotations(property); + PropertyExpenseEntityType.CreateAnnotations(propertyExpense); ProspectiveTenantEntityType.CreateAnnotations(prospectiveTenant); + RecurrencePatternEntityType.CreateAnnotations(recurrencePattern); RentalApplicationEntityType.CreateAnnotations(rentalApplication); RepairEntityType.CreateAnnotations(repair); SchemaVersionEntityType.CreateAnnotations(schemaVersion); diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs index 98e7097..19ce5ca 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.ApplicationScreening", typeof(ApplicationScreening), baseEntityType, - propertyCount: 22, + propertyCount: 25, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 3, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var backgroundCheckCompletedOn = runtimeEntityType.AddProperty( "BackgroundCheckCompletedOn", typeof(DateTime?), @@ -127,6 +142,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs index 3b795ff..6c98a30 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.CalendarEvent", typeof(CalendarEvent), baseEntityType, - propertyCount: 21, + propertyCount: 24, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 6, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var color = runtimeEntityType.AddProperty( "Color", typeof(string), @@ -91,6 +106,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 50); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs index 72fd326..29296e3 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.CalendarSettings", typeof(CalendarSettings), baseEntityType, - propertyCount: 14, + propertyCount: 17, unnamedIndexCount: 2, keyCount: 1); @@ -31,6 +31,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var autoCreateEvents = runtimeEntityType.AddProperty( "AutoCreateEvents", typeof(bool), @@ -79,6 +94,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CalendarSettings).GetProperty("EntityType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CalendarSettings).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs index 1559192..c346827 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Checklist", typeof(Checklist), baseEntityType, - propertyCount: 18, + propertyCount: 21, navigationCount: 5, foreignKeyCount: 4, unnamedIndexCount: 7, @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var checklistTemplateId = runtimeEntityType.AddProperty( "ChecklistTemplateId", typeof(Guid), @@ -93,6 +108,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 2000); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs index 4e97e52..61e5673 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.ChecklistItem", typeof(ChecklistItem), baseEntityType, - propertyCount: 18, + propertyCount: 21, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 1, @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var categorySection = runtimeEntityType.AddProperty( "CategorySection", typeof(string), @@ -64,6 +79,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isChecked = runtimeEntityType.AddProperty( "IsChecked", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs index 786bb62..6560ad3 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.ChecklistTemplate", typeof(ChecklistTemplate), baseEntityType, - propertyCount: 12, + propertyCount: 15, navigationCount: 2, unnamedIndexCount: 2, keyCount: 1); @@ -32,6 +32,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var category = runtimeEntityType.AddProperty( "Category", typeof(string), @@ -61,6 +76,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 500); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs index 7971e92..848f5e8 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.ChecklistTemplateItem", typeof(ChecklistTemplateItem), baseEntityType, - propertyCount: 16, + propertyCount: 19, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 1, @@ -42,6 +42,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(ChecklistTemplateItem).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var categorySection = runtimeEntityType.AddProperty( "CategorySection", typeof(string), @@ -71,6 +86,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs index 3c32d5d..42f21ef 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable diff --git a/1-Nine.Infrastructure/Data/CompiledModels/DocumentEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/DocumentEntityType.cs index 63c2472..c9a816d 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/DocumentEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/DocumentEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,10 +21,10 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Document", typeof(Document), baseEntityType, - propertyCount: 22, - navigationCount: 5, - foreignKeyCount: 6, - unnamedIndexCount: 6, + propertyCount: 26, + navigationCount: 6, + foreignKeyCount: 7, + unnamedIndexCount: 7, keyCount: 1); var id = runtimeEntityType.AddProperty( @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var contentType = runtimeEntityType.AddProperty( "ContentType", typeof(string), @@ -118,6 +133,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Document).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), @@ -175,6 +197,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Document).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var repairId = runtimeEntityType.AddProperty( + "RepairId", + typeof(Guid?), + propertyInfo: typeof(Document).GetProperty("RepairId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var tenantId = runtimeEntityType.AddProperty( "TenantId", typeof(Guid?), @@ -202,6 +231,9 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new[] { propertyId }); var index4 = runtimeEntityType.AddIndex( + new[] { repairId }); + + var index5 = runtimeEntityType.AddIndex( new[] { tenantId }); return runtimeEntityType; @@ -301,6 +333,30 @@ public static RuntimeForeignKey CreateForeignKey5(RuntimeEntityType declaringEnt } public static RuntimeForeignKey CreateForeignKey6(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RepairId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var repair = declaringEntityType.AddNavigation("Repair", + runtimeForeignKey, + onDependent: true, + typeof(Repair), + propertyInfo: typeof(Document).GetProperty("Repair", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var documents = principalEntityType.AddNavigation("Documents", + runtimeForeignKey, + onDependent: false, + typeof(ICollection), + propertyInfo: typeof(Repair).GetProperty("Documents", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey7(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TenantId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ExpenseDueEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ExpenseDueEntityType.cs new file mode 100644 index 0000000..f2e57e3 --- /dev/null +++ b/1-Nine.Infrastructure/Data/CompiledModels/ExpenseDueEntityType.cs @@ -0,0 +1,222 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Nine.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ExpenseDueEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Nine.Core.Entities.ExpenseDue", + typeof(ExpenseDue), + baseEntityType, + propertyCount: 18, + navigationCount: 2, + foreignKeyCount: 1, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var amountDue = runtimeEntityType.AddProperty( + "AmountDue", + typeof(decimal), + propertyInfo: typeof(ExpenseDue).GetProperty("AmountDue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amountDue.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dueDate = runtimeEntityType.AddProperty( + "DueDate", + typeof(DateTime), + propertyInfo: typeof(ExpenseDue).GetProperty("DueDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(ExpenseDue).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyExpenseId = runtimeEntityType.AddProperty( + "PropertyExpenseId", + typeof(Guid), + propertyInfo: typeof(ExpenseDue).GetProperty("PropertyExpenseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(ExpenseDue).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var waivedOn = runtimeEntityType.AddProperty( + "WaivedOn", + typeof(DateTime?), + propertyInfo: typeof(ExpenseDue).GetProperty("WaivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var waivedReason = runtimeEntityType.AddProperty( + "WaivedReason", + typeof(string), + propertyInfo: typeof(ExpenseDue).GetProperty("WaivedReason", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { dueDate }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { propertyExpenseId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyExpenseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var propertyExpense = declaringEntityType.AddNavigation("PropertyExpense", + runtimeForeignKey, + onDependent: true, + typeof(PropertyExpense), + propertyInfo: typeof(ExpenseDue).GetProperty("PropertyExpense", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var expenseDues = principalEntityType.AddNavigation("ExpenseDues", + runtimeForeignKey, + onDependent: false, + typeof(ICollection), + propertyInfo: typeof(PropertyExpense).GetProperty("ExpenseDues", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ExpenseDues"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ExpensePaymentEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ExpensePaymentEntityType.cs new file mode 100644 index 0000000..cdb5408 --- /dev/null +++ b/1-Nine.Infrastructure/Data/CompiledModels/ExpensePaymentEntityType.cs @@ -0,0 +1,197 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Nine.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ExpensePaymentEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Nine.Core.Entities.ExpensePayment", + typeof(ExpensePayment), + baseEntityType, + propertyCount: 15, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var amountPaid = runtimeEntityType.AddProperty( + "AmountPaid", + typeof(decimal), + propertyInfo: typeof(ExpensePayment).GetProperty("AmountPaid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpensePayment).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amountPaid.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var expenseDueId = runtimeEntityType.AddProperty( + "ExpenseDueId", + typeof(Guid), + propertyInfo: typeof(ExpensePayment).GetProperty("ExpenseDueId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpensePayment).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(ExpensePayment).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpensePayment).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var paidOn = runtimeEntityType.AddProperty( + "PaidOn", + typeof(DateTime), + propertyInfo: typeof(ExpensePayment).GetProperty("PaidOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpensePayment).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { expenseDueId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { paidOn }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ExpenseDueId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var expenseDue = declaringEntityType.AddNavigation("ExpenseDue", + runtimeForeignKey, + onDependent: true, + typeof(ExpenseDue), + propertyInfo: typeof(ExpensePayment).GetProperty("ExpenseDue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpensePayment).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var payments = principalEntityType.AddNavigation("Payments", + runtimeForeignKey, + onDependent: false, + typeof(ICollection), + propertyInfo: typeof(ExpenseDue).GetProperty("Payments", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ExpenseDue).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ExpensePayments"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Nine.Infrastructure/Data/CompiledModels/InspectionEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/InspectionEntityType.cs index 3904fbf..dd39f4c 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/InspectionEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/InspectionEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Inspection", typeof(Inspection), baseEntityType, - propertyCount: 68, + propertyCount: 71, navigationCount: 3, foreignKeyCount: 3, unnamedIndexCount: 4, @@ -42,6 +42,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 2000); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var bathroomSinkGood = runtimeEntityType.AddProperty( "BathroomSinkGood", typeof(bool), @@ -352,6 +367,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Inspection).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs index 5d8dac5..d4dd10c 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Invoice", typeof(Invoice), baseEntityType, - propertyCount: 24, + propertyCount: 27, navigationCount: 3, foreignKeyCount: 3, unnamedIndexCount: 3, @@ -55,6 +55,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas sentinel: 0m); amountPaid.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -104,6 +119,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Invoice).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/LeaseEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/LeaseEntityType.cs index b51c21a..4f3eed1 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/LeaseEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/LeaseEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,9 +21,9 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Lease", typeof(Lease), baseEntityType, - propertyCount: 37, - navigationCount: 5, - foreignKeyCount: 4, + propertyCount: 41, + navigationCount: 4, + foreignKeyCount: 3, unnamedIndexCount: 4, keyCount: 1); @@ -42,6 +42,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -63,13 +78,6 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); - var documentId = runtimeEntityType.AddProperty( - "DocumentId", - typeof(Guid?), - propertyInfo: typeof(Lease).GetProperty("DocumentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - nullable: true); - var endDate = runtimeEntityType.AddProperty( "EndDate", typeof(DateTime), @@ -91,6 +99,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isActive = runtimeEntityType.AddProperty( + "IsActive", + typeof(bool), + propertyInfo: typeof(Lease).GetProperty("IsActive", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), @@ -127,6 +149,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var leaseType = runtimeEntityType.AddProperty( + "LeaseType", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("LeaseType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + var monthlyRent = runtimeEntityType.AddProperty( "MonthlyRent", typeof(decimal), @@ -303,7 +332,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas runtimeEntityType.SetPrimaryKey(key); var index = runtimeEntityType.AddIndex( - new[] { documentId }); + new[] { isActive }); var index0 = runtimeEntityType.AddIndex( new[] { organizationId }); @@ -318,23 +347,6 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) - { - var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DocumentId") }, - principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), - principalEntityType, - deleteBehavior: DeleteBehavior.SetNull); - - var document = declaringEntityType.AddNavigation("Document", - runtimeForeignKey, - onDependent: true, - typeof(Document), - propertyInfo: typeof(Lease).GetProperty("Document", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(Lease).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); - - return runtimeForeignKey; - } - - public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), @@ -352,7 +364,7 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt return runtimeForeignKey; } - public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), @@ -377,7 +389,7 @@ public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEnt return runtimeForeignKey; } - public static RuntimeForeignKey CreateForeignKey4(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) { var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TenantId") }, principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs index a771b7f..eed66d3 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.LeaseOffer", typeof(LeaseOffer), baseEntityType, - propertyCount: 23, + propertyCount: 26, navigationCount: 3, foreignKeyCount: 3, unnamedIndexCount: 3, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var convertedLeaseId = runtimeEntityType.AddProperty( "ConvertedLeaseId", typeof(Guid?), @@ -69,6 +84,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(LeaseOffer).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs index 28a177e..110f5c7 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.MaintenanceRequest", typeof(MaintenanceRequest), baseEntityType, - propertyCount: 26, + propertyCount: 29, navigationCount: 3, foreignKeyCount: 2, unnamedIndexCount: 5, @@ -45,6 +45,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas sentinel: 0m); actualCost.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var assignedTo = runtimeEntityType.AddProperty( "AssignedTo", typeof(string), @@ -97,6 +112,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas sentinel: 0m); estimatedCost.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/NoteEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/NoteEntityType.cs index acd0089..3eb0839 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/NoteEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/NoteEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Note", typeof(Note), baseEntityType, - propertyCount: 12, + propertyCount: 15, keyCount: 1); var id = runtimeEntityType.AddProperty( @@ -30,6 +30,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var content = runtimeEntityType.AddProperty( "Content", typeof(string), @@ -65,6 +80,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Note).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 100); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/NotificationEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/NotificationEntityType.cs index 1a371ba..10794fa 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/NotificationEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/NotificationEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Notification", typeof(Notification), baseEntityType, - propertyCount: 27, + propertyCount: 30, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 5, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var category = runtimeEntityType.AddProperty( "Category", typeof(string), @@ -77,6 +92,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Notification).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs index 2fcdfa5..17f334c 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.NotificationPreferences", typeof(NotificationPreferences), baseEntityType, - propertyCount: 27, + propertyCount: 30, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 3, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -140,6 +155,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(NotificationPreferences).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs index 1f6c56a..74528aa 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.OrganizationEmailSettings", typeof(OrganizationEmailSettings), baseEntityType, - propertyCount: 31, + propertyCount: 34, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 1, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -99,6 +114,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 200); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs index da29a37..98a6b3e 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable diff --git a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs index 87a070c..ac41aff 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.OrganizationSMSSettings", typeof(OrganizationSMSSettings), baseEntityType, - propertyCount: 25, + propertyCount: 28, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 1, @@ -51,6 +51,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 100); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var costPerSMS = runtimeEntityType.AddProperty( "CostPerSMS", typeof(decimal?), @@ -81,6 +96,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(OrganizationSMSSettings).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs index e046e8a..5984a85 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.OrganizationSettings", typeof(OrganizationSettings), baseEntityType, - propertyCount: 28, + propertyCount: 31, unnamedIndexCount: 1, keyCount: 1); @@ -52,6 +52,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(OrganizationSettings).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var autoCalculateSecurityDeposit = runtimeEntityType.AddProperty( "AutoCalculateSecurityDeposit", typeof(bool), @@ -96,6 +111,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(OrganizationSettings).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs index 4efc2be..0a28fc7 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable diff --git a/1-Nine.Infrastructure/Data/CompiledModels/PaymentEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/PaymentEntityType.cs index 6bc1949..9d08298 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/PaymentEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/PaymentEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Payment", typeof(Payment), baseEntityType, - propertyCount: 15, + propertyCount: 18, navigationCount: 2, foreignKeyCount: 3, unnamedIndexCount: 3, @@ -45,6 +45,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas sentinel: 0m); amount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -73,6 +88,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Payment).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/PropertyEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/PropertyEntityType.cs index 5948734..ced7af8 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/PropertyEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/PropertyEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,8 +21,8 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Property", typeof(Property), baseEntityType, - propertyCount: 24, - navigationCount: 4, + propertyCount: 27, + navigationCount: 5, foreignKeyCount: 1, unnamedIndexCount: 2, keyCount: 1); @@ -42,6 +42,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Property).GetField("
k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), maxLength: 200); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var bathrooms = runtimeEntityType.AddProperty( "Bathrooms", typeof(decimal), @@ -94,6 +109,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Property).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/PropertyExpenseEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/PropertyExpenseEntityType.cs new file mode 100644 index 0000000..464d493 --- /dev/null +++ b/1-Nine.Infrastructure/Data/CompiledModels/PropertyExpenseEntityType.cs @@ -0,0 +1,228 @@ +// +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Nine.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class PropertyExpenseEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Nine.Core.Entities.PropertyExpense", + typeof(PropertyExpense), + baseEntityType, + propertyCount: 19, + navigationCount: 3, + foreignKeyCount: 1, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var amount = runtimeEntityType.AddProperty( + "Amount", + typeof(decimal), + propertyInfo: typeof(PropertyExpense).GetProperty("Amount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(PropertyExpense).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var effectiveDate = runtimeEntityType.AddProperty( + "EffectiveDate", + typeof(DateTime), + propertyInfo: typeof(PropertyExpense).GetProperty("EffectiveDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var endDate = runtimeEntityType.AddProperty( + "EndDate", + typeof(DateTime?), + propertyInfo: typeof(PropertyExpense).GetProperty("EndDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var endReason = runtimeEntityType.AddProperty( + "EndReason", + typeof(string), + propertyInfo: typeof(PropertyExpense).GetProperty("EndReason", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var expenseType = runtimeEntityType.AddProperty( + "ExpenseType", + typeof(string), + propertyInfo: typeof(PropertyExpense).GetProperty("ExpenseType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(PropertyExpense).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(PropertyExpense).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { effectiveDate }); + + var index0 = runtimeEntityType.AddIndex( + new[] { expenseType }); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(PropertyExpense).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var expenses = principalEntityType.AddNavigation("Expenses", + runtimeForeignKey, + onDependent: false, + typeof(ICollection), + propertyInfo: typeof(Property).GetProperty("Expenses", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PropertyExpenses"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Nine.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs index 0e7e38f..122b71d 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.ProspectiveTenant", typeof(ProspectiveTenant), baseEntityType, - propertyCount: 21, + propertyCount: 24, navigationCount: 3, foreignKeyCount: 1, unnamedIndexCount: 4, @@ -34,6 +34,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -106,6 +121,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(ProspectiveTenant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/RecurrencePatternEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/RecurrencePatternEntityType.cs new file mode 100644 index 0000000..7ae5601 --- /dev/null +++ b/1-Nine.Infrastructure/Data/CompiledModels/RecurrencePatternEntityType.cs @@ -0,0 +1,100 @@ +// +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Nine.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class RecurrencePatternEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Nine.Core.Entities.RecurrencePattern", + typeof(RecurrencePattern), + baseEntityType, + propertyCount: 4, + foreignKeyCount: 1, + keyCount: 1); + + var propertyExpenseId = runtimeEntityType.AddProperty( + "PropertyExpenseId", + typeof(Guid), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var anchorMonth = runtimeEntityType.AddProperty( + "AnchorMonth", + typeof(int?), + propertyInfo: typeof(RecurrencePattern).GetProperty("AnchorMonth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RecurrencePattern).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + anchorMonth.AddAnnotation("Relational:ColumnName", "RecurrenceAnchorMonth"); + + var dueDayOfMonth = runtimeEntityType.AddProperty( + "DueDayOfMonth", + typeof(int?), + propertyInfo: typeof(RecurrencePattern).GetProperty("DueDayOfMonth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RecurrencePattern).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + dueDayOfMonth.AddAnnotation("Relational:ColumnName", "RecurrenceDueDayOfMonth"); + + var frequency = runtimeEntityType.AddProperty( + "Frequency", + typeof(string), + propertyInfo: typeof(RecurrencePattern).GetProperty("Frequency", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RecurrencePattern).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + frequency.AddAnnotation("Relational:ColumnName", "RecurrenceFrequency"); + + var key = runtimeEntityType.AddKey( + new[] { propertyExpenseId }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyExpenseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true, + requiredDependent: true, + ownership: true); + + var recurrencePattern = principalEntityType.AddNavigation("RecurrencePattern", + runtimeForeignKey, + onDependent: false, + typeof(RecurrencePattern), + propertyInfo: typeof(PropertyExpense).GetProperty("RecurrencePattern", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(PropertyExpense).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + eagerLoaded: true); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "PropertyExpenses"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Nine.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs index 61303a3..b7a2cd3 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.RentalApplication", typeof(RentalApplication), baseEntityType, - propertyCount: 37, + propertyCount: 40, navigationCount: 3, foreignKeyCount: 2, unnamedIndexCount: 5, @@ -74,6 +74,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(RentalApplication).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -170,6 +185,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(RentalApplication).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/RepairEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/RepairEntityType.cs index ec71120..bc5e1cc 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/RepairEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/RepairEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,8 +21,8 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Repair", typeof(Repair), baseEntityType, - propertyCount: 25, - navigationCount: 3, + propertyCount: 28, + navigationCount: 4, foreignKeyCount: 3, unnamedIndexCount: 6, keyCount: 1); @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var completedOn = runtimeEntityType.AddProperty( "CompletedOn", typeof(DateTime?), @@ -115,6 +130,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Repair).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs index 1aa409f..4bad2b7 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable diff --git a/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs index 4fb0192..b1c1877 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.SecurityDepositDividend", typeof(SecurityDepositDividend), baseEntityType, - propertyCount: 24, + propertyCount: 27, navigationCount: 4, foreignKeyCount: 4, unnamedIndexCount: 6, @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var baseDividendAmount = runtimeEntityType.AddProperty( "BaseDividendAmount", typeof(decimal), @@ -83,6 +98,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(SecurityDepositDividend).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs index 94fc7d9..8aef613 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs @@ -1,10 +1,10 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -20,7 +20,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.SecurityDeposit", typeof(SecurityDeposit), baseEntityType, - propertyCount: 25, + propertyCount: 28, navigationCount: 3, foreignKeyCount: 2, unnamedIndexCount: 4, @@ -44,6 +44,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas sentinel: 0m); amount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -90,6 +105,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(SecurityDeposit).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs index eebe73f..661bdcd 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.SecurityDepositInvestmentPool", typeof(SecurityDepositInvestmentPool), baseEntityType, - propertyCount: 22, + propertyCount: 25, navigationCount: 1, unnamedIndexCount: 3, keyCount: 1); @@ -39,6 +39,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -87,6 +102,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas sentinel: 0m); endingBalance.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/TenantEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/TenantEntityType.cs index e01bcdd..c68c7df 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/TenantEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/TenantEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Tenant", typeof(Tenant), baseEntityType, - propertyCount: 19, + propertyCount: 22, navigationCount: 1, foreignKeyCount: 1, unnamedIndexCount: 3, @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -99,6 +114,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(Tenant).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/TourEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/TourEntityType.cs index 44c0fb6..3719624 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/TourEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/TourEntityType.cs @@ -2,10 +2,10 @@ using System; using System.Collections.Generic; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -21,7 +21,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.Tour", typeof(Tour), baseEntityType, - propertyCount: 18, + propertyCount: 21, navigationCount: 3, foreignKeyCount: 3, unnamedIndexCount: 6, @@ -35,6 +35,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var calendarEventId = runtimeEntityType.AddProperty( "CalendarEventId", typeof(Guid?), @@ -94,6 +109,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 50); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs index 7d92fd0..28cc6be 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.UserProfile", typeof(UserProfile), baseEntityType, - propertyCount: 14, + propertyCount: 17, unnamedIndexCount: 5, keyCount: 1); @@ -38,6 +38,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(UserProfile).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -64,6 +79,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(UserProfile).GetProperty("FirstName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(UserProfile).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs b/1-Nine.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs index 84eda6b..a8e9265 100644 --- a/1-Nine.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs +++ b/1-Nine.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs @@ -1,9 +1,9 @@ // using System; using System.Reflection; -using Nine.Core.Entities; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Nine.Core.Entities; #pragma warning disable 219, 612, 618 #nullable disable @@ -19,7 +19,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "Nine.Core.Entities.WorkflowAuditLog", typeof(WorkflowAuditLog), baseEntityType, - propertyCount: 17, + propertyCount: 20, unnamedIndexCount: 7, keyCount: 1); @@ -37,6 +37,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(WorkflowAuditLog).GetProperty("Action", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(WorkflowAuditLog).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + var archivedBy = runtimeEntityType.AddProperty( + "ArchivedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var archivedOn = runtimeEntityType.AddProperty( + "ArchivedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("ArchivedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + var createdBy = runtimeEntityType.AddProperty( "CreatedBy", typeof(string), @@ -71,6 +86,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(WorkflowAuditLog).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + var isArchived = runtimeEntityType.AddProperty( + "IsArchived", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsArchived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + var isDeleted = runtimeEntityType.AddProperty( "IsDeleted", typeof(bool), diff --git a/1-Nine.Infrastructure/Data/Migrations/20260409165248_AddLeaseIsActive.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260409165248_AddLeaseIsActive.Designer.cs new file mode 100644 index 0000000..740b241 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260409165248_AddLeaseIsActive.Designer.cs @@ -0,0 +1,4397 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260409165248_AddLeaseIsActive")] + partial class AddLeaseIsActive + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260409165248_AddLeaseIsActive.cs b/1-Nine.Infrastructure/Data/Migrations/20260409165248_AddLeaseIsActive.cs new file mode 100644 index 0000000..1f66699 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260409165248_AddLeaseIsActive.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Migrations +{ + /// + public partial class AddLeaseIsActive : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsActive", + table: "Leases", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateIndex( + name: "IX_Leases_IsActive", + table: "Leases", + column: "IsActive"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_Leases_IsActive", + table: "Leases"); + + migrationBuilder.DropColumn( + name: "IsActive", + table: "Leases"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260416173124_AddIsArchived.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260416173124_AddIsArchived.Designer.cs new file mode 100644 index 0000000..484152e --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260416173124_AddIsArchived.Designer.cs @@ -0,0 +1,4743 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260416173124_AddIsArchived")] + partial class AddIsArchived + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260416173124_AddIsArchived.cs b/1-Nine.Infrastructure/Data/Migrations/20260416173124_AddIsArchived.cs new file mode 100644 index 0000000..03b8ded --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260416173124_AddIsArchived.cs @@ -0,0 +1,1263 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Migrations +{ + /// + public partial class AddIsArchived : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "WorkflowAuditLogs", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "WorkflowAuditLogs", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "WorkflowAuditLogs", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "UserProfiles", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "UserProfiles", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "UserProfiles", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Tours", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Tours", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Tours", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Tenants", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Tenants", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Tenants", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "SecurityDeposits", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "SecurityDeposits", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "SecurityDeposits", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "SecurityDepositInvestmentPools", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "SecurityDepositInvestmentPools", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "SecurityDepositInvestmentPools", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "SecurityDepositDividends", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "SecurityDepositDividends", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "SecurityDepositDividends", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Repairs", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Repairs", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Repairs", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "RentalApplications", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "RentalApplications", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "RentalApplications", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "ProspectiveTenants", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "ProspectiveTenants", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "ProspectiveTenants", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Properties", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Properties", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Properties", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Payments", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Payments", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Payments", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "OrganizationSMSSettings", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "OrganizationSMSSettings", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "OrganizationSMSSettings", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "OrganizationSettings", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "OrganizationSettings", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "OrganizationSettings", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "OrganizationEmailSettings", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "OrganizationEmailSettings", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "OrganizationEmailSettings", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Notifications", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Notifications", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Notifications", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "NotificationPreferences", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "NotificationPreferences", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "NotificationPreferences", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Notes", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Notes", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Notes", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "MaintenanceRequests", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "MaintenanceRequests", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "MaintenanceRequests", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Leases", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Leases", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Leases", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "LeaseOffers", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "LeaseOffers", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "LeaseOffers", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Invoices", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Invoices", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Invoices", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Inspections", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Inspections", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Inspections", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Documents", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Documents", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Documents", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "ChecklistTemplates", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "ChecklistTemplates", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "ChecklistTemplates", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "ChecklistTemplateItems", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "ChecklistTemplateItems", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "ChecklistTemplateItems", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "Checklists", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "Checklists", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "Checklists", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "ChecklistItems", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "ChecklistItems", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "ChecklistItems", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "CalendarSettings", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "CalendarSettings", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "CalendarSettings", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "CalendarEvents", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "CalendarEvents", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "CalendarEvents", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ArchivedBy", + table: "ApplicationScreenings", + type: "TEXT", + maxLength: 100, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchivedOn", + table: "ApplicationScreenings", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsArchived", + table: "ApplicationScreenings", + type: "INTEGER", + nullable: false, + defaultValue: false); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000001"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000002"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000003"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000004"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000005"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000006"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000007"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000008"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000009"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000010"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000011"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000012"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000013"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000014"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000015"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000016"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000017"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000018"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000019"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000020"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000021"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000022"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000023"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000024"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000025"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000026"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000027"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000028"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000029"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000030"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000031"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplateItems", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0002-000000000032"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplates", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0001-000000000001"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplates", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0001-000000000002"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplates", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0001-000000000003"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + + migrationBuilder.UpdateData( + table: "ChecklistTemplates", + keyColumn: "Id", + keyValue: new Guid("00000000-0000-0000-0001-000000000004"), + columns: new[] { "ArchivedBy", "ArchivedOn", "IsArchived" }, + values: new object[] { null, null, false }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "WorkflowAuditLogs"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "WorkflowAuditLogs"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "WorkflowAuditLogs"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "UserProfiles"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "UserProfiles"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "UserProfiles"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Tours"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Tours"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Tours"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Tenants"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Tenants"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Tenants"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "SecurityDeposits"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "SecurityDeposits"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "SecurityDeposits"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "SecurityDepositInvestmentPools"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "SecurityDepositInvestmentPools"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "SecurityDepositInvestmentPools"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "SecurityDepositDividends"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "SecurityDepositDividends"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "SecurityDepositDividends"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Repairs"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Repairs"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Repairs"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "RentalApplications"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "RentalApplications"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "RentalApplications"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "ProspectiveTenants"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "ProspectiveTenants"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "ProspectiveTenants"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Properties"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Properties"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Properties"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Payments"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Payments"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Payments"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "OrganizationSMSSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "OrganizationSMSSettings"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "OrganizationSMSSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "OrganizationSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "OrganizationSettings"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "OrganizationSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "OrganizationEmailSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "OrganizationEmailSettings"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "OrganizationEmailSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Notifications"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Notifications"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Notifications"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "NotificationPreferences"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "NotificationPreferences"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "NotificationPreferences"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Notes"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Notes"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Notes"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "MaintenanceRequests"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "MaintenanceRequests"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "MaintenanceRequests"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Leases"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Leases"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Leases"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "LeaseOffers"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "LeaseOffers"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "LeaseOffers"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Invoices"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Invoices"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Invoices"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Inspections"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Inspections"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Inspections"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Documents"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Documents"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Documents"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "ChecklistTemplates"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "ChecklistTemplates"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "ChecklistTemplates"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "ChecklistTemplateItems"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "ChecklistTemplateItems"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "ChecklistTemplateItems"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "Checklists"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "Checklists"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "Checklists"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "ChecklistItems"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "ChecklistItems"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "ChecklistItems"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "CalendarSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "CalendarSettings"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "CalendarSettings"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "CalendarEvents"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "CalendarEvents"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "CalendarEvents"); + + migrationBuilder.DropColumn( + name: "ArchivedBy", + table: "ApplicationScreenings"); + + migrationBuilder.DropColumn( + name: "ArchivedOn", + table: "ApplicationScreenings"); + + migrationBuilder.DropColumn( + name: "IsArchived", + table: "ApplicationScreenings"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260421174413_RemoveLease_DocumentId.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260421174413_RemoveLease_DocumentId.Designer.cs new file mode 100644 index 0000000..570f30f --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260421174413_RemoveLease_DocumentId.Designer.cs @@ -0,0 +1,4731 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260421174413_RemoveLease_DocumentId")] + partial class RemoveLease_DocumentId + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260421174413_RemoveLease_DocumentId.cs b/1-Nine.Infrastructure/Data/Migrations/20260421174413_RemoveLease_DocumentId.cs new file mode 100644 index 0000000..4e9334b --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260421174413_RemoveLease_DocumentId.cs @@ -0,0 +1,50 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Migrations +{ + /// + public partial class RemoveLease_DocumentId : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Leases_Documents_DocumentId", + table: "Leases"); + + migrationBuilder.DropIndex( + name: "IX_Leases_DocumentId", + table: "Leases"); + + migrationBuilder.DropColumn( + name: "DocumentId", + table: "Leases"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DocumentId", + table: "Leases", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Leases_DocumentId", + table: "Leases", + column: "DocumentId"); + + migrationBuilder.AddForeignKey( + name: "FK_Leases_Documents_DocumentId", + table: "Leases", + column: "DocumentId", + principalTable: "Documents", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260816145144_AddPropertyExpense.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260816145144_AddPropertyExpense.Designer.cs new file mode 100644 index 0000000..5797f26 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260816145144_AddPropertyExpense.Designer.cs @@ -0,0 +1,4829 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260816145144_AddPropertyExpense")] + partial class AddPropertyExpense + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Expenses"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260816145144_AddPropertyExpense.cs b/1-Nine.Infrastructure/Data/Migrations/20260816145144_AddPropertyExpense.cs new file mode 100644 index 0000000..8cc2ec6 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260816145144_AddPropertyExpense.cs @@ -0,0 +1,77 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + /// + public partial class AddPropertyExpense : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "PropertyExpenses", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + PropertyId = table.Column(type: "TEXT", nullable: false), + ExpenseType = table.Column(type: "TEXT", maxLength: 50, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 200, nullable: false), + Amount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + Frequency = table.Column(type: "TEXT", maxLength: 20, nullable: false), + EffectiveDate = table.Column(type: "TEXT", nullable: false), + EndDate = table.Column(type: "TEXT", nullable: true), + Notes = table.Column(type: "TEXT", maxLength: 2000, nullable: false), + OrganizationId = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedBy = table.Column(type: "TEXT", maxLength: 100, nullable: false), + LastModifiedOn = table.Column(type: "TEXT", nullable: true), + LastModifiedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), + IsDeleted = table.Column(type: "INTEGER", nullable: false), + IsSampleData = table.Column(type: "INTEGER", nullable: false), + IsArchived = table.Column(type: "INTEGER", nullable: false), + ArchivedOn = table.Column(type: "TEXT", nullable: true), + ArchivedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PropertyExpenses", x => x.Id); + table.ForeignKey( + name: "FK_PropertyExpenses_Properties_PropertyId", + column: x => x.PropertyId, + principalTable: "Properties", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_PropertyExpenses_EffectiveDate", + table: "PropertyExpenses", + column: "EffectiveDate"); + + migrationBuilder.CreateIndex( + name: "IX_PropertyExpenses_ExpenseType", + table: "PropertyExpenses", + column: "ExpenseType"); + + migrationBuilder.CreateIndex( + name: "IX_PropertyExpenses_OrganizationId", + table: "PropertyExpenses", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_PropertyExpenses_PropertyId", + table: "PropertyExpenses", + column: "PropertyId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PropertyExpenses"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260817023718_AddPropertyExpense_EndReason.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260817023718_AddPropertyExpense_EndReason.Designer.cs new file mode 100644 index 0000000..c8ee212 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260817023718_AddPropertyExpense_EndReason.Designer.cs @@ -0,0 +1,4833 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260817023718_AddPropertyExpense_EndReason")] + partial class AddPropertyExpense_EndReason + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("EndReason") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Expenses"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260817023718_AddPropertyExpense_EndReason.cs b/1-Nine.Infrastructure/Data/Migrations/20260817023718_AddPropertyExpense_EndReason.cs new file mode 100644 index 0000000..3e4b56e --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260817023718_AddPropertyExpense_EndReason.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + /// + public partial class AddPropertyExpense_EndReason : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EndReason", + table: "PropertyExpenses", + type: "TEXT", + maxLength: 50, + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EndReason", + table: "PropertyExpenses"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260817045654_AddLeaseType.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260817045654_AddLeaseType.Designer.cs new file mode 100644 index 0000000..22e07a1 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260817045654_AddLeaseType.Designer.cs @@ -0,0 +1,4838 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260817045654_AddLeaseType")] + partial class AddLeaseType + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("LeaseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("EndReason") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Expenses"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260817045654_AddLeaseType.cs b/1-Nine.Infrastructure/Data/Migrations/20260817045654_AddLeaseType.cs new file mode 100644 index 0000000..365ad18 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260817045654_AddLeaseType.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + /// + public partial class AddLeaseType : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "LeaseType", + table: "Leases", + type: "TEXT", + maxLength: 50, + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "LeaseType", + table: "Leases"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260825113105_AddRecurrencePatternAndExpenseDue.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260825113105_AddRecurrencePatternAndExpenseDue.Designer.cs new file mode 100644 index 0000000..717ad6c --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260825113105_AddRecurrencePatternAndExpenseDue.Designer.cs @@ -0,0 +1,5035 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260825113105_AddRecurrencePatternAndExpenseDue")] + partial class AddRecurrencePatternAndExpenseDue + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountDue") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DueDate") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("WaivedOn") + .HasColumnType("TEXT"); + + b.Property("WaivedReason") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DueDate"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyExpenseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("ExpenseDueId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ExpenseDueId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaidOn"); + + b.ToTable("ExpensePayments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("LeaseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("EndReason") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.HasOne("Nine.Core.Entities.PropertyExpense", "PropertyExpense") + .WithMany("ExpenseDues") + .HasForeignKey("PropertyExpenseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PropertyExpense"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.HasOne("Nine.Core.Entities.ExpenseDue", "ExpenseDue") + .WithMany("Payments") + .HasForeignKey("ExpenseDueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExpenseDue"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsOne("Nine.Core.Entities.RecurrencePattern", "RecurrencePattern", b1 => + { + b1.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b1.Property("AnchorMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceAnchorMonth"); + + b1.Property("DueDayOfMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceDueDayOfMonth"); + + b1.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnName("RecurrenceFrequency"); + + b1.HasKey("PropertyExpenseId"); + + b1.ToTable("PropertyExpenses"); + + b1.WithOwner() + .HasForeignKey("PropertyExpenseId"); + }); + + b.Navigation("Property"); + + b.Navigation("RecurrencePattern") + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Expenses"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Navigation("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260825113105_AddRecurrencePatternAndExpenseDue.cs b/1-Nine.Infrastructure/Data/Migrations/20260825113105_AddRecurrencePatternAndExpenseDue.cs new file mode 100644 index 0000000..bf01914 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260825113105_AddRecurrencePatternAndExpenseDue.cs @@ -0,0 +1,173 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + /// + public partial class AddRecurrencePatternAndExpenseDue : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "Frequency", + table: "PropertyExpenses", + newName: "RecurrenceFrequency"); + + migrationBuilder.AddColumn( + name: "RecurrenceAnchorMonth", + table: "PropertyExpenses", + type: "INTEGER", + nullable: true); + + migrationBuilder.AddColumn( + name: "RecurrenceDueDayOfMonth", + table: "PropertyExpenses", + type: "INTEGER", + nullable: true); + + migrationBuilder.CreateTable( + name: "ExpenseDues", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + PropertyExpenseId = table.Column(type: "TEXT", nullable: false), + PropertyId = table.Column(type: "TEXT", nullable: false), + DueDate = table.Column(type: "TEXT", nullable: false), + AmountDue = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + WaivedOn = table.Column(type: "TEXT", nullable: true), + WaivedReason = table.Column(type: "TEXT", maxLength: 200, nullable: true), + Notes = table.Column(type: "TEXT", maxLength: 2000, nullable: true), + OrganizationId = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedBy = table.Column(type: "TEXT", maxLength: 100, nullable: false), + LastModifiedOn = table.Column(type: "TEXT", nullable: true), + LastModifiedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), + IsDeleted = table.Column(type: "INTEGER", nullable: false), + IsSampleData = table.Column(type: "INTEGER", nullable: false), + IsArchived = table.Column(type: "INTEGER", nullable: false), + ArchivedOn = table.Column(type: "TEXT", nullable: true), + ArchivedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ExpenseDues", x => x.Id); + table.ForeignKey( + name: "FK_ExpenseDues_PropertyExpenses_PropertyExpenseId", + column: x => x.PropertyExpenseId, + principalTable: "PropertyExpenses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ExpensePayments", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + ExpenseDueId = table.Column(type: "TEXT", nullable: false), + AmountPaid = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + PaidOn = table.Column(type: "TEXT", nullable: false), + Notes = table.Column(type: "TEXT", maxLength: 500, nullable: true), + OrganizationId = table.Column(type: "TEXT", nullable: false), + CreatedOn = table.Column(type: "TEXT", nullable: false), + CreatedBy = table.Column(type: "TEXT", maxLength: 100, nullable: false), + LastModifiedOn = table.Column(type: "TEXT", nullable: true), + LastModifiedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), + IsDeleted = table.Column(type: "INTEGER", nullable: false), + IsSampleData = table.Column(type: "INTEGER", nullable: false), + IsArchived = table.Column(type: "INTEGER", nullable: false), + ArchivedOn = table.Column(type: "TEXT", nullable: true), + ArchivedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ExpensePayments", x => x.Id); + table.ForeignKey( + name: "FK_ExpensePayments_ExpenseDues_ExpenseDueId", + column: x => x.ExpenseDueId, + principalTable: "ExpenseDues", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_ExpenseDues_DueDate", + table: "ExpenseDues", + column: "DueDate"); + + migrationBuilder.CreateIndex( + name: "IX_ExpenseDues_OrganizationId", + table: "ExpenseDues", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ExpenseDues_PropertyExpenseId", + table: "ExpenseDues", + column: "PropertyExpenseId"); + + migrationBuilder.CreateIndex( + name: "IX_ExpenseDues_PropertyId", + table: "ExpenseDues", + column: "PropertyId"); + + migrationBuilder.CreateIndex( + name: "IX_ExpensePayments_ExpenseDueId", + table: "ExpensePayments", + column: "ExpenseDueId"); + + migrationBuilder.CreateIndex( + name: "IX_ExpensePayments_OrganizationId", + table: "ExpensePayments", + column: "OrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_ExpensePayments_PaidOn", + table: "ExpensePayments", + column: "PaidOn"); + + // Data migration: pre-existing PropertyExpense rows had no due date + // captured (only a Frequency). Backfill RecurrenceDueDayOfMonth / + // RecurrenceAnchorMonth from EffectiveDate's day/month as a reasonable + // default so the now-mandatory recurrence fields aren't left null for + // historical rows. New rows going forward always get an explicit + // user-selected due date instead (see PropertyExpenseService.CreateExpenseAsync). + migrationBuilder.Sql(@" + UPDATE PropertyExpenses + SET RecurrenceDueDayOfMonth = CAST(strftime('%d', EffectiveDate) AS INTEGER) + WHERE RecurrenceFrequency <> 'One-Time' + AND RecurrenceDueDayOfMonth IS NULL; + + UPDATE PropertyExpenses + SET RecurrenceAnchorMonth = CAST(strftime('%m', EffectiveDate) AS INTEGER) + WHERE RecurrenceFrequency IN ('Quarterly', 'Annual') + AND RecurrenceAnchorMonth IS NULL; + "); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ExpensePayments"); + + migrationBuilder.DropTable( + name: "ExpenseDues"); + + migrationBuilder.DropColumn( + name: "RecurrenceAnchorMonth", + table: "PropertyExpenses"); + + migrationBuilder.DropColumn( + name: "RecurrenceDueDayOfMonth", + table: "PropertyExpenses"); + + migrationBuilder.RenameColumn( + name: "RecurrenceFrequency", + table: "PropertyExpenses", + newName: "Frequency"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260825132022_CascadeDeleteExpenseDueOnPropertyExpense.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20260825132022_CascadeDeleteExpenseDueOnPropertyExpense.Designer.cs new file mode 100644 index 0000000..2e8e88d --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260825132022_CascadeDeleteExpenseDueOnPropertyExpense.Designer.cs @@ -0,0 +1,5035 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20260825132022_CascadeDeleteExpenseDueOnPropertyExpense")] + partial class CascadeDeleteExpenseDueOnPropertyExpense + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountDue") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DueDate") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("WaivedOn") + .HasColumnType("TEXT"); + + b.Property("WaivedReason") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DueDate"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyExpenseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("ExpenseDueId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ExpenseDueId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaidOn"); + + b.ToTable("ExpensePayments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("LeaseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("EndReason") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.HasOne("Nine.Core.Entities.PropertyExpense", "PropertyExpense") + .WithMany("ExpenseDues") + .HasForeignKey("PropertyExpenseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PropertyExpense"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.HasOne("Nine.Core.Entities.ExpenseDue", "ExpenseDue") + .WithMany("Payments") + .HasForeignKey("ExpenseDueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExpenseDue"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsOne("Nine.Core.Entities.RecurrencePattern", "RecurrencePattern", b1 => + { + b1.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b1.Property("AnchorMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceAnchorMonth"); + + b1.Property("DueDayOfMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceDueDayOfMonth"); + + b1.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnName("RecurrenceFrequency"); + + b1.HasKey("PropertyExpenseId"); + + b1.ToTable("PropertyExpenses"); + + b1.WithOwner() + .HasForeignKey("PropertyExpenseId"); + }); + + b.Navigation("Property"); + + b.Navigation("RecurrencePattern") + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Expenses"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Navigation("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20260825132022_CascadeDeleteExpenseDueOnPropertyExpense.cs b/1-Nine.Infrastructure/Data/Migrations/20260825132022_CascadeDeleteExpenseDueOnPropertyExpense.cs new file mode 100644 index 0000000..491efc2 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20260825132022_CascadeDeleteExpenseDueOnPropertyExpense.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + /// + public partial class CascadeDeleteExpenseDueOnPropertyExpense : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ExpenseDues_PropertyExpenses_PropertyExpenseId", + table: "ExpenseDues"); + + migrationBuilder.AddForeignKey( + name: "FK_ExpenseDues_PropertyExpenses_PropertyExpenseId", + table: "ExpenseDues", + column: "PropertyExpenseId", + principalTable: "PropertyExpenses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ExpenseDues_PropertyExpenses_PropertyExpenseId", + table: "ExpenseDues"); + + migrationBuilder.AddForeignKey( + name: "FK_ExpenseDues_PropertyExpenses_PropertyExpenseId", + table: "ExpenseDues", + column: "PropertyExpenseId", + principalTable: "PropertyExpenses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20261110193853_AddRepairIdToDocument.Designer.cs b/1-Nine.Infrastructure/Data/Migrations/20261110193853_AddRepairIdToDocument.Designer.cs new file mode 100644 index 0000000..eb92c08 --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20261110193853_AddRepairIdToDocument.Designer.cs @@ -0,0 +1,5052 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nine.Infrastructure.Data; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20261110193853_AddRepairIdToDocument")] + partial class AddRepairIdToDocument + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("BackgroundCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("BackgroundCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckCompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreditCheckNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("CreditCheckPassed") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequested") + .HasColumnType("INTEGER"); + + b.Property("CreditCheckRequestedOn") + .HasColumnType("TEXT"); + + b.Property("CreditScore") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallResult") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("ResultNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OverallResult"); + + b.HasIndex("RentalApplicationId") + .IsUnique(); + + b.ToTable("ApplicationScreenings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("EndOn") + .HasColumnType("TEXT"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Location") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityId") + .HasColumnType("TEXT"); + + b.Property("SourceEntityType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("SourceEntityId"); + + b.HasIndex("StartOn"); + + b.HasIndex("SourceEntityType", "SourceEntityId"); + + b.ToTable("CalendarEvents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCreateEvents") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultColor") + .HasColumnType("TEXT"); + + b.Property("DefaultIcon") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .HasColumnType("INTEGER"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ShowOnCalendar") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("OrganizationId", "EntityType") + .IsUnique(); + + b.ToTable("CalendarSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("ChecklistType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CompletedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.HasIndex("ChecklistType"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("Status"); + + b.ToTable("Checklists"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsChecked") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhotoUrl") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.ToTable("ChecklistItems"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsSystemTemplate") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("OrganizationId"); + + b.ToTable("ChecklistTemplates"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0001-000000000001"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Standard property showing checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Property Tour", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000002"), + Category = "MoveIn", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-in inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-In", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000003"), + Category = "MoveOut", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Move-out inspection checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Move-Out", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }, + new + { + Id = new Guid("00000000-0000-0000-0001-000000000004"), + Category = "Tour", + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + Description = "Open house event checklist", + IsArchived = false, + IsDeleted = false, + IsSampleData = false, + IsSystemTemplate = true, + Name = "Open House", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000") + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowsNotes") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CategorySection") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChecklistTemplateId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRequired") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("ItemOrder") + .HasColumnType("INTEGER"); + + b.Property("ItemText") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RequiresValue") + .HasColumnType("INTEGER"); + + b.Property("SectionOrder") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistTemplateId"); + + b.ToTable("ChecklistTemplateItems"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0002-000000000001"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Greeted prospect and verified appointment", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000002"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Reviewed property exterior and curb appeal", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000003"), + AllowsNotes = true, + CategorySection = "Arrival & Introduction", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Showed parking area/garage", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000004"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 4, + ItemText = "Toured living room/common areas", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000005"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 5, + ItemText = "Showed all bedrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000006"), + AllowsNotes = true, + CategorySection = "Interior Tour", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 6, + ItemText = "Showed all bathrooms", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 2 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000007"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 7, + ItemText = "Toured kitchen and demonstrated appliances", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000008"), + AllowsNotes = true, + CategorySection = "Kitchen & Appliances", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 8, + ItemText = "Explained which appliances are included", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 3 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000009"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 9, + ItemText = "Explained HVAC system and thermostat controls", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000010"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 10, + ItemText = "Reviewed utility responsibilities (tenant vs landlord)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000011"), + AllowsNotes = true, + CategorySection = "Utilities & Systems", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 11, + ItemText = "Showed water heater location", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 4 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000012"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 12, + ItemText = "Showed storage areas (closets, attic, basement)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000013"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 13, + ItemText = "Showed laundry facilities", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000014"), + AllowsNotes = true, + CategorySection = "Storage & Amenities", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 14, + ItemText = "Showed outdoor space (yard, patio, balcony)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 5 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000015"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 15, + ItemText = "Discussed monthly rent amount", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000016"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 16, + ItemText = "Explained security deposit and move-in costs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000017"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 17, + ItemText = "Reviewed lease term length and start date", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000018"), + AllowsNotes = true, + CategorySection = "Lease Terms", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 18, + ItemText = "Explained pet policy", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 6 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000019"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 19, + ItemText = "Explained application process and requirements", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000020"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 20, + ItemText = "Reviewed screening process (background, credit check)", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000021"), + AllowsNotes = true, + CategorySection = "Next Steps", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 21, + ItemText = "Answered all prospect questions", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 7 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000022"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 22, + ItemText = "Prospect Interest Level", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = true, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000023"), + AllowsNotes = true, + CategorySection = "Assessment", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 23, + ItemText = "Overall showing feedback and notes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 8 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000024"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Document property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000025"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect keys and access codes", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000026"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Review lease terms with tenant", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000027"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Inspect property condition", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000028"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Collect all keys and access devices", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000029"), + AllowsNotes = true, + CategorySection = "General", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Document damages and needed repairs", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000030"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 1, + ItemText = "Set up signage and directional markers", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000031"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 2, + ItemText = "Prepare information packets", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }, + new + { + Id = new Guid("00000000-0000-0000-0002-000000000032"), + AllowsNotes = true, + CategorySection = "Preparation", + ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), + CreatedBy = "", + CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, + IsDeleted = false, + IsRequired = true, + IsSampleData = false, + ItemOrder = 3, + ItemText = "Set up visitor sign-in sheet", + OrganizationId = new Guid("00000000-0000-0000-0000-000000000000"), + RequiresValue = false, + SectionOrder = 1 + }); + }); + + modelBuilder.Entity("Nine.Core.Entities.DatabaseSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatabaseEncryptionEnabled") + .HasColumnType("INTEGER"); + + b.Property("EncryptionChangedOn") + .HasColumnType("TEXT"); + + b.Property("EncryptionSalt") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("DatabaseSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("DocumentType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FileData") + .IsRequired() + .HasColumnType("BLOB"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("FileSize") + .HasColumnType("INTEGER"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairId"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountDue") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DueDate") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("WaivedOn") + .HasColumnType("TEXT"); + + b.Property("WaivedReason") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DueDate"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyExpenseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("ExpenseDueId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ExpenseDueId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaidOn"); + + b.ToTable("ExpensePayments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActionItemsRequired") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BathroomSinkGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomSinkNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomToiletGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomToiletNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomTubShowerGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomTubShowerNotes") + .HasColumnType("TEXT"); + + b.Property("BathroomVentilationGood") + .HasColumnType("INTEGER"); + + b.Property("BathroomVentilationNotes") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CarbonMonoxideDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("CarbonMonoxideDetectorsNotes") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("ElectricalSystemGood") + .HasColumnType("INTEGER"); + + b.Property("ElectricalSystemNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorFoundationGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorFoundationNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorGuttersGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorGuttersNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorRoofGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorRoofNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorSidingGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorSidingNotes") + .HasColumnType("TEXT"); + + b.Property("ExteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("ExteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("GeneralNotes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("HvacSystemGood") + .HasColumnType("INTEGER"); + + b.Property("HvacSystemNotes") + .HasColumnType("TEXT"); + + b.Property("InspectedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("InspectionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InteriorCeilingsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorCeilingsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorDoorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorDoorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorFloorsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorFloorsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWallsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWallsNotes") + .HasColumnType("TEXT"); + + b.Property("InteriorWindowsGood") + .HasColumnType("INTEGER"); + + b.Property("InteriorWindowsNotes") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenAppliancesNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCabinetsGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCabinetsNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenCountersGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenCountersNotes") + .HasColumnType("TEXT"); + + b.Property("KitchenSinkPlumbingGood") + .HasColumnType("INTEGER"); + + b.Property("KitchenSinkPlumbingNotes") + .HasColumnType("TEXT"); + + b.Property("LandscapingGood") + .HasColumnType("INTEGER"); + + b.Property("LandscapingNotes") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OverallCondition") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PlumbingSystemGood") + .HasColumnType("INTEGER"); + + b.Property("PlumbingSystemNotes") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("SmokeDetectorsGood") + .HasColumnType("INTEGER"); + + b.Property("SmokeDetectorsNotes") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("Inspections"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("DueOn") + .HasColumnType("TEXT"); + + b.Property("InvoiceNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("InvoicedOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("LateFeeApplied") + .HasColumnType("INTEGER"); + + b.Property("LateFeeAppliedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("ReminderSent") + .HasColumnType("INTEGER"); + + b.Property("ReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("OrganizationId", "InvoiceNumber") + .IsUnique() + .HasDatabaseName("IX_Invoice_OrgId_InvoiceNumber"); + + b.ToTable("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DeclinedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpectedMoveOutDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseOfferId") + .HasColumnType("TEXT"); + + b.Property("LeaseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PreviousLeaseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProposedRenewalRent") + .HasColumnType("decimal(18,2)"); + + b.Property("RenewalNotes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RenewalNotificationSent") + .HasColumnType("INTEGER"); + + b.Property("RenewalNotificationSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalNumber") + .HasColumnType("INTEGER"); + + b.Property("RenewalOfferedOn") + .HasColumnType("TEXT"); + + b.Property("RenewalReminderSentOn") + .HasColumnType("TEXT"); + + b.Property("RenewalResponseOn") + .HasColumnType("TEXT"); + + b.Property("RenewalStatus") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("SignedOn") + .HasColumnType("TEXT"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TerminationNoticedOn") + .HasColumnType("TEXT"); + + b.Property("TerminationReason") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("TenantId"); + + b.ToTable("Leases"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("ConvertedLeaseId") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OfferedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("RentalApplicationId") + .HasColumnType("TEXT"); + + b.Property("RespondedOn") + .HasColumnType("TEXT"); + + b.Property("ResponseNotes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SecurityDeposit") + .HasColumnType("decimal(18,2)"); + + b.Property("StartDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Terms") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("RentalApplicationId"); + + b.ToTable("LeaseOffers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActualCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AssignedTo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("EstimatedCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RequestedByEmail") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RequestedByPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RequestedOn") + .HasColumnType("TEXT"); + + b.Property("ResolutionNotes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("LeaseId"); + + b.HasIndex("Priority"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RequestedOn"); + + b.HasIndex("Status"); + + b.ToTable("MaintenanceRequests"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(5000) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("UserFullName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Notes"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyDigestTime") + .HasColumnType("TEXT"); + + b.Property("EmailAddress") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmailApplicationStatusChange") + .HasColumnType("INTEGER"); + + b.Property("EmailInspectionScheduled") + .HasColumnType("INTEGER"); + + b.Property("EmailLeaseExpiring") + .HasColumnType("INTEGER"); + + b.Property("EmailMaintenanceUpdate") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("EmailPaymentReceived") + .HasColumnType("INTEGER"); + + b.Property("EnableDailyDigest") + .HasColumnType("INTEGER"); + + b.Property("EnableEmailNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableInAppNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableSMSNotifications") + .HasColumnType("INTEGER"); + + b.Property("EnableWeeklyDigest") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SMSLeaseExpiringUrgent") + .HasColumnType("INTEGER"); + + b.Property("SMSMaintenanceEmergency") + .HasColumnType("INTEGER"); + + b.Property("SMSPaymentDue") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("WeeklyDigestDay") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("NotificationPreferences"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("State") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OwnerId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("DailyLimit") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("EmailsSentToday") + .HasColumnType("INTEGER"); + + b.Property("EnableSsl") + .HasColumnType("INTEGER"); + + b.Property("FromEmail") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FromName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsEmailEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastEmailSentOn") + .HasColumnType("TEXT"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastErrorOn") + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyLimit") + .HasColumnType("INTEGER"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlanType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SendGridApiKeyEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("SmtpPort") + .HasColumnType("INTEGER"); + + b.Property("SmtpServer") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationEmailSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccountBalance") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("AccountType") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CostPerSMS") + .HasPrecision(18, 4) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DailyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSMSEnabled") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastSMSSentOn") + .HasColumnType("TEXT"); + + b.Property("LastVerifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyCountResetOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ProviderName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("SMSSentThisMonth") + .HasColumnType("INTEGER"); + + b.Property("SMSSentToday") + .HasColumnType("INTEGER"); + + b.Property("StatsLastUpdatedOn") + .HasColumnType("TEXT"); + + b.Property("TwilioAccountSidEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioAuthTokenEncrypted") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("TwilioPhoneNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSMSSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSettings", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AllowTenantDividendChoice") + .HasColumnType("INTEGER"); + + b.Property("ApplicationExpirationDays") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("AutoCalculateSecurityDeposit") + .HasColumnType("INTEGER"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DefaultApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("DefaultDividendPaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DividendDistributionMonth") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LateFeeAutoApply") + .HasColumnType("INTEGER"); + + b.Property("LateFeeEnabled") + .HasColumnType("INTEGER"); + + b.Property("LateFeeGracePeriodDays") + .HasColumnType("INTEGER"); + + b.Property("LateFeePercentage") + .HasPrecision(5, 4) + .HasColumnType("TEXT"); + + b.Property("MaxLateFeeAmount") + .HasPrecision(18, 2) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PaymentReminderDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("PaymentReminderEnabled") + .HasColumnType("INTEGER"); + + b.Property("RefundProcessingDays") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositInvestmentEnabled") + .HasColumnType("INTEGER"); + + b.Property("SecurityDepositMultiplier") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TourNoShowGracePeriodHours") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationSettings"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("GrantedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GrantedOn") + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("RevokedOn") + .HasColumnType("TEXT"); + + b.Property("Role") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IsActive"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Role"); + + b.HasIndex("UserId", "OrganizationId") + .IsUnique(); + + b.ToTable("OrganizationUsers"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DocumentId") + .HasColumnType("TEXT"); + + b.Property("InvoiceId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("InvoiceId"); + + b.HasIndex("OrganizationId", "PaymentNumber") + .IsUnique() + .HasDatabaseName("IX_Payment_OrgId_PaymentNumber"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Bathrooms") + .HasMaxLength(3) + .HasColumnType("decimal(3,1)"); + + b.Property("Bedrooms") + .HasMaxLength(3) + .HasColumnType("INTEGER"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastRoutineInspectionDate") + .HasColumnType("TEXT"); + + b.Property("MonthlyRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("NextRoutineInspectionDueDate") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoutineInspectionIntervalMonths") + .HasColumnType("INTEGER"); + + b.Property("SquareFeet") + .HasMaxLength(7) + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitNumber") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Address"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Properties"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("EndReason") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("DesiredMoveInDate") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("FirstContactedOn") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationState") + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("InterestedPropertyId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("InterestedPropertyId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.ToTable("ProspectiveTenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ApplicationFee") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationFeePaid") + .HasColumnType("INTEGER"); + + b.Property("ApplicationFeePaidOn") + .HasColumnType("TEXT"); + + b.Property("ApplicationFeePaymentMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("CurrentAddress") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CurrentCity") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CurrentRent") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CurrentState") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("TEXT"); + + b.Property("CurrentZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("DecidedOn") + .HasColumnType("TEXT"); + + b.Property("DecisionBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DenialReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EmployerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmploymentLengthMonths") + .HasColumnType("INTEGER"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("JobTitle") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LandlordName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("LandlordPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("MonthlyIncome") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("Reference1Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference1Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference1Relationship") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Reference2Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Reference2Phone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Reference2Relationship") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AppliedOn"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("Status"); + + b.ToTable("RentalApplications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CompletedOn") + .HasColumnType("TEXT"); + + b.Property("ContactId") + .HasColumnType("TEXT"); + + b.Property("ContactPerson") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorId") + .HasColumnType("TEXT"); + + b.Property("ContractorName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ContractorPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Cost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MaintenanceRequestId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PartsReplaced") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("RepairType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("WarrantyApplies") + .HasColumnType("INTEGER"); + + b.Property("WarrantyExpiresOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CompletedOn"); + + b.HasIndex("LeaseId"); + + b.HasIndex("MaintenanceRequestId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("RepairType"); + + b.ToTable("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SchemaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AppliedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("SchemaVersions"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateReceived") + .HasColumnType("TEXT"); + + b.Property("DeductionsAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DeductionsReason") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("InInvestmentPool") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PoolEntryDate") + .HasColumnType("TEXT"); + + b.Property("PoolExitDate") + .HasColumnType("TEXT"); + + b.Property("RefundAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefundMethod") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RefundProcessedDate") + .HasColumnType("TEXT"); + + b.Property("RefundReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("TransactionReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("InInvestmentPool"); + + b.HasIndex("LeaseId") + .IsUnique(); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.ToTable("SecurityDeposits"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("BaseDividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ChoiceMadeOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendAmount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("InvestmentPoolId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LeaseId") + .HasColumnType("TEXT"); + + b.Property("MailingAddress") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MonthsInPool") + .HasColumnType("INTEGER"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaymentMethod") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PaymentProcessedOn") + .HasColumnType("TEXT"); + + b.Property("PaymentReference") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ProrationFactor") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SecurityDepositId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("InvestmentPoolId"); + + b.HasIndex("LeaseId"); + + b.HasIndex("SecurityDepositId"); + + b.HasIndex("Status"); + + b.HasIndex("TenantId"); + + b.HasIndex("Year"); + + b.ToTable("SecurityDepositDividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveLeaseCount") + .HasColumnType("INTEGER"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendPerLease") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("DividendsCalculatedOn") + .HasColumnType("TEXT"); + + b.Property("DividendsDistributedOn") + .HasColumnType("TEXT"); + + b.Property("EndingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("OrganizationShare") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("OrganizationSharePercentage") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReturnRate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("StartingBalance") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("TenantShareTotal") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalEarnings") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Year") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("Status"); + + b.HasIndex("Year") + .IsUnique(); + + b.ToTable("SecurityDepositInvestmentPools"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DateOfBirth") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EmergencyContactPhone") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IdentificationNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("IdentificationNumber") + .IsUnique(); + + b.HasIndex("OrganizationId"); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CalendarEventId") + .HasColumnType("TEXT"); + + b.Property("ChecklistId") + .HasColumnType("TEXT"); + + b.Property("ConductedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DurationMinutes") + .HasColumnType("INTEGER"); + + b.Property("Feedback") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("InterestLevel") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("ProspectiveTenantId") + .HasColumnType("TEXT"); + + b.Property("ScheduledOn") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ChecklistId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.HasIndex("ProspectiveTenantId"); + + b.HasIndex("ScheduledOn"); + + b.HasIndex("Status"); + + b.ToTable("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ActiveOrganizationId") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActiveOrganizationId"); + + b.HasIndex("Email"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserProfiles"); + }); + + modelBuilder.Entity("Nine.Core.Entities.WorkflowAuditLog", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("EntityType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FromStatus") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PerformedBy") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PerformedOn") + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasColumnType("TEXT"); + + b.Property("ToStatus") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("EntityId"); + + b.HasIndex("EntityType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PerformedBy"); + + b.HasIndex("PerformedOn"); + + b.HasIndex("EntityType", "EntityId"); + + b.ToTable("WorkflowAuditLogs"); + }); + + modelBuilder.Entity("Notification", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("EmailError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("EmailSent") + .HasColumnType("INTEGER"); + + b.Property("EmailSentOn") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsRead") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("ReadOn") + .HasColumnType("TEXT"); + + b.Property("RecipientUserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RelatedEntityId") + .HasColumnType("TEXT"); + + b.Property("RelatedEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SMSError") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SMSSent") + .HasColumnType("INTEGER"); + + b.Property("SMSSentOn") + .HasColumnType("TEXT"); + + b.Property("SendEmail") + .HasColumnType("INTEGER"); + + b.Property("SendInApp") + .HasColumnType("INTEGER"); + + b.Property("SendSMS") + .HasColumnType("INTEGER"); + + b.Property("SentOn") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsRead"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("RecipientUserId"); + + b.HasIndex("SentOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ApplicationScreening", b => + { + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithOne("Screening") + .HasForeignKey("Nine.Core.Entities.ApplicationScreening", "RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.CalendarEvent", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Checklists") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ChecklistTemplate"); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistItem", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany("Items") + .HasForeignKey("ChecklistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Checklist"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplateItem", b => + { + b.HasOne("Nine.Core.Entities.ChecklistTemplate", "ChecklistTemplate") + .WithMany("Items") + .HasForeignKey("ChecklistTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChecklistTemplate"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Document", b => + { + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany() + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Documents") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Documents") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Repair", "Repair") + .WithMany("Documents") + .HasForeignKey("RepairId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Invoice"); + + b.Navigation("Lease"); + + b.Navigation("Payment"); + + b.Navigation("Property"); + + b.Navigation("Repair"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.HasOne("Nine.Core.Entities.PropertyExpense", "PropertyExpense") + .WithMany("ExpenseDues") + .HasForeignKey("PropertyExpenseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PropertyExpense"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.HasOne("Nine.Core.Entities.ExpenseDue", "ExpenseDue") + .WithMany("Payments") + .HasForeignKey("ExpenseDueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExpenseDue"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany("Invoices") + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Lease"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Leases") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Leases") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany("Leases") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.LeaseOffer", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany() + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.RentalApplication", "RentalApplication") + .WithMany() + .HasForeignKey("RentalApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + + b.Navigation("RentalApplication"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("MaintenanceRequests") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.NotificationPreferences", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationEmailSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationSMSSettings", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.OrganizationUser", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany("OrganizationUsers") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Payment", b => + { + b.HasOne("Nine.Core.Entities.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Properties") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsOne("Nine.Core.Entities.RecurrencePattern", "RecurrencePattern", b1 => + { + b1.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b1.Property("AnchorMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceAnchorMonth"); + + b1.Property("DueDayOfMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceDueDayOfMonth"); + + b1.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnName("RecurrenceFrequency"); + + b1.HasKey("PropertyExpenseId"); + + b1.ToTable("PropertyExpenses"); + + b1.WithOwner() + .HasForeignKey("PropertyExpenseId"); + }); + + b.Navigation("Property"); + + b.Navigation("RecurrencePattern") + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") + .WithMany() + .HasForeignKey("InterestedPropertyId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("InterestedProperty"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Applications") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.MaintenanceRequest", "MaintenanceRequest") + .WithMany("Repairs") + .HasForeignKey("MaintenanceRequestId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Repairs") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("MaintenanceRequest"); + + b.Navigation("Property"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Lease"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositDividend", b => + { + b.HasOne("Nine.Core.Entities.SecurityDepositInvestmentPool", "InvestmentPool") + .WithMany("Dividends") + .HasForeignKey("InvestmentPoolId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Lease", "Lease") + .WithMany() + .HasForeignKey("LeaseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.SecurityDeposit", "SecurityDeposit") + .WithMany("Dividends") + .HasForeignKey("SecurityDepositId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("InvestmentPool"); + + b.Navigation("Lease"); + + b.Navigation("SecurityDeposit"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.HasOne("Nine.Core.Entities.Organization", null) + .WithMany("Tenants") + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tour", b => + { + b.HasOne("Nine.Core.Entities.Checklist", "Checklist") + .WithMany() + .HasForeignKey("ChecklistId"); + + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany() + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Nine.Core.Entities.ProspectiveTenant", "ProspectiveTenant") + .WithMany("Tours") + .HasForeignKey("ProspectiveTenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Checklist"); + + b.Navigation("Property"); + + b.Navigation("ProspectiveTenant"); + }); + + modelBuilder.Entity("Notification", b => + { + b.HasOne("Nine.Core.Entities.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Checklist", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ChecklistTemplate", b => + { + b.Navigation("Checklists"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Lease", b => + { + b.Navigation("Documents"); + + b.Navigation("Invoices"); + }); + + modelBuilder.Entity("Nine.Core.Entities.MaintenanceRequest", b => + { + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Organization", b => + { + b.Navigation("Leases"); + + b.Navigation("OrganizationUsers"); + + b.Navigation("Properties"); + + b.Navigation("Tenants"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Property", b => + { + b.Navigation("Documents"); + + b.Navigation("Expenses"); + + b.Navigation("Leases"); + + b.Navigation("MaintenanceRequests"); + + b.Navigation("Repairs"); + }); + + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Navigation("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => + { + b.Navigation("Applications"); + + b.Navigation("Tours"); + }); + + modelBuilder.Entity("Nine.Core.Entities.RentalApplication", b => + { + b.Navigation("Screening"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.SecurityDepositInvestmentPool", b => + { + b.Navigation("Dividends"); + }); + + modelBuilder.Entity("Nine.Core.Entities.Tenant", b => + { + b.Navigation("Leases"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/20261110193853_AddRepairIdToDocument.cs b/1-Nine.Infrastructure/Data/Migrations/20261110193853_AddRepairIdToDocument.cs new file mode 100644 index 0000000..9ad689c --- /dev/null +++ b/1-Nine.Infrastructure/Data/Migrations/20261110193853_AddRepairIdToDocument.cs @@ -0,0 +1,50 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nine.Infrastructure.Data.Migrations +{ + /// + public partial class AddRepairIdToDocument : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "RepairId", + table: "Documents", + type: "TEXT", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Documents_RepairId", + table: "Documents", + column: "RepairId"); + + migrationBuilder.AddForeignKey( + name: "FK_Documents_Repairs_RepairId", + table: "Documents", + column: "RepairId", + principalTable: "Repairs", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Documents_Repairs_RepairId", + table: "Documents"); + + migrationBuilder.DropIndex( + name: "IX_Documents_RepairId", + table: "Documents"); + + migrationBuilder.DropColumn( + name: "RepairId", + table: "Documents"); + } + } +} diff --git a/1-Nine.Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/1-Nine.Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 35dcc2b..5e9a243 100644 --- a/1-Nine.Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/1-Nine.Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -22,6 +22,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("BackgroundCheckCompletedOn") .HasColumnType("TEXT"); @@ -65,6 +72,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CreditScore") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -110,6 +120,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("Color") .IsRequired() .HasMaxLength(20) @@ -143,6 +160,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(50) .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -208,6 +228,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("AutoCreateEvents") .HasColumnType("INTEGER"); @@ -232,6 +259,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -266,6 +296,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("ChecklistTemplateId") .HasColumnType("TEXT"); @@ -296,6 +333,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(2000) .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -352,6 +392,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CategorySection") .HasMaxLength(100) .HasColumnType("TEXT"); @@ -367,6 +414,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CreatedOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsChecked") .HasColumnType("INTEGER"); @@ -424,6 +474,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("Category") .IsRequired() .HasMaxLength(50) @@ -441,6 +498,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(500) .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -481,6 +541,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), Description = "Standard property showing checklist", + IsArchived = false, IsDeleted = false, IsSampleData = false, IsSystemTemplate = true, @@ -494,6 +555,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), Description = "Move-in inspection checklist", + IsArchived = false, IsDeleted = false, IsSampleData = false, IsSystemTemplate = true, @@ -507,6 +569,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), Description = "Move-out inspection checklist", + IsArchived = false, IsDeleted = false, IsSampleData = false, IsSystemTemplate = true, @@ -520,6 +583,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), Description = "Open house event checklist", + IsArchived = false, IsDeleted = false, IsSampleData = false, IsSystemTemplate = true, @@ -536,6 +600,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("AllowsNotes") .HasColumnType("INTEGER"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CategorySection") .HasMaxLength(100) .HasColumnType("TEXT"); @@ -551,6 +622,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CreatedOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -599,6 +673,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -616,6 +691,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -633,6 +709,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -650,6 +727,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -667,6 +745,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -684,6 +763,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -701,6 +781,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -718,6 +799,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -735,6 +817,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -752,6 +835,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -769,6 +853,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -786,6 +871,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -803,6 +889,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -820,6 +907,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -837,6 +925,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -854,6 +943,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -871,6 +961,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -888,6 +979,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -905,6 +997,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -922,6 +1015,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -939,6 +1033,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -956,6 +1051,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -973,6 +1069,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000001"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -990,6 +1087,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1007,6 +1105,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1024,6 +1123,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000002"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1041,6 +1141,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1058,6 +1159,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1075,6 +1177,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000003"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1092,6 +1195,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1109,6 +1213,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1126,6 +1231,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) ChecklistTemplateId = new Guid("00000000-0000-0000-0001-000000000004"), CreatedBy = "", CreatedOn = new DateTime(2025, 11, 30, 0, 0, 0, 0, DateTimeKind.Utc), + IsArchived = false, IsDeleted = false, IsRequired = true, IsSampleData = false, @@ -1171,6 +1277,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("ContentType") .IsRequired() .HasMaxLength(500) @@ -1224,6 +1337,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InvoiceId") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -1249,6 +1365,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PropertyId") .HasColumnType("TEXT"); + b.Property("RepairId") + .HasColumnType("TEXT"); + b.Property("TenantId") .HasColumnType("TEXT"); @@ -1264,11 +1383,153 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("PropertyId"); + b.HasIndex("RepairId"); + b.HasIndex("TenantId"); b.ToTable("Documents"); }); + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountDue") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("DueDate") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.Property("WaivedOn") + .HasColumnType("TEXT"); + + b.Property("WaivedReason") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DueDate"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyExpenseId"); + + b.HasIndex("PropertyId"); + + b.ToTable("ExpenseDues"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AmountPaid") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("ExpenseDueId") + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PaidOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ExpenseDueId"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PaidOn"); + + b.ToTable("ExpensePayments"); + }); + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => { b.Property("Id") @@ -1278,6 +1539,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(2000) .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("BathroomSinkGood") .HasColumnType("INTEGER"); @@ -1416,6 +1684,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InteriorWindowsNotes") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -1511,6 +1782,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -1538,6 +1816,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InvoicedOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -1606,6 +1887,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ActualMoveOutDate") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -1617,9 +1905,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DeclinedOn") .HasColumnType("TEXT"); - b.Property("DocumentId") - .HasColumnType("TEXT"); - b.Property("EndDate") .HasColumnType("TEXT"); @@ -1629,6 +1914,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ExpiresOn") .HasColumnType("TEXT"); + b.Property("IsActive") + .HasColumnType("INTEGER"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -1645,6 +1936,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("LeaseOfferId") .HasColumnType("TEXT"); + b.Property("LeaseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + b.Property("MonthlyRent") .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); @@ -1727,7 +2023,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("DocumentId"); + b.HasIndex("IsActive"); b.HasIndex("OrganizationId"); @@ -1743,6 +2039,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("ConvertedLeaseId") .HasColumnType("TEXT"); @@ -1760,6 +2063,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ExpiresOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -1839,6 +2145,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("AssignedTo") .IsRequired() .HasMaxLength(100) @@ -1867,6 +2180,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -1955,6 +2271,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("Content") .IsRequired() .HasMaxLength(5000) @@ -1976,6 +2299,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(100) .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2006,6 +2332,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -2054,6 +2387,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EnableWeeklyDigest") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2155,6 +2491,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -2186,6 +2529,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(200) .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2278,6 +2624,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(100) .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CostPerSMS") .HasPrecision(18, 4) .HasColumnType("TEXT"); @@ -2293,6 +2646,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DailyCountResetOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2375,6 +2731,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ApplicationFeeEnabled") .HasColumnType("INTEGER"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("AutoCalculateSecurityDeposit") .HasColumnType("INTEGER"); @@ -2398,6 +2761,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DividendDistributionMonth") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2536,6 +2902,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -2550,6 +2923,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InvoiceId") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2607,6 +2983,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(200) .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("Bathrooms") .HasMaxLength(3) .HasColumnType("decimal(3,1)"); @@ -2636,6 +3019,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsActive") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2702,11 +3088,102 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Properties"); }); + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("EffectiveDate") + .HasColumnType("TEXT"); + + b.Property("EndDate") + .HasColumnType("TEXT"); + + b.Property("EndReason") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ExpenseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsArchived") + .HasColumnType("INTEGER"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsSampleData") + .HasColumnType("INTEGER"); + + b.Property("LastModifiedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("LastModifiedOn") + .HasColumnType("TEXT"); + + b.Property("Notes") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasColumnType("TEXT"); + + b.Property("PropertyId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EffectiveDate"); + + b.HasIndex("ExpenseType"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PropertyId"); + + b.ToTable("PropertyExpenses"); + }); + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => { b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -2745,6 +3222,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InterestedPropertyId") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2819,6 +3299,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("AppliedOn") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -2873,6 +3360,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ExpiresOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -2966,6 +3456,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CompletedOn") .HasColumnType("TEXT"); @@ -3010,6 +3507,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DurationMinutes") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3106,6 +3606,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -3128,6 +3635,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InInvestmentPool") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3208,6 +3718,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("BaseDividendAmount") .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); @@ -3230,6 +3747,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InvestmentPoolId") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3315,6 +3835,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ActiveLeaseCount") .HasColumnType("INTEGER"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -3337,6 +3864,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 2) .HasColumnType("decimal(18,2)"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3406,6 +3936,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -3444,6 +3981,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsActive") .HasColumnType("INTEGER"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3496,6 +4036,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CalendarEventId") .HasColumnType("TEXT"); @@ -3525,6 +4072,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(50) .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3580,6 +4130,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ActiveOrganizationId") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -3596,6 +4153,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3648,6 +4208,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("CreatedBy") .IsRequired() .HasMaxLength(100) @@ -3666,6 +4233,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FromStatus") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3723,6 +4293,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("TEXT"); + b.Property("ArchivedBy") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ArchivedOn") + .HasColumnType("TEXT"); + b.Property("Category") .IsRequired() .HasMaxLength(50) @@ -3746,6 +4323,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EmailSentOn") .HasColumnType("TEXT"); + b.Property("IsArchived") + .HasColumnType("INTEGER"); + b.Property("IsDeleted") .HasColumnType("INTEGER"); @@ -3934,6 +4514,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("PropertyId") .OnDelete(DeleteBehavior.SetNull); + b.HasOne("Nine.Core.Entities.Repair", "Repair") + .WithMany("Documents") + .HasForeignKey("RepairId") + .OnDelete(DeleteBehavior.SetNull); + b.HasOne("Nine.Core.Entities.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") @@ -3947,9 +4532,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Property"); + b.Navigation("Repair"); + b.Navigation("Tenant"); }); + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.HasOne("Nine.Core.Entities.PropertyExpense", "PropertyExpense") + .WithMany("ExpenseDues") + .HasForeignKey("PropertyExpenseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PropertyExpense"); + }); + + modelBuilder.Entity("Nine.Core.Entities.ExpensePayment", b => + { + b.HasOne("Nine.Core.Entities.ExpenseDue", "ExpenseDue") + .WithMany("Payments") + .HasForeignKey("ExpenseDueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExpenseDue"); + }); + modelBuilder.Entity("Nine.Core.Entities.Inspection", b => { b.HasOne("Nine.Core.Entities.Document", "Document") @@ -4001,11 +4610,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Nine.Core.Entities.Lease", b => { - b.HasOne("Nine.Core.Entities.Document", "Document") - .WithMany() - .HasForeignKey("DocumentId") - .OnDelete(DeleteBehavior.SetNull); - b.HasOne("Nine.Core.Entities.Organization", null) .WithMany("Leases") .HasForeignKey("OrganizationId") @@ -4024,8 +4628,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.Navigation("Document"); - b.Navigation("Property"); b.Navigation("Tenant"); @@ -4153,6 +4755,47 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.HasOne("Nine.Core.Entities.Property", "Property") + .WithMany("Expenses") + .HasForeignKey("PropertyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsOne("Nine.Core.Entities.RecurrencePattern", "RecurrencePattern", b1 => + { + b1.Property("PropertyExpenseId") + .HasColumnType("TEXT"); + + b1.Property("AnchorMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceAnchorMonth"); + + b1.Property("DueDayOfMonth") + .HasColumnType("INTEGER") + .HasColumnName("RecurrenceDueDayOfMonth"); + + b1.Property("Frequency") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnName("RecurrenceFrequency"); + + b1.HasKey("PropertyExpenseId"); + + b1.ToTable("PropertyExpenses"); + + b1.WithOwner() + .HasForeignKey("PropertyExpenseId"); + }); + + b.Navigation("Property"); + + b.Navigation("RecurrencePattern") + .IsRequired(); + }); + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => { b.HasOne("Nine.Core.Entities.Property", "InterestedProperty") @@ -4318,6 +4961,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Items"); }); + modelBuilder.Entity("Nine.Core.Entities.ExpenseDue", b => + { + b.Navigation("Payments"); + }); + modelBuilder.Entity("Nine.Core.Entities.Invoice", b => { b.Navigation("Payments"); @@ -4350,6 +4998,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("Documents"); + b.Navigation("Expenses"); + b.Navigation("Leases"); b.Navigation("MaintenanceRequests"); @@ -4357,6 +5007,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Repairs"); }); + modelBuilder.Entity("Nine.Core.Entities.PropertyExpense", b => + { + b.Navigation("ExpenseDues"); + }); + modelBuilder.Entity("Nine.Core.Entities.ProspectiveTenant", b => { b.Navigation("Applications"); @@ -4369,6 +5024,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Screening"); }); + modelBuilder.Entity("Nine.Core.Entities.Repair", b => + { + b.Navigation("Documents"); + }); + modelBuilder.Entity("Nine.Core.Entities.SecurityDeposit", b => { b.Navigation("Dividends"); diff --git a/1-Nine.Infrastructure/Hubs/NotificationHub.cs b/1-Nine.Infrastructure/Hubs/NotificationHub.cs index 712802d..f9bd0ac 100644 --- a/1-Nine.Infrastructure/Hubs/NotificationHub.cs +++ b/1-Nine.Infrastructure/Hubs/NotificationHub.cs @@ -26,7 +26,7 @@ public NotificationHub(ILogger logger) public override async Task OnConnectedAsync() { var userId = Context.User?.Identity?.Name; - _logger.LogInformation($"User {userId} connected to NotificationHub with ConnectionId: {Context.ConnectionId}"); + _logger.LogDebug($"User {userId} connected to NotificationHub with ConnectionId: {Context.ConnectionId}"); await base.OnConnectedAsync(); } @@ -37,7 +37,7 @@ public override async Task OnConnectedAsync() public override async Task OnDisconnectedAsync(Exception? exception) { var userId = Context.User?.Identity?.Name; - _logger.LogInformation($"User {userId} disconnected from NotificationHub. ConnectionId: {Context.ConnectionId}"); + _logger.LogDebug($"User {userId} disconnected from NotificationHub. ConnectionId: {Context.ConnectionId}"); if (exception != null) { _logger.LogError(exception, $"User {userId} disconnected with error"); diff --git a/1-Nine.Infrastructure/Nine.Infrastructure.csproj.lscache b/1-Nine.Infrastructure/Nine.Infrastructure.csproj.lscache new file mode 100644 index 0000000..212cd76 --- /dev/null +++ b/1-Nine.Infrastructure/Nine.Infrastructure.csproj.lscache @@ -0,0 +1,501 @@ +version=1 + +# This file caches language service data to improve the performance of C# Dev Kit. +# It is not intended for manual editing. It can safely be deleted and will be +# regenerated automatically. For more information, see https://aka.ms/lscache +# +# To control where cache files are stored, use the following VS Code setting: +# "dotnet.projectsystem.cacheInProjectFolder": true + +[project] +language=C# +primary +lastDtbSucceeded + +[properties] +AssemblyName=Nine.Infrastructure +CommandLineArgsForDesignTimeEvaluation=-langversion:14.0 -define:TRACE +CompilerGeneratedFilesOutputPath= +MaxSupportedLangVersion=14.0 +ProjectAssetsFile=obj/project.assets.json +RootNamespace=Nine.Infrastructure +RunAnalyzers= +RunAnalyzersDuringLiveAnalysis= +SolutionPath=../Nine.sln +TargetFrameworkIdentifier=.NETCoreApp +TargetPath=bin/Debug/net10.0/Nine.Infrastructure.dll +TargetRefPath=obj/Debug/net10.0/ref/Nine.Infrastructure.dll +TemporaryDependencyNodeTargetIdentifier=net10.0 + +[commandLineArguments] +/noconfig +/unsafe- +/checked- +/nowarn:1701,1702,1701,1702 +/fullpaths +/nostdlib+ +/errorreport:prompt +/warn:10 +/define:TRACE;DEBUG;NET;NET10_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NET8_0_OR_GREATER;NET9_0_OR_GREATER;NET10_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER +/highentropyva+ +/nullable:enable +/features:"InterceptorsNamespaces=;Microsoft.Extensions.Validation.Generated" +/debug+ +/debug:portable +/filealign:512 +/optimize- +/out:obj/Debug/net10.0/Nine.Infrastructure.dll +/refout:obj/Debug/net10.0/refint/Nine.Infrastructure.dll +/target:library +/warnaserror- +/utf8output +/deterministic+ +/langversion:14.0 +/warnaserror+:NU1605,SYSLIB0011 + +[sourceFiles] +Core/Services/ + SendGridEmailService.cs + TwilioSMSService.cs +Data/ + ApplicationDbContext.cs + CompiledModels/ + ApplicationDbContextAssemblyAttributes.cs + ApplicationDbContextModel.cs + ApplicationDbContextModelBuilder.cs + ApplicationScreeningEntityType.cs + CalendarEventEntityType.cs + CalendarSettingsEntityType.cs + ChecklistEntityType.cs + ChecklistItemEntityType.cs + ChecklistTemplateEntityType.cs + ChecklistTemplateItemEntityType.cs + DatabaseSettingsEntityType.cs + DocumentEntityType.cs + InspectionEntityType.cs + InvoiceEntityType.cs + LeaseEntityType.cs + LeaseOfferEntityType.cs + MaintenanceRequestEntityType.cs + NoteEntityType.cs + NotificationEntityType.cs + NotificationPreferencesEntityType.cs + OrganizationEmailSettingsEntityType.cs + OrganizationEntityType.cs + OrganizationSettingsEntityType.cs + OrganizationSMSSettingsEntityType.cs + OrganizationUserEntityType.cs + PaymentEntityType.cs + PropertyEntityType.cs + ProspectiveTenantEntityType.cs + RentalApplicationEntityType.cs + RepairEntityType.cs + SchemaVersionEntityType.cs + SecurityDepositDividendEntityType.cs + SecurityDepositEntityType.cs + SecurityDepositInvestmentPoolEntityType.cs + TenantEntityType.cs + TourEntityType.cs + UserProfileEntityType.cs + WorkflowAuditLogEntityType.cs + DesignTimeDbContextFactory.cs + Migrations/ + 20260128153724_v1_0_0_InitialCreate.cs + 20260128153724_v1_0_0_InitialCreate.Designer.cs + 20260201231400_AddDatabaseSettings.cs + 20260201231400_AddDatabaseSettings.Designer.cs + 20260201234216_AddEncryptionSalt.cs + 20260201234216_AddEncryptionSalt.Designer.cs + 20260209120000_FixInvoicePaymentUniqueIndexes.cs + 20260212163628_AddIsSampleDataFlag.cs + 20260212163628_AddIsSampleDataFlag.Designer.cs + 20260212165047_UpdateExistingSampleDataFlag.cs + 20260212165047_UpdateExistingSampleDataFlag.Designer.cs + 20260216205819_ConsolidateOrganizationIdToBaseModel.cs + 20260216205819_ConsolidateOrganizationIdToBaseModel.Designer.cs + 20260313122831_RenameIsAvailableToIsActive.cs + 20260313122831_RenameIsAvailableToIsActive.Designer.cs + 20260409165248_AddLeaseIsActive.cs + 20260409165248_AddLeaseIsActive.Designer.cs + 20260416173124_AddIsArchived.cs + 20260416173124_AddIsArchived.Designer.cs + 20260421174413_RemoveLease_DocumentId.cs + 20260421174413_RemoveLease_DocumentId.Designer.cs + ApplicationDbContextModelSnapshot.cs + SqlCipherConnectionInterceptor.cs +DependencyInjection.cs +Hubs/NotificationHub.cs +Interfaces/ + IEmailProvider.cs + IKeychainService.cs + ISMSProvider.cs +obj/Debug/net10.0/ + .NETCoreApp,Version=v10.0.AssemblyAttributes.cs + Nine.Infrastructure.AssemblyInfo.cs + Nine.Infrastructure.GlobalUsings.g.cs +Services/ + DatabaseEncryptionService.cs + DatabaseUnlockState.cs + LinuxKeychainService.cs + PasswordDerivationService.cs + WindowsKeychainService.cs + +[metadataReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.AspNetCore.Antiforgery.dll + Microsoft.AspNetCore.Authentication.Abstractions.dll + Microsoft.AspNetCore.Authentication.BearerToken.dll + Microsoft.AspNetCore.Authentication.Cookies.dll + Microsoft.AspNetCore.Authentication.Core.dll + Microsoft.AspNetCore.Authentication.dll + Microsoft.AspNetCore.Authentication.OAuth.dll + Microsoft.AspNetCore.Authorization.dll + Microsoft.AspNetCore.Authorization.Policy.dll + Microsoft.AspNetCore.Components.Authorization.dll + Microsoft.AspNetCore.Components.dll + Microsoft.AspNetCore.Components.Endpoints.dll + Microsoft.AspNetCore.Components.Forms.dll + Microsoft.AspNetCore.Components.Server.dll + Microsoft.AspNetCore.Components.Web.dll + Microsoft.AspNetCore.Connections.Abstractions.dll + Microsoft.AspNetCore.CookiePolicy.dll + Microsoft.AspNetCore.Cors.dll + Microsoft.AspNetCore.Cryptography.Internal.dll + Microsoft.AspNetCore.Cryptography.KeyDerivation.dll + Microsoft.AspNetCore.DataProtection.Abstractions.dll + Microsoft.AspNetCore.DataProtection.dll + Microsoft.AspNetCore.DataProtection.Extensions.dll + Microsoft.AspNetCore.Diagnostics.Abstractions.dll + Microsoft.AspNetCore.Diagnostics.dll + Microsoft.AspNetCore.Diagnostics.HealthChecks.dll + Microsoft.AspNetCore.dll + Microsoft.AspNetCore.HostFiltering.dll + Microsoft.AspNetCore.Hosting.Abstractions.dll + Microsoft.AspNetCore.Hosting.dll + Microsoft.AspNetCore.Hosting.Server.Abstractions.dll + Microsoft.AspNetCore.Html.Abstractions.dll + Microsoft.AspNetCore.Http.Abstractions.dll + Microsoft.AspNetCore.Http.Connections.Common.dll + Microsoft.AspNetCore.Http.Connections.dll + Microsoft.AspNetCore.Http.dll + Microsoft.AspNetCore.Http.Extensions.dll + Microsoft.AspNetCore.Http.Features.dll + Microsoft.AspNetCore.Http.Results.dll + Microsoft.AspNetCore.HttpLogging.dll + Microsoft.AspNetCore.HttpOverrides.dll + Microsoft.AspNetCore.HttpsPolicy.dll + Microsoft.AspNetCore.Identity.dll + Microsoft.AspNetCore.Localization.dll + Microsoft.AspNetCore.Localization.Routing.dll + Microsoft.AspNetCore.Metadata.dll + Microsoft.AspNetCore.Mvc.Abstractions.dll + Microsoft.AspNetCore.Mvc.ApiExplorer.dll + Microsoft.AspNetCore.Mvc.Core.dll + Microsoft.AspNetCore.Mvc.Cors.dll + Microsoft.AspNetCore.Mvc.DataAnnotations.dll + Microsoft.AspNetCore.Mvc.dll + Microsoft.AspNetCore.Mvc.Formatters.Json.dll + Microsoft.AspNetCore.Mvc.Formatters.Xml.dll + Microsoft.AspNetCore.Mvc.Localization.dll + Microsoft.AspNetCore.Mvc.Razor.dll + Microsoft.AspNetCore.Mvc.RazorPages.dll + Microsoft.AspNetCore.Mvc.TagHelpers.dll + Microsoft.AspNetCore.Mvc.ViewFeatures.dll + Microsoft.AspNetCore.OutputCaching.dll + Microsoft.AspNetCore.RateLimiting.dll + Microsoft.AspNetCore.Razor.dll + Microsoft.AspNetCore.Razor.Runtime.dll + Microsoft.AspNetCore.RequestDecompression.dll + Microsoft.AspNetCore.ResponseCaching.Abstractions.dll + Microsoft.AspNetCore.ResponseCaching.dll + Microsoft.AspNetCore.ResponseCompression.dll + Microsoft.AspNetCore.Rewrite.dll + Microsoft.AspNetCore.Routing.Abstractions.dll + Microsoft.AspNetCore.Routing.dll + Microsoft.AspNetCore.Server.HttpSys.dll + Microsoft.AspNetCore.Server.IIS.dll + Microsoft.AspNetCore.Server.IISIntegration.dll + Microsoft.AspNetCore.Server.Kestrel.Core.dll + Microsoft.AspNetCore.Server.Kestrel.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll + Microsoft.AspNetCore.Session.dll + Microsoft.AspNetCore.SignalR.Common.dll + Microsoft.AspNetCore.SignalR.Core.dll + Microsoft.AspNetCore.SignalR.dll + Microsoft.AspNetCore.SignalR.Protocols.Json.dll + Microsoft.AspNetCore.StaticAssets.dll + Microsoft.AspNetCore.StaticFiles.dll + Microsoft.AspNetCore.WebSockets.dll + Microsoft.AspNetCore.WebUtilities.dll + Microsoft.Extensions.Caching.Abstractions.dll + Microsoft.Extensions.Caching.Memory.dll + Microsoft.Extensions.Configuration.Abstractions.dll + Microsoft.Extensions.Configuration.Binder.dll + Microsoft.Extensions.Configuration.CommandLine.dll + Microsoft.Extensions.Configuration.dll + Microsoft.Extensions.Configuration.EnvironmentVariables.dll + Microsoft.Extensions.Configuration.FileExtensions.dll + Microsoft.Extensions.Configuration.Ini.dll + Microsoft.Extensions.Configuration.Json.dll + Microsoft.Extensions.Configuration.KeyPerFile.dll + Microsoft.Extensions.Configuration.UserSecrets.dll + Microsoft.Extensions.Configuration.Xml.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + Microsoft.Extensions.DependencyInjection.dll + Microsoft.Extensions.Diagnostics.Abstractions.dll + Microsoft.Extensions.Diagnostics.dll + Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll + Microsoft.Extensions.Diagnostics.HealthChecks.dll + Microsoft.Extensions.Features.dll + Microsoft.Extensions.FileProviders.Abstractions.dll + Microsoft.Extensions.FileProviders.Composite.dll + Microsoft.Extensions.FileProviders.Embedded.dll + Microsoft.Extensions.FileProviders.Physical.dll + Microsoft.Extensions.FileSystemGlobbing.dll + Microsoft.Extensions.Hosting.Abstractions.dll + Microsoft.Extensions.Hosting.dll + Microsoft.Extensions.Http.dll + Microsoft.Extensions.Identity.Core.dll + Microsoft.Extensions.Identity.Stores.dll + Microsoft.Extensions.Localization.Abstractions.dll + Microsoft.Extensions.Localization.dll + Microsoft.Extensions.Logging.Abstractions.dll + Microsoft.Extensions.Logging.Configuration.dll + Microsoft.Extensions.Logging.Console.dll + Microsoft.Extensions.Logging.Debug.dll + Microsoft.Extensions.Logging.dll + Microsoft.Extensions.Logging.EventLog.dll + Microsoft.Extensions.Logging.EventSource.dll + Microsoft.Extensions.Logging.TraceSource.dll + Microsoft.Extensions.ObjectPool.dll + Microsoft.Extensions.Options.ConfigurationExtensions.dll + Microsoft.Extensions.Options.DataAnnotations.dll + Microsoft.Extensions.Options.dll + Microsoft.Extensions.Primitives.dll + Microsoft.Extensions.Validation.dll + Microsoft.Extensions.WebEncoders.dll + Microsoft.JSInterop.dll + Microsoft.Net.Http.Headers.dll + System.Diagnostics.EventLog.dll + System.Formats.Cbor.dll + System.Security.Cryptography.Xml.dll + System.Threading.RateLimiting.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.CSharp.dll + Microsoft.VisualBasic.Core.dll + Microsoft.VisualBasic.dll + Microsoft.Win32.Primitives.dll + Microsoft.Win32.Registry.dll + mscorlib.dll + netstandard.dll + System.AppContext.dll + System.Buffers.dll + System.Collections.Concurrent.dll + System.Collections.dll + System.Collections.Immutable.dll + System.Collections.NonGeneric.dll + System.Collections.Specialized.dll + System.ComponentModel.Annotations.dll + System.ComponentModel.DataAnnotations.dll + System.ComponentModel.dll + System.ComponentModel.EventBasedAsync.dll + System.ComponentModel.Primitives.dll + System.ComponentModel.TypeConverter.dll + System.Configuration.dll + System.Console.dll + System.Core.dll + System.Data.Common.dll + System.Data.DataSetExtensions.dll + System.Data.dll + System.Diagnostics.Contracts.dll + System.Diagnostics.Debug.dll + System.Diagnostics.DiagnosticSource.dll + System.Diagnostics.FileVersionInfo.dll + System.Diagnostics.Process.dll + System.Diagnostics.StackTrace.dll + System.Diagnostics.TextWriterTraceListener.dll + System.Diagnostics.Tools.dll + System.Diagnostics.TraceSource.dll + System.Diagnostics.Tracing.dll + System.dll + System.Drawing.dll + System.Drawing.Primitives.dll + System.Dynamic.Runtime.dll + System.Formats.Asn1.dll + System.Formats.Tar.dll + System.Globalization.Calendars.dll + System.Globalization.dll + System.Globalization.Extensions.dll + System.IO.Compression.Brotli.dll + System.IO.Compression.dll + System.IO.Compression.FileSystem.dll + System.IO.Compression.ZipFile.dll + System.IO.dll + System.IO.FileSystem.AccessControl.dll + System.IO.FileSystem.dll + System.IO.FileSystem.DriveInfo.dll + System.IO.FileSystem.Primitives.dll + System.IO.FileSystem.Watcher.dll + System.IO.IsolatedStorage.dll + System.IO.MemoryMappedFiles.dll + System.IO.Pipelines.dll + System.IO.Pipes.AccessControl.dll + System.IO.Pipes.dll + System.IO.UnmanagedMemoryStream.dll + System.Linq.AsyncEnumerable.dll + System.Linq.dll + System.Linq.Expressions.dll + System.Linq.Parallel.dll + System.Linq.Queryable.dll + System.Memory.dll + System.Net.dll + System.Net.Http.dll + System.Net.Http.Json.dll + System.Net.HttpListener.dll + System.Net.Mail.dll + System.Net.NameResolution.dll + System.Net.NetworkInformation.dll + System.Net.Ping.dll + System.Net.Primitives.dll + System.Net.Quic.dll + System.Net.Requests.dll + System.Net.Security.dll + System.Net.ServerSentEvents.dll + System.Net.ServicePoint.dll + System.Net.Sockets.dll + System.Net.WebClient.dll + System.Net.WebHeaderCollection.dll + System.Net.WebProxy.dll + System.Net.WebSockets.Client.dll + System.Net.WebSockets.dll + System.Numerics.dll + System.Numerics.Vectors.dll + System.ObjectModel.dll + System.Reflection.DispatchProxy.dll + System.Reflection.dll + System.Reflection.Emit.dll + System.Reflection.Emit.ILGeneration.dll + System.Reflection.Emit.Lightweight.dll + System.Reflection.Extensions.dll + System.Reflection.Metadata.dll + System.Reflection.Primitives.dll + System.Reflection.TypeExtensions.dll + System.Resources.Reader.dll + System.Resources.ResourceManager.dll + System.Resources.Writer.dll + System.Runtime.CompilerServices.Unsafe.dll + System.Runtime.CompilerServices.VisualC.dll + System.Runtime.dll + System.Runtime.Extensions.dll + System.Runtime.Handles.dll + System.Runtime.InteropServices.dll + System.Runtime.InteropServices.JavaScript.dll + System.Runtime.InteropServices.RuntimeInformation.dll + System.Runtime.Intrinsics.dll + System.Runtime.Loader.dll + System.Runtime.Numerics.dll + System.Runtime.Serialization.dll + System.Runtime.Serialization.Formatters.dll + System.Runtime.Serialization.Json.dll + System.Runtime.Serialization.Primitives.dll + System.Runtime.Serialization.Xml.dll + System.Security.AccessControl.dll + System.Security.Claims.dll + System.Security.Cryptography.Algorithms.dll + System.Security.Cryptography.Cng.dll + System.Security.Cryptography.Csp.dll + System.Security.Cryptography.dll + System.Security.Cryptography.Encoding.dll + System.Security.Cryptography.OpenSsl.dll + System.Security.Cryptography.Primitives.dll + System.Security.Cryptography.X509Certificates.dll + System.Security.dll + System.Security.Principal.dll + System.Security.Principal.Windows.dll + System.Security.SecureString.dll + System.ServiceModel.Web.dll + System.ServiceProcess.dll + System.Text.Encoding.CodePages.dll + System.Text.Encoding.dll + System.Text.Encoding.Extensions.dll + System.Text.Encodings.Web.dll + System.Text.Json.dll + System.Text.RegularExpressions.dll + System.Threading.AccessControl.dll + System.Threading.Channels.dll + System.Threading.dll + System.Threading.Overlapped.dll + System.Threading.Tasks.Dataflow.dll + System.Threading.Tasks.dll + System.Threading.Tasks.Extensions.dll + System.Threading.Tasks.Parallel.dll + System.Threading.Thread.dll + System.Threading.ThreadPool.dll + System.Threading.Timer.dll + System.Transactions.dll + System.Transactions.Local.dll + System.ValueTuple.dll + System.Web.dll + System.Web.HttpUtility.dll + System.Windows.dll + System.Xml.dll + System.Xml.Linq.dll + System.Xml.ReaderWriter.dll + System.Xml.Serialization.dll + System.Xml.XDocument.dll + System.Xml.XmlDocument.dll + System.Xml.XmlSerializer.dll + System.Xml.XPath.dll + System.Xml.XPath.XDocument.dll + WindowsBase.dll +../0-Nine.Core/obj/Debug/net10.0/ref/Nine.Core.dll +/ + microsoft.aspnetcore.identity.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll + microsoft.data.sqlite.core/10.0.1/lib/net8.0/Microsoft.Data.Sqlite.dll + microsoft.entityframeworkcore.abstractions/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Abstractions.dll + microsoft.entityframeworkcore.relational/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Relational.dll + microsoft.entityframeworkcore.sqlite.core/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Sqlite.dll + microsoft.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.dll + microsoft.extensions.dependencymodel/10.0.1/lib/net10.0/Microsoft.Extensions.DependencyModel.dll + microsoft.identitymodel.abstractions/8.3.1/lib/net9.0/Microsoft.IdentityModel.Abstractions.dll + microsoft.identitymodel.jsonwebtokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.JsonWebTokens.dll + microsoft.identitymodel.logging/8.3.1/lib/net9.0/Microsoft.IdentityModel.Logging.dll + microsoft.identitymodel.tokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.Tokens.dll + newtonsoft.json/13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll + questpdf/2025.12.1/lib/net10.0/QuestPDF.dll + sendgrid/9.29.3/lib/netstandard2.0/SendGrid.dll + sqlitepclraw.bundle_e_sqlite3/2.1.11/lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll + sqlitepclraw.core/2.1.11/lib/netstandard2.0/SQLitePCLRaw.core.dll + sqlitepclraw.provider.e_sqlcipher/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlcipher.dll + sqlitepclraw.provider.e_sqlite3/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll + starkbank-ecdsa/1.3.3/lib/netstandard2.1/StarkbankEcdsa.dll + system.identitymodel.tokens.jwt/8.3.1/lib/net9.0/System.IdentityModel.Tokens.Jwt.dll + system.security.cryptography.protecteddata/9.0.0/lib/net9.0/System.Security.Cryptography.ProtectedData.dll + twilio/7.14.0/lib/net6.0/Twilio.dll + +[analyzerReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.AspNetCore.App.Analyzers.dll + Microsoft.AspNetCore.App.CodeFixes.dll + Microsoft.AspNetCore.App.SourceGenerators.dll + Microsoft.AspNetCore.Components.Analyzers.dll + Microsoft.Extensions.Logging.Generators.dll + Microsoft.Extensions.Options.SourceGeneration.dll + Microsoft.Extensions.Validation.ValidationsGenerator.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.Interop.ComInterfaceGenerator.dll + Microsoft.Interop.JavaScript.JSImportGenerator.dll + Microsoft.Interop.LibraryImportGenerator.dll + Microsoft.Interop.SourceGeneration.dll + System.Text.Json.SourceGeneration.dll + System.Text.RegularExpressions.Generator.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/ + Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll + Microsoft.CodeAnalysis.NetAnalyzers.dll +/microsoft.entityframeworkcore.analyzers/10.0.1/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll + +[analyzerConfigFiles] +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig +obj/Debug/net10.0/Nine.Infrastructure.GeneratedMSBuildEditorConfig.editorconfig diff --git a/1-Nine.Infrastructure/Services/DatabaseEncryptionService.cs b/1-Nine.Infrastructure/Services/DatabaseEncryptionService.cs index a78843c..efdddff 100644 --- a/1-Nine.Infrastructure/Services/DatabaseEncryptionService.cs +++ b/1-Nine.Infrastructure/Services/DatabaseEncryptionService.cs @@ -149,9 +149,10 @@ public DatabaseEncryptionService( ///
/// Path to encrypted database /// User's master password + /// Whether to remove the keychain entry after decryption. Set false when decrypting for backup export. /// (Success, DecryptedPath, ErrorMessage) public async Task<(bool Success, string? DecryptedPath, string? ErrorMessage)> - DecryptDatabaseAsync(string encryptedPath, string password) + DecryptDatabaseAsync(string encryptedPath, string password, bool removeKeychainEntry = true) { try { @@ -256,8 +257,9 @@ public DatabaseEncryptionService( SqliteConnection.ClearAllPools(); await Task.Delay(200); - // Remove password from keychain - _keychain.RemoveKey(); + // Remove password from keychain only when permanently disabling encryption + if (removeKeychainEntry) + _keychain.RemoveKey(); _logger.LogInformation("Database decryption completed successfully"); return (true, decryptedPath, null); @@ -351,4 +353,96 @@ private async Task VerifyPlaintextDatabaseAsync(string dbPath) /// Check if keychain service is available /// public bool IsKeychainAvailable() => _keychain.IsAvailable(); + + /// + /// Change the encryption password of an already-encrypted database using PRAGMA rekey. + /// Verifies the current password before applying the change, then updates the OS keychain. + /// + /// Absolute path to the encrypted database file + /// Current master password + /// New master password (minimum 12 characters) + /// (Success, ErrorMessage) + public async Task<(bool Success, string? ErrorMessage)> ChangePasswordAsync( + string dbPath, string currentPassword, string newPassword) + { + try + { + _logger.LogInformation("Starting password change for {Path}", dbPath); + + // Validate new password strength + var (isValid, validationError) = _passwordDerivation.ValidatePasswordStrength(newPassword); + if (!isValid) + return (false, validationError); + + SQLitePCL.Batteries_V2.Init(); + SQLitePCL.raw.sqlite3_initialize(); + SqliteConnection.ClearAllPools(); + + // Step 1 — open with current password and verify + using (var conn = new SqliteConnection($"Data Source={dbPath}")) + { + await conn.OpenAsync(); + + using (var cmd = conn.CreateCommand()) + { + cmd.CommandText = $"PRAGMA key = '{currentPassword}';"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA cipher_page_size = 4096;"; + await cmd.ExecuteNonQueryAsync(); + cmd.CommandText = "PRAGMA kdf_iter = 256000;"; + await cmd.ExecuteNonQueryAsync(); + cmd.CommandText = "PRAGMA cipher_hmac_algorithm = HMAC_SHA512;"; + await cmd.ExecuteNonQueryAsync(); + cmd.CommandText = "PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;"; + await cmd.ExecuteNonQueryAsync(); + } + + // Verify current password is correct + try + { + using (var cmd = conn.CreateCommand()) + { + cmd.CommandText = "SELECT count(*) FROM sqlite_master;"; + await cmd.ExecuteScalarAsync(); + } + } + catch + { + return (false, "Current password is incorrect."); + } + + // Step 2 — rekey in-place + using (var cmd = conn.CreateCommand()) + { + cmd.CommandText = $"PRAGMA rekey = '{newPassword}';"; + await cmd.ExecuteNonQueryAsync(); + _logger.LogInformation("PRAGMA rekey executed"); + } + } + + SqliteConnection.ClearAllPools(); + await Task.Delay(200); + + // Step 3 — verify new password opens the database + var verifySuccess = await VerifyEncryptedDatabaseAsync(dbPath, newPassword); + if (!verifySuccess) + return (false, "Password change completed but verification with the new password failed. " + + "The original password may still be active — please try again."); + + // Step 4 — update keychain + var stored = _keychain.StoreKey(newPassword, "Nine Database Encryption Password"); + if (!stored) + _logger.LogWarning("Password changed successfully but keychain update failed. " + + "You will be prompted for the new password on next startup."); + + _logger.LogInformation("Database password changed successfully"); + return (true, null); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to change database password"); + return (false, $"Password change failed: {ex.Message}"); + } + } } diff --git a/1-Nine.Infrastructure/Services/LinuxKeychainService.cs b/1-Nine.Infrastructure/Services/LinuxKeychainService.cs index 503122c..945f55b 100644 --- a/1-Nine.Infrastructure/Services/LinuxKeychainService.cs +++ b/1-Nine.Infrastructure/Services/LinuxKeychainService.cs @@ -1,5 +1,7 @@ using System.Runtime.InteropServices; using System.Text; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Nine.Infrastructure.Interfaces; namespace Nine.Infrastructure.Services; @@ -13,16 +15,19 @@ public class LinuxKeychainService : IKeychainService private const string Schema = "co.nineapp.database"; private const string KeyAttribute = "key-type"; private readonly string _keyValue; + private readonly ILogger _logger; /// /// Initialize keychain service with app-specific identifier /// /// Application name (e.g., "Nine-Web", "Nine-Electron", "Professional-Web") to prevent keychain conflicts - public LinuxKeychainService(string appName = "Nine-Electron") + /// Optional logger for routine diagnostics (written at Debug level). Omit during startup, before DI is available. + public LinuxKeychainService(string appName = "Nine-Electron", ILogger? logger = null) { + _logger = logger ?? NullLogger.Instance; // Make keychain entry unique per application to prevent password conflicts _keyValue = $"database-encryption-{appName}"; - Console.WriteLine($"[LinuxKeychainService] Initialized with key attribute value: {_keyValue}"); + _logger.LogDebug("Keychain initialized with key attribute value {KeyValue}", _keyValue); } /// @@ -79,7 +84,7 @@ public bool StoreKey(string keyHex, string label = "Nine Database Encryption Key try { - Console.WriteLine($"[LinuxKeychainService] Retrieving key with attribute value: {_keyValue}"); + _logger.LogDebug("Retrieving key with attribute value {KeyValue}", _keyValue); var process = new System.Diagnostics.Process { StartInfo = new System.Diagnostics.ProcessStartInfo @@ -101,8 +106,8 @@ public bool StoreKey(string keyHex, string label = "Nine Database Encryption Key process.WaitForExit(5000); - Console.WriteLine($"[LinuxKeychainService] secret-tool exit code: {process.ExitCode}"); - Console.WriteLine($"[LinuxKeychainService] secret-tool output: [{(string.IsNullOrWhiteSpace(output) ? "empty" : "received")}]"); + _logger.LogDebug("secret-tool exit code {ExitCode}", process.ExitCode); + _logger.LogDebug("secret-tool output status: {Status}", string.IsNullOrWhiteSpace(output) ? "empty" : "received"); if (!string.IsNullOrWhiteSpace(error)) { Console.WriteLine($"[LinuxKeychainService] secret-tool error: {error}"); diff --git a/1-Nine.Infrastructure/Services/WindowsKeychainService.cs b/1-Nine.Infrastructure/Services/WindowsKeychainService.cs index 63110a5..04eaa5d 100644 --- a/1-Nine.Infrastructure/Services/WindowsKeychainService.cs +++ b/1-Nine.Infrastructure/Services/WindowsKeychainService.cs @@ -1,6 +1,8 @@ using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Nine.Infrastructure.Interfaces; namespace Nine.Infrastructure.Services; @@ -15,13 +17,16 @@ namespace Nine.Infrastructure.Services; public class WindowsKeychainService : IKeychainService { private readonly string _keyFilePath; + private readonly ILogger _logger; /// /// Initialize the Windows DPAPI keychain service. /// /// App-specific identifier to prevent key conflicts (e.g. "Nine-Electron") - public WindowsKeychainService(string appName = "Nine-Electron") + /// Optional logger for routine diagnostics (written at Debug level). Omit during startup, before DI is available. + public WindowsKeychainService(string appName = "Nine-Electron", ILogger? logger = null) { + _logger = logger ?? NullLogger.Instance; var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var nineDir = Path.Combine(appDataPath, "Nine"); Directory.CreateDirectory(nineDir); @@ -30,7 +35,7 @@ public WindowsKeychainService(string appName = "Nine-Electron") var safeAppName = new string(appName.Where(c => char.IsLetterOrDigit(c) || c == '-' || c == '_').ToArray()); _keyFilePath = Path.Combine(nineDir, $"aquiis_{safeAppName}.key"); - Console.WriteLine($"[WindowsKeychainService] Initialized with key file: {_keyFilePath}"); + _logger.LogDebug("Keychain initialized with key file {KeyFilePath}", _keyFilePath); } /// @@ -41,11 +46,11 @@ public bool StoreKey(string password, string label = "Nine Database Encryption K { try { - Console.WriteLine("[WindowsKeychainService] Storing password using DPAPI"); + _logger.LogDebug("Storing password using DPAPI"); var plainBytes = Encoding.UTF8.GetBytes(password); var encryptedBytes = ProtectedData.Protect(plainBytes, null, DataProtectionScope.CurrentUser); File.WriteAllBytes(_keyFilePath, encryptedBytes); - Console.WriteLine("[WindowsKeychainService] Password stored successfully using DPAPI"); + _logger.LogDebug("Password stored successfully using DPAPI"); return true; } catch (Exception ex) @@ -69,11 +74,11 @@ public bool StoreKey(string password, string label = "Nine Database Encryption K try { - Console.WriteLine("[WindowsKeychainService] Retrieving password using DPAPI"); + _logger.LogDebug("Retrieving password using DPAPI"); var encryptedBytes = File.ReadAllBytes(_keyFilePath); var plainBytes = ProtectedData.Unprotect(encryptedBytes, null, DataProtectionScope.CurrentUser); var password = Encoding.UTF8.GetString(plainBytes); - Console.WriteLine($"[WindowsKeychainService] Password retrieved successfully using DPAPI. Password status: {(string.IsNullOrEmpty(password) ? "empty" : "received")}"); + _logger.LogDebug("Password retrieved using DPAPI. Password status: {Status}", string.IsNullOrEmpty(password) ? "empty" : "received"); return password; } catch (CryptographicException ex) @@ -99,7 +104,7 @@ public bool RemoveKey() if (File.Exists(_keyFilePath)) { File.Delete(_keyFilePath); - Console.WriteLine("[WindowsKeychainService] Key file deleted successfully"); + _logger.LogDebug("Key file deleted successfully"); } return true; } diff --git a/2-Nine.Application/DependencyInjection.cs b/2-Nine.Application/DependencyInjection.cs index 8d6e7b1..dd000d5 100644 --- a/2-Nine.Application/DependencyInjection.cs +++ b/2-Nine.Application/DependencyInjection.cs @@ -1,6 +1,7 @@ using Nine.Application.Services; using Nine.Application.Services.PdfGenerators; using Nine.Application.Services.Workflows; +using Nine.Core.Interfaces.Services; using Nine.Infrastructure; using Nine.Infrastructure.Data; using Microsoft.Extensions.DependencyInjection; @@ -36,7 +37,11 @@ public static IServiceCollection AddApplication( services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -56,12 +61,14 @@ public static IServiceCollection AddApplication( services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/2-Nine.Application/Models/CascadeSummary.cs b/2-Nine.Application/Models/CascadeSummary.cs new file mode 100644 index 0000000..7421bf9 --- /dev/null +++ b/2-Nine.Application/Models/CascadeSummary.cs @@ -0,0 +1,19 @@ +namespace Nine.Application.Models; + +/// +/// Describes related records that will be affected by an archive or delete operation. +/// +public class CascadeSummary +{ + public string EntityName { get; init; } = string.Empty; + + /// Key = human-readable label, Value = record count. + public Dictionary Counts { get; init; } = new(); + + public bool HasRelatedRecords => Counts.Values.Any(c => c > 0); + + public string Summary => + HasRelatedRecords + ? string.Join(", ", Counts.Where(c => c.Value > 0).Select(c => $"{c.Value} {c.Key}")) + : "No related records."; +} diff --git a/2-Nine.Application/Nine.Application.csproj.lscache b/2-Nine.Application/Nine.Application.csproj.lscache new file mode 100644 index 0000000..ad19e99 --- /dev/null +++ b/2-Nine.Application/Nine.Application.csproj.lscache @@ -0,0 +1,491 @@ +version=1 + +# This file caches language service data to improve the performance of C# Dev Kit. +# It is not intended for manual editing. It can safely be deleted and will be +# regenerated automatically. For more information, see https://aka.ms/lscache +# +# To control where cache files are stored, use the following VS Code setting: +# "dotnet.projectsystem.cacheInProjectFolder": true + +[project] +language=C# +primary +lastDtbSucceeded + +[properties] +AssemblyName=Nine.Application +CommandLineArgsForDesignTimeEvaluation=-langversion:14.0 -define:TRACE +CompilerGeneratedFilesOutputPath= +MaxSupportedLangVersion=14.0 +ProjectAssetsFile=obj/project.assets.json +RootNamespace=Nine.Application +RunAnalyzers= +RunAnalyzersDuringLiveAnalysis= +SolutionPath=../Nine.sln +TargetFrameworkIdentifier=.NETCoreApp +TargetPath=bin/Debug/net10.0/Nine.Application.dll +TargetRefPath=obj/Debug/net10.0/ref/Nine.Application.dll +TemporaryDependencyNodeTargetIdentifier=net10.0 + +[commandLineArguments] +/noconfig +/unsafe- +/checked- +/nowarn:1701,1702,1701,1702 +/fullpaths +/nostdlib+ +/errorreport:prompt +/warn:10 +/define:TRACE;DEBUG;NET;NET10_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NET8_0_OR_GREATER;NET9_0_OR_GREATER;NET10_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER +/highentropyva+ +/nullable:enable +/features:"InterceptorsNamespaces=;Microsoft.Extensions.Validation.Generated" +/debug+ +/debug:portable +/filealign:512 +/optimize- +/out:obj/Debug/net10.0/Nine.Application.dll +/refout:obj/Debug/net10.0/refint/Nine.Application.dll +/target:library +/warnaserror- +/utf8output +/deterministic+ +/langversion:14.0 +/warnaserror+:NU1605,SYSLIB0011 + +[sourceFiles] +Constants/ + AccountConstants.cs + EntityTypeNames.cs +DependencyInjection.cs +GlobalUsings.cs +Models/ + CascadeSummary.cs + DTOs/DatabasePreviewDTOs.cs + EmailConfigurationModel.cs + SMSConfigurationModel.cs +obj/Debug/net10.0/ + .NETCoreApp,Version=v10.0.AssemblyAttributes.cs + Nine.Application.AssemblyInfo.cs + Nine.Application.GlobalUsings.g.cs +Services/ + ApplicationService.cs + BaseService.cs + CalendarEventService.cs + CalendarSettingsService.cs + ChecklistService.cs + DatabasePasswordService.cs + DatabasePreviewService.cs + DatabaseService.cs + DatabaseUnlockService.cs + DigestService.cs + DocumentNotificationService.cs + DocumentService.cs + EmailService.cs + EmailSettingsService.cs + FinancialReportService.cs + InspectionService.cs + InvoiceService.cs + LeaseNotificationService.cs + LeaseOfferService.cs + LeaseService.cs + MaintenanceNotificationService.cs + MaintenanceService.cs + NineFinancialReportService.cs + NoteService.cs + NotificationService.cs + OrganizationService.cs + PaymentService.cs + PdfGenerators/ + ChecklistPdfGenerator.cs + FinancialReportPdfGenerator.cs + InspectionPdfGenerator.cs + InvoicePdfGenerator.cs + LeasePdfGenerator.cs + LeaseRenewalPdfGenerator.cs + PaymentPdfGenerator.cs + PropertyManagementService.cs + PropertyService.cs + ProspectiveTenantService.cs + RentalApplicationService.cs + RepairService.cs + ScheduledTaskService.cs + SchemaValidationService.cs + ScreeningService.cs + SecurityDepositService.cs + SMSService.cs + SMSSettingsService.cs + TenantConversionService.cs + TenantService.cs + TourService.cs + Workflows/ + AccountWorkflowService.cs + ApplicationWorkflowService.cs + BaseWorkflowService.cs + IWorkflowState.cs + LeaseWorkflowService.cs + SampleDataWorkflowService.cs + WorkflowResult.cs + +[metadataReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.AspNetCore.Antiforgery.dll + Microsoft.AspNetCore.Authentication.Abstractions.dll + Microsoft.AspNetCore.Authentication.BearerToken.dll + Microsoft.AspNetCore.Authentication.Cookies.dll + Microsoft.AspNetCore.Authentication.Core.dll + Microsoft.AspNetCore.Authentication.dll + Microsoft.AspNetCore.Authentication.OAuth.dll + Microsoft.AspNetCore.Authorization.dll + Microsoft.AspNetCore.Authorization.Policy.dll + Microsoft.AspNetCore.Components.Authorization.dll + Microsoft.AspNetCore.Components.dll + Microsoft.AspNetCore.Components.Endpoints.dll + Microsoft.AspNetCore.Components.Forms.dll + Microsoft.AspNetCore.Components.Server.dll + Microsoft.AspNetCore.Components.Web.dll + Microsoft.AspNetCore.Connections.Abstractions.dll + Microsoft.AspNetCore.CookiePolicy.dll + Microsoft.AspNetCore.Cors.dll + Microsoft.AspNetCore.Cryptography.Internal.dll + Microsoft.AspNetCore.Cryptography.KeyDerivation.dll + Microsoft.AspNetCore.DataProtection.Abstractions.dll + Microsoft.AspNetCore.DataProtection.dll + Microsoft.AspNetCore.DataProtection.Extensions.dll + Microsoft.AspNetCore.Diagnostics.Abstractions.dll + Microsoft.AspNetCore.Diagnostics.dll + Microsoft.AspNetCore.Diagnostics.HealthChecks.dll + Microsoft.AspNetCore.dll + Microsoft.AspNetCore.HostFiltering.dll + Microsoft.AspNetCore.Hosting.Abstractions.dll + Microsoft.AspNetCore.Hosting.dll + Microsoft.AspNetCore.Hosting.Server.Abstractions.dll + Microsoft.AspNetCore.Html.Abstractions.dll + Microsoft.AspNetCore.Http.Abstractions.dll + Microsoft.AspNetCore.Http.Connections.Common.dll + Microsoft.AspNetCore.Http.Connections.dll + Microsoft.AspNetCore.Http.dll + Microsoft.AspNetCore.Http.Extensions.dll + Microsoft.AspNetCore.Http.Features.dll + Microsoft.AspNetCore.Http.Results.dll + Microsoft.AspNetCore.HttpLogging.dll + Microsoft.AspNetCore.HttpOverrides.dll + Microsoft.AspNetCore.HttpsPolicy.dll + Microsoft.AspNetCore.Identity.dll + Microsoft.AspNetCore.Localization.dll + Microsoft.AspNetCore.Localization.Routing.dll + Microsoft.AspNetCore.Metadata.dll + Microsoft.AspNetCore.Mvc.Abstractions.dll + Microsoft.AspNetCore.Mvc.ApiExplorer.dll + Microsoft.AspNetCore.Mvc.Core.dll + Microsoft.AspNetCore.Mvc.Cors.dll + Microsoft.AspNetCore.Mvc.DataAnnotations.dll + Microsoft.AspNetCore.Mvc.dll + Microsoft.AspNetCore.Mvc.Formatters.Json.dll + Microsoft.AspNetCore.Mvc.Formatters.Xml.dll + Microsoft.AspNetCore.Mvc.Localization.dll + Microsoft.AspNetCore.Mvc.Razor.dll + Microsoft.AspNetCore.Mvc.RazorPages.dll + Microsoft.AspNetCore.Mvc.TagHelpers.dll + Microsoft.AspNetCore.Mvc.ViewFeatures.dll + Microsoft.AspNetCore.OutputCaching.dll + Microsoft.AspNetCore.RateLimiting.dll + Microsoft.AspNetCore.Razor.dll + Microsoft.AspNetCore.Razor.Runtime.dll + Microsoft.AspNetCore.RequestDecompression.dll + Microsoft.AspNetCore.ResponseCaching.Abstractions.dll + Microsoft.AspNetCore.ResponseCaching.dll + Microsoft.AspNetCore.ResponseCompression.dll + Microsoft.AspNetCore.Rewrite.dll + Microsoft.AspNetCore.Routing.Abstractions.dll + Microsoft.AspNetCore.Routing.dll + Microsoft.AspNetCore.Server.HttpSys.dll + Microsoft.AspNetCore.Server.IIS.dll + Microsoft.AspNetCore.Server.IISIntegration.dll + Microsoft.AspNetCore.Server.Kestrel.Core.dll + Microsoft.AspNetCore.Server.Kestrel.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll + Microsoft.AspNetCore.Session.dll + Microsoft.AspNetCore.SignalR.Common.dll + Microsoft.AspNetCore.SignalR.Core.dll + Microsoft.AspNetCore.SignalR.dll + Microsoft.AspNetCore.SignalR.Protocols.Json.dll + Microsoft.AspNetCore.StaticAssets.dll + Microsoft.AspNetCore.StaticFiles.dll + Microsoft.AspNetCore.WebSockets.dll + Microsoft.AspNetCore.WebUtilities.dll + Microsoft.Extensions.Caching.Abstractions.dll + Microsoft.Extensions.Caching.Memory.dll + Microsoft.Extensions.Configuration.Abstractions.dll + Microsoft.Extensions.Configuration.Binder.dll + Microsoft.Extensions.Configuration.CommandLine.dll + Microsoft.Extensions.Configuration.dll + Microsoft.Extensions.Configuration.EnvironmentVariables.dll + Microsoft.Extensions.Configuration.FileExtensions.dll + Microsoft.Extensions.Configuration.Ini.dll + Microsoft.Extensions.Configuration.Json.dll + Microsoft.Extensions.Configuration.KeyPerFile.dll + Microsoft.Extensions.Configuration.UserSecrets.dll + Microsoft.Extensions.Configuration.Xml.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + Microsoft.Extensions.DependencyInjection.dll + Microsoft.Extensions.Diagnostics.Abstractions.dll + Microsoft.Extensions.Diagnostics.dll + Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll + Microsoft.Extensions.Diagnostics.HealthChecks.dll + Microsoft.Extensions.Features.dll + Microsoft.Extensions.FileProviders.Abstractions.dll + Microsoft.Extensions.FileProviders.Composite.dll + Microsoft.Extensions.FileProviders.Embedded.dll + Microsoft.Extensions.FileProviders.Physical.dll + Microsoft.Extensions.FileSystemGlobbing.dll + Microsoft.Extensions.Hosting.Abstractions.dll + Microsoft.Extensions.Hosting.dll + Microsoft.Extensions.Http.dll + Microsoft.Extensions.Identity.Core.dll + Microsoft.Extensions.Identity.Stores.dll + Microsoft.Extensions.Localization.Abstractions.dll + Microsoft.Extensions.Localization.dll + Microsoft.Extensions.Logging.Abstractions.dll + Microsoft.Extensions.Logging.Configuration.dll + Microsoft.Extensions.Logging.Console.dll + Microsoft.Extensions.Logging.Debug.dll + Microsoft.Extensions.Logging.dll + Microsoft.Extensions.Logging.EventLog.dll + Microsoft.Extensions.Logging.EventSource.dll + Microsoft.Extensions.Logging.TraceSource.dll + Microsoft.Extensions.ObjectPool.dll + Microsoft.Extensions.Options.ConfigurationExtensions.dll + Microsoft.Extensions.Options.DataAnnotations.dll + Microsoft.Extensions.Options.dll + Microsoft.Extensions.Primitives.dll + Microsoft.Extensions.Validation.dll + Microsoft.Extensions.WebEncoders.dll + Microsoft.JSInterop.dll + Microsoft.Net.Http.Headers.dll + System.Diagnostics.EventLog.dll + System.Formats.Cbor.dll + System.Security.Cryptography.Xml.dll + System.Threading.RateLimiting.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.CSharp.dll + Microsoft.VisualBasic.Core.dll + Microsoft.VisualBasic.dll + Microsoft.Win32.Primitives.dll + Microsoft.Win32.Registry.dll + mscorlib.dll + netstandard.dll + System.AppContext.dll + System.Buffers.dll + System.Collections.Concurrent.dll + System.Collections.dll + System.Collections.Immutable.dll + System.Collections.NonGeneric.dll + System.Collections.Specialized.dll + System.ComponentModel.Annotations.dll + System.ComponentModel.DataAnnotations.dll + System.ComponentModel.dll + System.ComponentModel.EventBasedAsync.dll + System.ComponentModel.Primitives.dll + System.ComponentModel.TypeConverter.dll + System.Configuration.dll + System.Console.dll + System.Core.dll + System.Data.Common.dll + System.Data.DataSetExtensions.dll + System.Data.dll + System.Diagnostics.Contracts.dll + System.Diagnostics.Debug.dll + System.Diagnostics.DiagnosticSource.dll + System.Diagnostics.FileVersionInfo.dll + System.Diagnostics.Process.dll + System.Diagnostics.StackTrace.dll + System.Diagnostics.TextWriterTraceListener.dll + System.Diagnostics.Tools.dll + System.Diagnostics.TraceSource.dll + System.Diagnostics.Tracing.dll + System.dll + System.Drawing.dll + System.Drawing.Primitives.dll + System.Dynamic.Runtime.dll + System.Formats.Asn1.dll + System.Formats.Tar.dll + System.Globalization.Calendars.dll + System.Globalization.dll + System.Globalization.Extensions.dll + System.IO.Compression.Brotli.dll + System.IO.Compression.dll + System.IO.Compression.FileSystem.dll + System.IO.Compression.ZipFile.dll + System.IO.dll + System.IO.FileSystem.AccessControl.dll + System.IO.FileSystem.dll + System.IO.FileSystem.DriveInfo.dll + System.IO.FileSystem.Primitives.dll + System.IO.FileSystem.Watcher.dll + System.IO.IsolatedStorage.dll + System.IO.MemoryMappedFiles.dll + System.IO.Pipelines.dll + System.IO.Pipes.AccessControl.dll + System.IO.Pipes.dll + System.IO.UnmanagedMemoryStream.dll + System.Linq.AsyncEnumerable.dll + System.Linq.dll + System.Linq.Expressions.dll + System.Linq.Parallel.dll + System.Linq.Queryable.dll + System.Memory.dll + System.Net.dll + System.Net.Http.dll + System.Net.Http.Json.dll + System.Net.HttpListener.dll + System.Net.Mail.dll + System.Net.NameResolution.dll + System.Net.NetworkInformation.dll + System.Net.Ping.dll + System.Net.Primitives.dll + System.Net.Quic.dll + System.Net.Requests.dll + System.Net.Security.dll + System.Net.ServerSentEvents.dll + System.Net.ServicePoint.dll + System.Net.Sockets.dll + System.Net.WebClient.dll + System.Net.WebHeaderCollection.dll + System.Net.WebProxy.dll + System.Net.WebSockets.Client.dll + System.Net.WebSockets.dll + System.Numerics.dll + System.Numerics.Vectors.dll + System.ObjectModel.dll + System.Reflection.DispatchProxy.dll + System.Reflection.dll + System.Reflection.Emit.dll + System.Reflection.Emit.ILGeneration.dll + System.Reflection.Emit.Lightweight.dll + System.Reflection.Extensions.dll + System.Reflection.Metadata.dll + System.Reflection.Primitives.dll + System.Reflection.TypeExtensions.dll + System.Resources.Reader.dll + System.Resources.ResourceManager.dll + System.Resources.Writer.dll + System.Runtime.CompilerServices.Unsafe.dll + System.Runtime.CompilerServices.VisualC.dll + System.Runtime.dll + System.Runtime.Extensions.dll + System.Runtime.Handles.dll + System.Runtime.InteropServices.dll + System.Runtime.InteropServices.JavaScript.dll + System.Runtime.InteropServices.RuntimeInformation.dll + System.Runtime.Intrinsics.dll + System.Runtime.Loader.dll + System.Runtime.Numerics.dll + System.Runtime.Serialization.dll + System.Runtime.Serialization.Formatters.dll + System.Runtime.Serialization.Json.dll + System.Runtime.Serialization.Primitives.dll + System.Runtime.Serialization.Xml.dll + System.Security.AccessControl.dll + System.Security.Claims.dll + System.Security.Cryptography.Algorithms.dll + System.Security.Cryptography.Cng.dll + System.Security.Cryptography.Csp.dll + System.Security.Cryptography.dll + System.Security.Cryptography.Encoding.dll + System.Security.Cryptography.OpenSsl.dll + System.Security.Cryptography.Primitives.dll + System.Security.Cryptography.X509Certificates.dll + System.Security.dll + System.Security.Principal.dll + System.Security.Principal.Windows.dll + System.Security.SecureString.dll + System.ServiceModel.Web.dll + System.ServiceProcess.dll + System.Text.Encoding.CodePages.dll + System.Text.Encoding.dll + System.Text.Encoding.Extensions.dll + System.Text.Encodings.Web.dll + System.Text.Json.dll + System.Text.RegularExpressions.dll + System.Threading.AccessControl.dll + System.Threading.Channels.dll + System.Threading.dll + System.Threading.Overlapped.dll + System.Threading.Tasks.Dataflow.dll + System.Threading.Tasks.dll + System.Threading.Tasks.Extensions.dll + System.Threading.Tasks.Parallel.dll + System.Threading.Thread.dll + System.Threading.ThreadPool.dll + System.Threading.Timer.dll + System.Transactions.dll + System.Transactions.Local.dll + System.ValueTuple.dll + System.Web.dll + System.Web.HttpUtility.dll + System.Windows.dll + System.Xml.dll + System.Xml.Linq.dll + System.Xml.ReaderWriter.dll + System.Xml.Serialization.dll + System.Xml.XDocument.dll + System.Xml.XmlDocument.dll + System.Xml.XmlSerializer.dll + System.Xml.XPath.dll + System.Xml.XPath.XDocument.dll + WindowsBase.dll +../ + 0-Nine.Core/obj/Debug/net10.0/ref/Nine.Core.dll + 1-Nine.Infrastructure/obj/Debug/net10.0/ref/Nine.Infrastructure.dll +/ + microsoft.aspnetcore.diagnostics.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll + microsoft.aspnetcore.identity.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll + microsoft.data.sqlite.core/10.0.1/lib/net8.0/Microsoft.Data.Sqlite.dll + microsoft.entityframeworkcore.abstractions/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Abstractions.dll + microsoft.entityframeworkcore.relational/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Relational.dll + microsoft.entityframeworkcore.sqlite.core/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Sqlite.dll + microsoft.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.dll + microsoft.extensions.dependencymodel/10.0.1/lib/net10.0/Microsoft.Extensions.DependencyModel.dll + microsoft.identitymodel.abstractions/8.3.1/lib/net9.0/Microsoft.IdentityModel.Abstractions.dll + microsoft.identitymodel.jsonwebtokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.JsonWebTokens.dll + microsoft.identitymodel.logging/8.3.1/lib/net9.0/Microsoft.IdentityModel.Logging.dll + microsoft.identitymodel.tokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.Tokens.dll + newtonsoft.json/13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll + questpdf/2025.12.1/lib/net10.0/QuestPDF.dll + sendgrid/9.29.3/lib/netstandard2.0/SendGrid.dll + sqlitepclraw.bundle_e_sqlite3/2.1.11/lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll + sqlitepclraw.core/2.1.11/lib/netstandard2.0/SQLitePCLRaw.core.dll + sqlitepclraw.provider.e_sqlcipher/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlcipher.dll + sqlitepclraw.provider.e_sqlite3/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll + starkbank-ecdsa/1.3.3/lib/netstandard2.1/StarkbankEcdsa.dll + system.identitymodel.tokens.jwt/8.3.1/lib/net9.0/System.IdentityModel.Tokens.Jwt.dll + system.security.cryptography.protecteddata/9.0.0/lib/net9.0/System.Security.Cryptography.ProtectedData.dll + twilio/7.14.0/lib/net6.0/Twilio.dll + +[analyzerReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.AspNetCore.App.Analyzers.dll + Microsoft.AspNetCore.App.CodeFixes.dll + Microsoft.AspNetCore.App.SourceGenerators.dll + Microsoft.AspNetCore.Components.Analyzers.dll + Microsoft.Extensions.Logging.Generators.dll + Microsoft.Extensions.Options.SourceGeneration.dll + Microsoft.Extensions.Validation.ValidationsGenerator.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.Interop.ComInterfaceGenerator.dll + Microsoft.Interop.JavaScript.JSImportGenerator.dll + Microsoft.Interop.LibraryImportGenerator.dll + Microsoft.Interop.SourceGeneration.dll + System.Text.Json.SourceGeneration.dll + System.Text.RegularExpressions.Generator.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/ + Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll + Microsoft.CodeAnalysis.NetAnalyzers.dll +/microsoft.entityframeworkcore.analyzers/10.0.1/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll + +[analyzerConfigFiles] +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig +obj/Debug/net10.0/Nine.Application.GeneratedMSBuildEditorConfig.editorconfig diff --git a/2-Nine.Application/Services/BaseService.cs b/2-Nine.Application/Services/BaseService.cs index 0e52c0a..0bd0409 100644 --- a/2-Nine.Application/Services/BaseService.cs +++ b/2-Nine.Application/Services/BaseService.cs @@ -1,4 +1,5 @@ using System.Linq.Expressions; +using Nine.Application.Models; using Nine.Core.Constants; using Nine.Core.Entities; using Nine.Core.Interfaces.Services; @@ -99,7 +100,7 @@ public virtual async Task> GetAllAsync() var organizationId = await _userContext.GetActiveOrganizationIdAsync(); - IQueryable query = _dbSet.Where(e => !e.IsDeleted); + IQueryable query = _dbSet.Where(e => !e.IsDeleted && !e.IsArchived); // Apply organization filter if entity has OrganizationId property if (typeof(TEntity).GetProperty("OrganizationId") != null) @@ -279,30 +280,172 @@ public virtual async Task DeleteAsync(Guid id) } } - // Soft delete or hard delete based on settings - if (_settings.SoftDeleteEnabled) + _dbSet.Remove(entity); + await _context.SaveChangesAsync(); + _logger.LogInformation($"{typeof(TEntity).Name} hard deleted: {id} by user {userId}"); + + return true; + } + catch (Exception ex) + { + await HandleExceptionAsync(ex, $"Delete{typeof(TEntity).Name}"); + throw; + } + } + + /// + /// Retrieves all archived (non-deleted) entities for the current organization. + /// + public virtual async Task> GetArchivedAsync() + { + try + { + var userId = await _userContext.GetUserIdAsync(); + if (string.IsNullOrEmpty(userId)) + { + throw new UnauthorizedAccessException("User is not authenticated."); + } + + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + IQueryable query = _dbSet.Where(e => !e.IsDeleted && e.IsArchived); + + if (typeof(TEntity).GetProperty("OrganizationId") != null) + { + var parameter = Expression.Parameter(typeof(TEntity), "e"); + var property = Expression.Property(parameter, "OrganizationId"); + var constant = Expression.Constant(organizationId); + var condition = Expression.Equal(property, constant); + var lambda = Expression.Lambda>(condition, parameter); + + query = query.Where(lambda); + } + + return await query.ToListAsync(); + } + catch (Exception ex) + { + await HandleExceptionAsync(ex, $"GetArchived{typeof(TEntity).Name}"); + throw; + } + } + + /// + /// Archives an entity, preserving it for historical reference. + /// + public virtual async Task ArchiveAsync(Guid id) + { + try + { + var userId = await _userContext.GetUserIdAsync(); + if (string.IsNullOrEmpty(userId)) + { + throw new UnauthorizedAccessException("User is not authenticated."); + } + + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + var entity = await _dbSet.FirstOrDefaultAsync(e => e.Id == id && !e.IsDeleted && !e.IsArchived); + + if (entity == null) { - entity.IsDeleted = true; - SetAuditFieldsForUpdate(entity, userId); - await _context.SaveChangesAsync(); - _logger.LogInformation($"{typeof(TEntity).Name} soft deleted: {id} by user {userId}"); + _logger.LogWarning($"{typeof(TEntity).Name} not found for archiving: {id}"); + return false; } - else + + if (HasOrganizationIdProperty(entity) && organizationId.HasValue) { - _dbSet.Remove(entity); - await _context.SaveChangesAsync(); - _logger.LogInformation($"{typeof(TEntity).Name} hard deleted: {id} by user {userId}"); + if (GetOrganizationId(entity) != organizationId) + { + throw new UnauthorizedAccessException( + $"Cannot archive {typeof(TEntity).Name} {id} - belongs to different organization."); + } } + entity.IsArchived = true; + entity.ArchivedOn = DateTime.UtcNow; + entity.ArchivedBy = userId; + SetAuditFieldsForUpdate(entity, userId); + + await _context.SaveChangesAsync(); + _logger.LogInformation($"{typeof(TEntity).Name} archived: {id} by user {userId}"); + return true; } catch (Exception ex) { - await HandleExceptionAsync(ex, $"Delete{typeof(TEntity).Name}"); + await HandleExceptionAsync(ex, $"Archive{typeof(TEntity).Name}"); throw; } } + /// + /// Restores an archived entity back to active status. + /// + public virtual async Task RestoreAsync(Guid id) + { + try + { + var userId = await _userContext.GetUserIdAsync(); + if (string.IsNullOrEmpty(userId)) + { + throw new UnauthorizedAccessException("User is not authenticated."); + } + + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + var entity = await _dbSet.FirstOrDefaultAsync(e => e.Id == id && !e.IsDeleted && e.IsArchived); + + if (entity == null) + { + _logger.LogWarning($"{typeof(TEntity).Name} not found for unarchiving: {id}"); + return false; + } + + if (HasOrganizationIdProperty(entity) && organizationId.HasValue) + { + if (GetOrganizationId(entity) != organizationId) + { + throw new UnauthorizedAccessException( + $"Cannot unarchive {typeof(TEntity).Name} {id} - belongs to different organization."); + } + } + + entity.IsArchived = false; + entity.ArchivedOn = null; + entity.ArchivedBy = null; + SetAuditFieldsForUpdate(entity, userId); + + await _context.SaveChangesAsync(); + _logger.LogInformation($"{typeof(TEntity).Name} unarchived: {id} by user {userId}"); + + return true; + } + catch (Exception ex) + { + await HandleExceptionAsync(ex, $"Unarchive{typeof(TEntity).Name}"); + throw; + } + } + + /// + /// Returns a summary of related records that would be permanently deleted with this entity. + /// Override in entity services to provide accurate cascade counts. + /// + public virtual Task GetDeleteCascadeSummaryAsync(Guid id) + { + return Task.FromResult(new CascadeSummary { EntityName = typeof(TEntity).Name }); + } + + /// + /// Returns a summary of related records that would be archived with this entity. + /// Override in entity services to provide accurate cascade counts. + /// + public virtual Task GetArchiveCascadeSummaryAsync(Guid id) + { + return Task.FromResult(new CascadeSummary { EntityName = typeof(TEntity).Name }); + } + #endregion #region Helper Methods diff --git a/2-Nine.Application/Services/DocumentService.cs b/2-Nine.Application/Services/DocumentService.cs index d336e92..d84e257 100644 --- a/2-Nine.Application/Services/DocumentService.cs +++ b/2-Nine.Application/Services/DocumentService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using Nine.Core.Constants; using Nine.Core.Entities; @@ -60,9 +61,10 @@ protected override async Task ValidateEntityAsync(Document entity) && !entity.TenantId.HasValue && !entity.LeaseId.HasValue && !entity.InvoiceId.HasValue - && !entity.PaymentId.HasValue) + && !entity.PaymentId.HasValue + && !entity.RepairId.HasValue) { - errors.Add("Document must be associated with at least one entity (Property, Tenant, Lease, Invoice, or Payment)"); + errors.Add("Document must be associated with at least one entity (Property, Tenant, Lease, Invoice, Payment, or Repair)"); } // Validate file size (e.g., max 10MB) @@ -119,13 +121,14 @@ protected override async Task ValidateEntityAsync(Document entity) /// /// Gets all documents with related entities. /// - public async Task> GetDocumentsWithRelationsAsync() + public async Task> GetDocumentsWithRelationsAsync(bool includeArchived = false) { try { var organizationId = await _userContext.GetActiveOrganizationIdAsync(); return await _context.Documents + .AsNoTracking() .Include(d => d.Property) .Include(d => d.Tenant) .Include(d => d.Lease) @@ -134,7 +137,7 @@ public async Task> GetDocumentsWithRelationsAsync() .ThenInclude(l => l!.Tenant) .Include(d => d.Invoice) .Include(d => d.Payment) - .Where(d => !d.IsDeleted && d.OrganizationId == organizationId) + .Where(d => !d.IsDeleted && (includeArchived || !d.IsArchived) && d.OrganizationId == organizationId) .OrderByDescending(d => d.CreatedOn) .ToListAsync(); } @@ -164,6 +167,7 @@ public async Task> GetDocumentsByPropertyIdAsync(Guid propertyId) .Include(d => d.Lease) .Where(d => d.PropertyId == propertyId && !d.IsDeleted + && !d.IsArchived && d.OrganizationId == organizationId) .OrderByDescending(d => d.CreatedOn) .ToListAsync(); @@ -190,6 +194,7 @@ public async Task> GetDocumentsByTenantIdAsync(Guid tenantId) .Include(d => d.Lease) .Where(d => d.TenantId == tenantId && !d.IsDeleted + && !d.IsArchived && d.OrganizationId == organizationId) .OrderByDescending(d => d.CreatedOn) .ToListAsync(); @@ -217,6 +222,7 @@ public async Task> GetDocumentsByLeaseIdAsync(Guid leaseId) .ThenInclude(l => l!.Tenant) .Where(d => d.LeaseId == leaseId && !d.IsDeleted + && !d.IsArchived && d.OrganizationId == organizationId) .OrderByDescending(d => d.CreatedOn) .ToListAsync(); @@ -241,6 +247,7 @@ public async Task> GetDocumentsByInvoiceIdAsync(Guid invoiceId) .Include(d => d.Invoice) .Where(d => d.InvoiceId == invoiceId && !d.IsDeleted + && !d.IsArchived && d.OrganizationId == organizationId) .OrderByDescending(d => d.CreatedOn) .ToListAsync(); @@ -276,6 +283,31 @@ public async Task> GetDocumentsByPaymentIdAsync(Guid paymentId) } } + /// + /// Gets all documents (e.g., receipts) for a specific repair. + /// + public async Task> GetDocumentsByRepairIdAsync(Guid repairId) + { + try + { + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _context.Documents + .Include(d => d.Repair) + .Where(d => d.RepairId == repairId + && !d.IsDeleted + && !d.IsArchived + && d.OrganizationId == organizationId) + .OrderByDescending(d => d.CreatedOn) + .ToListAsync(); + } + catch (Exception ex) + { + await HandleExceptionAsync(ex, "GetDocumentsByRepairId"); + throw; + } + } + /// /// Gets documents by document type (e.g., "Lease Agreement", "Invoice", "Receipt"). /// @@ -416,6 +448,52 @@ public async Task> GetDocumentCountByTypeAsync() #endregion + #region Cascade Summary / Archive / Restore + + /// + /// Returns a count of related records that would be permanently deleted with this document. + /// + public override Task GetDeleteCascadeSummaryAsync(Guid id) + => Task.FromResult(new CascadeSummary { EntityName = "Document", Counts = new Dictionary() }); + + /// + /// Returns a count of related records that would be archived with this document. + /// + public override Task GetArchiveCascadeSummaryAsync(Guid id) + => Task.FromResult(new CascadeSummary { EntityName = "Document", Counts = new Dictionary() }); + + /// + /// Archives a document using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + int rows = await _context.Documents + .Where(d => d.Id == id && !d.IsDeleted && !d.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(d => d.IsArchived, true) + .SetProperty(d => d.ArchivedOn, now) + .SetProperty(d => d.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Restores an archived document using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.Documents + .Where(d => d.Id == id && d.IsArchived) + .ExecuteUpdateAsync(s => s.SetProperty(d => d.IsArchived, false)); + + return rows > 0; + } + + #endregion + #region PDF Generation Methods /// diff --git a/2-Nine.Application/Services/ExpenseDueService.cs b/2-Nine.Application/Services/ExpenseDueService.cs new file mode 100644 index 0000000..8f00664 --- /dev/null +++ b/2-Nine.Application/Services/ExpenseDueService.cs @@ -0,0 +1,153 @@ +using Nine.Core.Constants; +using Nine.Core.Entities; +using Nine.Core.Interfaces.Services; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; + +namespace Nine.Application.Services; + +/// +/// Service for managing billable instances (ExpenseDue) of a PropertyExpense — +/// the record of what's actually owed and when, as distinct from the recurring +/// rule that produced it. +/// +public class ExpenseDueService : BaseService +{ + public ExpenseDueService( + ApplicationDbContext context, + ILogger logger, + IUserContextService userContext, + IOptions settings) + : base(context, logger, userContext, settings) + { + } + + protected override async Task ValidateEntityAsync(ExpenseDue entity) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + var expenseExists = await _context.PropertyExpenses + .AnyAsync(e => e.Id == entity.PropertyExpenseId && e.OrganizationId == orgId && !e.IsDeleted); + + if (!expenseExists) + { + throw new InvalidOperationException("Property expense not found or does not belong to your organization."); + } + + if (entity.AmountDue < 0) + { + throw new InvalidOperationException("Amount due cannot be negative."); + } + + await base.ValidateEntityAsync(entity); + } + + /// + /// Gets all ExpenseDue instances for a property, most recent first. + /// + /// + /// When false, only the single most recent ExpenseDue per PropertyExpense is + /// returned (the "current cycle" view). When true, full history is returned. + /// + public async Task> GetDueForPropertyAsync(Guid propertyId, bool includeHistory = false) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + var dues = await _dbSet + .Where(d => d.PropertyId == propertyId && !d.IsDeleted && d.OrganizationId == orgId) + .Include(d => d.Payments) + .OrderByDescending(d => d.DueDate) + .ToListAsync(); + + if (includeHistory) + { + return dues; + } + + return dues + .GroupBy(d => d.PropertyExpenseId) + .Select(g => g.OrderByDescending(d => d.DueDate).First()) + .ToList(); + } + + /// + /// Gets the most recent (current cycle) ExpenseDue for a specific + /// PropertyExpense, or null if none have been generated/entered yet. + /// + public async Task GetCurrentCycleForPropertyExpenseAsync(Guid propertyExpenseId) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(d => d.PropertyExpenseId == propertyExpenseId && !d.IsDeleted && d.OrganizationId == orgId) + .Include(d => d.Payments) + .OrderByDescending(d => d.DueDate) + .FirstOrDefaultAsync(); + } + + /// + /// Archives an ExpenseDue along with its ExpensePayment history, mirroring + /// InvoiceService's Invoice -> Payments archive cascade. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + var result = await base.ArchiveAsync(id); + + if (result) + { + await _context.Set() + .Where(p => p.ExpenseDueId == id && !p.IsDeleted && !p.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(p => p.IsArchived, true) + .SetProperty(p => p.ArchivedOn, now) + .SetProperty(p => p.ArchivedBy, userId)); + } + + return result; + } + + /// + /// Restores an archived ExpenseDue. Payments are not automatically restored, + /// matching InvoiceService's Restore behavior. + /// + public override async Task RestoreAsync(Guid id) + { + return await base.RestoreAsync(id); + } + + /// + /// Waives/skips an ExpenseDue — a user decision, not a payment-derived + /// outcome. A reason is required so the audit trail explains why this cycle + /// was not paid. + /// + public async Task WaiveExpenseDueAsync(Guid id, string reason) + { + if (string.IsNullOrWhiteSpace(reason)) + { + throw new InvalidOperationException("A reason is required to waive an expense due."); + } + + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + var userId = await _userContext.GetUserIdAsync(); + + var due = await _dbSet + .FirstOrDefaultAsync(d => d.Id == id && !d.IsDeleted && d.OrganizationId == orgId); + + if (due == null) + { + throw new InvalidOperationException("Expense due not found or does not belong to your organization."); + } + + due.WaivedOn = DateTime.Today; + due.WaivedReason = reason.Trim(); + due.LastModifiedOn = DateTime.UtcNow; + due.LastModifiedBy = userId; + + _context.Update(due); + await _context.SaveChangesAsync(); + } +} diff --git a/2-Nine.Application/Services/ExpenseGenerationService.cs b/2-Nine.Application/Services/ExpenseGenerationService.cs new file mode 100644 index 0000000..ec92507 --- /dev/null +++ b/2-Nine.Application/Services/ExpenseGenerationService.cs @@ -0,0 +1,235 @@ +using Nine.Core.Constants; +using Nine.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + +namespace Nine.Application.Services; + +/// +/// Generates ExpenseDue instances for recurring PropertyExpenses (those whose +/// RecurrencePattern.Frequency is Monthly, Quarterly, or Annual). +/// +/// Automatic generation never reaches further back than January 1 of the +/// current calendar year, regardless of the expense's EffectiveDate/selected +/// due date or how long the application has been closed. This keeps every +/// auto-generated ExpenseDue within the still-open current tax year; any +/// cycle that would fall in a prior year must be entered manually so a user +/// never has historical financial data silently altered after the fact. +/// +/// This same walk-forward algorithm is used for two distinct triggers: +/// - At app startup/periodically (via ScheduledTaskService), to catch up any +/// cycles that elapsed while the application was closed, across all +/// organizations, for all existing recurring expenses. +/// - At the moment a new recurring PropertyExpense is created, to backfill +/// any cycles between its selected due date (or Jan 1, whichever is +/// later) and today, so the user immediately sees due history rather than +/// waiting for the next scheduled run. +/// +/// OneTime expenses are never touched by this service — their single +/// ExpenseDue is created directly at entry time by +/// PropertyExpenseService.CreateExpenseAsync. +/// +public class ExpenseGenerationService +{ + private readonly ApplicationDbContext _context; + private readonly ILogger _logger; + + public ExpenseGenerationService(ApplicationDbContext context, ILogger logger) + { + _context = context; + _logger = logger; + } + + /// + /// Returns January 1 of 's year — the earliest + /// date automatic ExpenseDue generation is ever allowed to reach. + /// + public static DateTime GetEarliestAutoGenerationDate(DateTime asOfDate) => new(asOfDate.Year, 1, 1); + + /// + /// Generates any missing ExpenseDue instances, across all organizations, + /// for every active recurring PropertyExpense, walking forward from + /// January 1 of 's year through + /// . Idempotent — safe to re-run (e.g. on every + /// app startup) without creating duplicates, and naturally catches up any + /// cycles missed while the application was closed, bounded to the current + /// calendar year. + /// + /// The number of ExpenseDue rows generated. + public async Task GenerateMissingDueAsync(DateTime asOfDate) + { + var earliestAllowed = GetEarliestAutoGenerationDate(asOfDate); + + var candidates = await _context.PropertyExpenses + .Where(e => !e.IsDeleted) + .Where(e => !e.EndDate.HasValue || e.EndDate.Value >= earliestAllowed) + .Where(e => e.RecurrencePattern.Frequency != ApplicationConstants.ExpenseFrequencies.OneTime) + .ToListAsync(); + + var generatedCount = 0; + + foreach (var expense in candidates) + { + var expenseRangeStart = expense.EffectiveDate.Date > earliestAllowed.Date + ? expense.EffectiveDate.Date + : earliestAllowed.Date; + var expenseRangeEnd = expense.EndDate.HasValue && expense.EndDate.Value.Date < asOfDate.Date + ? expense.EndDate.Value.Date + : asOfDate.Date; + + generatedCount += await GenerateMissingDueForExpenseAsync(expense, expenseRangeStart, expenseRangeEnd); + } + + if (generatedCount > 0) + { + await _context.SaveChangesAsync(); + _logger.LogInformation( + "Generated {Count} expense due record(s) through {AsOfDate}", + generatedCount, + asOfDate.ToString("yyyy-MM-dd")); + } + + return generatedCount; + } + + /// + /// Backfills any missing ExpenseDue cycles for a single, just-created + /// recurring PropertyExpense, from its selected due date through today — + /// clamped so nothing is generated before January 1 of the current year. + /// Call this once, immediately after creating a recurring PropertyExpense + /// and saving its RecurrencePattern. + /// + /// The newly created expense (already saved, with RecurrencePattern set). + /// The due date the user explicitly selected at entry time. + /// Typically DateTime.Today. + /// + /// The number of ExpenseDue rows generated, and whether the backfill was + /// clamped (i.e. the selected due date was before January 1 of the + /// current year, so some cycles were intentionally skipped and must be + /// entered manually). + /// + public async Task<(int GeneratedCount, bool WasClamped)> BackfillForNewExpenseAsync( + PropertyExpense expense, + DateTime selectedDueDate, + DateTime asOfDate) + { + var earliestAllowed = GetEarliestAutoGenerationDate(asOfDate); + var wasClamped = selectedDueDate < earliestAllowed; + var rangeStart = wasClamped ? earliestAllowed : selectedDueDate; + + var generatedCount = await GenerateMissingDueForExpenseAsync(expense, rangeStart, asOfDate); + + if (generatedCount > 0) + { + await _context.SaveChangesAsync(); + } + + return (generatedCount, wasClamped); + } + + /// + /// Adds (but does not save) any ExpenseDue rows missing for the given + /// expense between rangeStart and rangeEnd, inclusive. Idempotent — skips + /// any cycle date that already has an ExpenseDue. + /// + private async Task GenerateMissingDueForExpenseAsync(PropertyExpense expense, DateTime rangeStart, DateTime rangeEnd) + { + var cycleDates = ComputeCycleDatesInRange(expense.RecurrencePattern, rangeStart, rangeEnd); + if (cycleDates.Count == 0) + { + return 0; + } + + var existingDates = await _context.Set() + .Where(d => d.PropertyExpenseId == expense.Id) + .Select(d => d.DueDate.Date) + .ToListAsync(); + var existingDateSet = existingDates.ToHashSet(); + + var generatedCount = 0; + + foreach (var dueDate in cycleDates) + { + if (existingDateSet.Contains(dueDate.Date)) + { + continue; + } + + _context.Set().Add(new ExpenseDue + { + Id = Guid.NewGuid(), + OrganizationId = expense.OrganizationId, + PropertyExpenseId = expense.Id, + PropertyId = expense.PropertyId, + DueDate = dueDate, + AmountDue = expense.Amount, + CreatedBy = ApplicationConstants.SystemUser.Id, + CreatedOn = DateTime.UtcNow + }); + + generatedCount++; + } + + return generatedCount; + } + + /// + /// Computes every cycle due date for the given pattern that falls within + /// [rangeStart, rangeEnd], inclusive, by walking month-by-month and + /// testing each month against the pattern's cadence. + /// + private static List ComputeCycleDatesInRange(RecurrencePattern pattern, DateTime rangeStart, DateTime rangeEnd) + { + var dates = new List(); + if (rangeStart.Date > rangeEnd.Date) + { + return dates; + } + + var dayOfMonth = pattern.DueDayOfMonth ?? 1; + var anchorMonth = pattern.AnchorMonth ?? 1; + + var cursor = new DateTime(rangeStart.Year, rangeStart.Month, 1); + var endCursor = new DateTime(rangeEnd.Year, rangeEnd.Month, 1); + + while (cursor <= endCursor) + { + if (IsCadenceMonth(pattern.Frequency, cursor.Month, anchorMonth)) + { + var dueDate = BuildDueDate(cursor.Year, cursor.Month, dayOfMonth); + if (dueDate.Date >= rangeStart.Date && dueDate.Date <= rangeEnd.Date) + { + dates.Add(dueDate); + } + } + + cursor = cursor.AddMonths(1); + } + + return dates; + } + + /// + /// True if the given month matches the pattern's recurrence cadence: + /// every month for Monthly, every third month anchored to anchorMonth for + /// Quarterly (e.g. anchor month 2 -> Feb/May/Aug/Nov), or only + /// anchorMonth itself for Annual. + /// + private static bool IsCadenceMonth(string frequency, int month, int anchorMonth) => frequency switch + { + ApplicationConstants.ExpenseFrequencies.Monthly => true, + ApplicationConstants.ExpenseFrequencies.Quarterly => ((month - anchorMonth) % 3 + 3) % 3 == 0, + ApplicationConstants.ExpenseFrequencies.Annual => month == anchorMonth, + _ => false + }; + + /// + /// Builds a due date for the given year/month, clamping the day to the + /// last valid day of that month (e.g. day 31 in April becomes April 30). + /// + private static DateTime BuildDueDate(int year, int month, int day) + { + var lastValidDay = DateTime.DaysInMonth(year, month); + return new DateTime(year, month, Math.Min(day, lastValidDay)); + } +} diff --git a/2-Nine.Application/Services/ExpensePaymentService.cs b/2-Nine.Application/Services/ExpensePaymentService.cs new file mode 100644 index 0000000..a9acf2d --- /dev/null +++ b/2-Nine.Application/Services/ExpensePaymentService.cs @@ -0,0 +1,81 @@ +using Nine.Core.Constants; +using Nine.Core.Entities; +using Nine.Core.Interfaces.Services; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; + +namespace Nine.Application.Services; + +/// +/// Service for recording actual payments against an ExpenseDue. Multiple +/// payments per ExpenseDue are expected and supported (e.g. a mortgage split +/// into two payments, or a duplicate/extra payment) — "Mark Paid" always +/// inserts a new row and never edits or overwrites a prior payment. +/// +public class ExpensePaymentService : BaseService +{ + public ExpensePaymentService( + ApplicationDbContext context, + ILogger logger, + IUserContextService userContext, + IOptions settings) + : base(context, logger, userContext, settings) + { + } + + protected override async Task ValidateEntityAsync(ExpensePayment entity) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + var dueExists = await _context.Set() + .AnyAsync(d => d.Id == entity.ExpenseDueId && d.OrganizationId == orgId && !d.IsDeleted); + + if (!dueExists) + { + throw new InvalidOperationException("Expense due not found or does not belong to your organization."); + } + + if (entity.AmountPaid <= 0) + { + throw new InvalidOperationException("Amount paid must be greater than zero."); + } + + await base.ValidateEntityAsync(entity); + } + + /// + /// Records a payment against an ExpenseDue. This is the "Mark Paid" action — + /// always available regardless of the due's current status, and always + /// inserts a new ExpensePayment row rather than modifying an existing one. + /// + public async Task RecordPaymentAsync( + Guid expenseDueId, + decimal amountPaid, + DateTime paidOn, + string? notes = null) + { + var payment = new ExpensePayment + { + ExpenseDueId = expenseDueId, + AmountPaid = amountPaid, + PaidOn = paidOn, + Notes = notes + }; + + return await CreateAsync(payment); + } + + /// + /// Gets all payments recorded against a specific ExpenseDue, oldest first. + /// + public async Task> GetPaymentsForExpenseDueAsync(Guid expenseDueId) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(p => p.ExpenseDueId == expenseDueId && !p.IsDeleted && p.OrganizationId == orgId) + .OrderBy(p => p.PaidOn) + .ToListAsync(); + } +} diff --git a/2-Nine.Application/Services/FinancialReportService.cs b/2-Nine.Application/Services/FinancialReportService.cs index 9d6e38c..231a2fd 100644 --- a/2-Nine.Application/Services/FinancialReportService.cs +++ b/2-Nine.Application/Services/FinancialReportService.cs @@ -1,3 +1,4 @@ +using Nine.Core.Constants; using Nine.Core.Entities; using Microsoft.EntityFrameworkCore; @@ -12,6 +13,35 @@ public FinancialReportService(IDbContextFactory contextFac _contextFactory = contextFactory; } + /// + /// Raw sums of actual ExpensePayment amounts by PropertyExpense.ExpenseType for + /// the given period. This app only captures and sums what was recorded — it + /// does not compute tax-deductible portions (e.g. mortgage interest vs. + /// principal); export these sums to a proper financial/tax tool for that. + /// + private static async Task> GetActualFixedExpensesByCategoryAsync( + ApplicationDbContext context, Guid organizationId, Guid? propertyId, DateTime startDate, DateTime endDate) + { + var query = context.Set() + .Include(p => p.ExpenseDue) + .ThenInclude(d => d!.PropertyExpense) + .Where(p => !p.IsDeleted && + p.OrganizationId == organizationId && + p.PaidOn >= startDate && + p.PaidOn <= endDate); + + if (propertyId.HasValue) + { + query = query.Where(p => p.ExpenseDue!.PropertyId == propertyId.Value); + } + + var payments = await query.ToListAsync(); + + return payments + .GroupBy(p => p.ExpenseDue!.PropertyExpense!.ExpenseType) + .ToDictionary(g => g.Key, g => g.Sum(p => p.AmountPaid)); + } + /// /// Generate income statement for a specific period and optional property /// @@ -80,15 +110,19 @@ public async Task GenerateIncomeStatementAsync( var maintenanceRequests = await maintenanceQuery.ToListAsync(); - // All maintenance costs go to MaintenanceExpenses - statement.MaintenanceExpenses = maintenanceRequests.Sum(m => m.ActualCost); - - // Other expense categories are currently zero (no data tracked for these yet) - statement.UtilityExpenses = 0; - statement.InsuranceExpenses = 0; - statement.TaxExpenses = 0; - statement.ManagementFees = 0; - statement.OtherExpenses = 0; + var fixedExpenses = await GetActualFixedExpensesByCategoryAsync(context, organizationId, propertyId, startDate, endDate); + decimal GetCategory(string type) => fixedExpenses.TryGetValue(type, out var amt) ? amt : 0m; + + // Maintenance & Repairs combines ad hoc MaintenanceRequests with recurring + // PropertyExpense "Maintenance" entries (e.g. a lawn/pest contract) — both + // are genuine upkeep costs, not a double count of the same expense. + statement.MaintenanceExpenses = maintenanceRequests.Sum(m => m.ActualCost) + GetCategory(ApplicationConstants.PropertyExpenseTypes.Maintenance); + statement.UtilityExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.Utilities); + statement.InsuranceExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.Insurance); + statement.TaxExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.PropertyTax); + statement.ManagementFees = 0; // No PropertyExpense category maps to this yet + statement.MortgageExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.Mortgage); + statement.OtherExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.HOA) + GetCategory(ApplicationConstants.PropertyExpenseTypes.Other); return statement; } @@ -159,8 +193,8 @@ public async Task> GeneratePropertyPerformanceAsync( p.PaidOn <= endDate) .SumAsync(p => p.Amount); - // Calculate expenses from maintenance requests only - var expenses = await context.MaintenanceRequests + // Calculate expenses from maintenance requests plus actual fixed expenses + var maintenanceCost = await context.MaintenanceRequests .Where(m => m.PropertyId == property.Id && m.CompletedOn.HasValue && m.CompletedOn.Value >= startDate && @@ -169,6 +203,9 @@ public async Task> GeneratePropertyPerformanceAsync( m.ActualCost > 0) .SumAsync(m => m.ActualCost); + var fixedExpenses = await GetActualFixedExpensesByCategoryAsync(context, organizationId, property.Id, startDate, endDate); + var expenses = maintenanceCost + fixedExpenses.Values.Sum(); + // Calculate occupancy days var leases = await context.Leases .Where(l => l.PropertyId == property.Id && @@ -254,6 +291,18 @@ public async Task> GenerateTaxReportAsync(Guid organizationI var totalMaintenanceCost = maintenanceExpenses.Sum(m => m.ActualCost); + var fixedExpenses = await GetActualFixedExpensesByCategoryAsync(context, organizationId, property.Id, startDate, endDate); + decimal GetCategory(string type) => fixedExpenses.TryGetValue(type, out var amt) ? amt : 0m; + + var insurance = GetCategory(ApplicationConstants.PropertyExpenseTypes.Insurance); + var taxes = GetCategory(ApplicationConstants.PropertyExpenseTypes.PropertyTax); + var utilities = GetCategory(ApplicationConstants.PropertyExpenseTypes.Utilities); + // Raw captured Mortgage amount (principal + interest) — use Form 1098, Box 1 + // for the actual tax-deductible interest portion; this app does not compute amortization. + var mortgage = GetCategory(ApplicationConstants.PropertyExpenseTypes.Mortgage); + var repairs = totalMaintenanceCost + GetCategory(ApplicationConstants.PropertyExpenseTypes.Maintenance); + var other = GetCategory(ApplicationConstants.PropertyExpenseTypes.HOA) + GetCategory(ApplicationConstants.PropertyExpenseTypes.Other); + var taxReport = new TaxReportData { Year = year, @@ -261,22 +310,25 @@ public async Task> GenerateTaxReportAsync(Guid organizationI PropertyName = property.Address, TotalRentIncome = rentIncome, DepreciationAmount = depreciationAmount, - - // Currently only maintenance/repairs are tracked + + // Advertising, Cleaning, Legal, Management, and Supplies have no dedicated + // PropertyExpenseType by design — Cleaning rolls into Repairs (Maintenance type) + // and the rest roll into Other if entered; Auto/travel is a business-level + // expense, out of scope for per-property tracking, so it stays $0. Advertising = 0, Cleaning = 0, - Insurance = 0, + Insurance = insurance, Legal = 0, Management = 0, - MortgageInterest = 0, - Repairs = totalMaintenanceCost, // All maintenance costs + MortgageExpense = mortgage, + Repairs = repairs, Supplies = 0, - Taxes = 0, - Utilities = 0, - Other = 0 + Taxes = taxes, + Utilities = utilities, + Other = other }; - taxReport.TotalExpenses = totalMaintenanceCost; + taxReport.TotalExpenses = insurance + taxes + utilities + mortgage + repairs + other; taxReports.Add(taxReport); } diff --git a/2-Nine.Application/Services/InspectionService.cs b/2-Nine.Application/Services/InspectionService.cs index c4943d8..9fc2b8f 100644 --- a/2-Nine.Application/Services/InspectionService.cs +++ b/2-Nine.Application/Services/InspectionService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using Nine.Core.Constants; using Nine.Core.Entities; @@ -216,11 +217,10 @@ public override async Task UpdateAsync(Inspection inspection) } /// - /// Deletes an inspection (soft delete). + /// Deletes an inspection and its associated calendar event. /// public override async Task DeleteAsync(Guid id) { - var userId = await GetUserIdAsync(); var organizationId = await GetActiveOrganizationIdAsync(); var inspection = await _context.Inspections @@ -231,18 +231,28 @@ public override async Task DeleteAsync(Guid id) throw new KeyNotFoundException($"Inspection {id} not found."); } - inspection.IsDeleted = true; - inspection.LastModifiedBy = userId; - inspection.LastModifiedOn = DateTime.UtcNow; - - await _context.SaveChangesAsync(); - - // TODO: Delete associated calendar event when interface method is available - // await _calendarEventService.DeleteEventBySourceAsync(id, nameof(Inspection)); + await using var transaction = await _context.Database.BeginTransactionAsync(); + try + { + // Delete associated calendar event before deleting the inspection + if (inspection.CalendarEventId.HasValue) + { + var calendarEvent = await _context.CalendarEvents.FindAsync(inspection.CalendarEventId.Value); + if (calendarEvent != null) _context.CalendarEvents.Remove(calendarEvent); + await _context.SaveChangesAsync(); + } - _logger.LogInformation("Deleted inspection {InspectionId}", id); + _logger.LogInformation("Deleted inspection {InspectionId}", id); - return true; + bool result = await base.DeleteAsync(id); + await transaction.CommitAsync(); + return result; + } + catch + { + await transaction.RollbackAsync(); + throw; + } } /// @@ -282,5 +292,51 @@ private async Task HandleRoutineInspectionCompletionAsync(Inspection inspection) await _context.SaveChangesAsync(); } } + + #region Cascade Summary / Archive / Restore + + /// + /// Returns a count of related records that would be permanently deleted with this inspection. + /// + public override Task GetDeleteCascadeSummaryAsync(Guid id) + => Task.FromResult(new CascadeSummary { EntityName = "Inspection", Counts = new Dictionary() }); + + /// + /// Returns a count of related records that would be archived with this inspection. + /// + public override Task GetArchiveCascadeSummaryAsync(Guid id) + => Task.FromResult(new CascadeSummary { EntityName = "Inspection", Counts = new Dictionary() }); + + /// + /// Archives an inspection using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + int rows = await _context.Inspections + .Where(i => i.Id == id && !i.IsDeleted && !i.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(i => i.IsArchived, true) + .SetProperty(i => i.ArchivedOn, now) + .SetProperty(i => i.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Restores an archived inspection using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.Inspections + .Where(i => i.Id == id && i.IsArchived) + .ExecuteUpdateAsync(s => s.SetProperty(i => i.IsArchived, false)); + + return rows > 0; + } + + #endregion } } diff --git a/2-Nine.Application/Services/InvoiceService.cs b/2-Nine.Application/Services/InvoiceService.cs index c320f7d..8970bfc 100644 --- a/2-Nine.Application/Services/InvoiceService.cs +++ b/2-Nine.Application/Services/InvoiceService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using Nine.Core.Constants; using Nine.Core.Entities; @@ -481,5 +482,100 @@ public async Task> GetInvoicesByDateRangeAsync(DateTime startDate, throw; } } + + #region Delete Override + + /// + /// Deletes an invoice and its associated payments (cascade delete). + /// + public override async Task DeleteAsync(Guid id) + { + await using var transaction = await _context.Database.BeginTransactionAsync(); + try + { + var payments = await _context.Payments.Where(p => p.InvoiceId == id).ToListAsync(); + _context.Payments.RemoveRange(payments); + await _context.SaveChangesAsync(); + bool result = await base.DeleteAsync(id); + await transaction.CommitAsync(); + return result; + } + catch + { + await transaction.RollbackAsync(); + throw; + } + } + + #endregion + + #region Cascade Summary + + /// + /// Returns a count of related records that would be permanently deleted with this invoice. + /// + public override async Task GetDeleteCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Payments"] = await _context.Payments.CountAsync(x => x.InvoiceId == id && !x.IsDeleted), + }; + return new CascadeSummary { EntityName = "Invoice", Counts = counts }; + } + + /// + /// Returns a count of related records that would be archived with this invoice. + /// + public override async Task GetArchiveCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Payments"] = await _context.Payments.CountAsync(x => x.InvoiceId == id && !x.IsDeleted && !x.IsArchived), + }; + return new CascadeSummary { EntityName = "Invoice", Counts = counts }; + } + + #endregion + + #region Archive / Restore + + /// + /// Archives an invoice and cascades to its payments. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + await _context.Payments + .Where(p => p.InvoiceId == id && !p.IsDeleted && !p.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(p => p.IsArchived, true) + .SetProperty(p => p.ArchivedOn, now) + .SetProperty(p => p.ArchivedBy, userId)); + + int rows = await _context.Invoices + .Where(i => i.Id == id && !i.IsDeleted && !i.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(i => i.IsArchived, true) + .SetProperty(i => i.ArchivedOn, now) + .SetProperty(i => i.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Restores an archived invoice. Payments are not automatically restored. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.Invoices + .Where(i => i.Id == id && i.IsArchived) + .ExecuteUpdateAsync(s => s.SetProperty(i => i.IsArchived, false)); + + return rows > 0; + } + + #endregion } } diff --git a/2-Nine.Application/Services/LeaseService.cs b/2-Nine.Application/Services/LeaseService.cs index b6878c2..45dd85f 100644 --- a/2-Nine.Application/Services/LeaseService.cs +++ b/2-Nine.Application/Services/LeaseService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using Nine.Core.Constants; using Nine.Core.Entities; @@ -73,8 +74,7 @@ protected override async Task ValidateEntityAsync(Lease entity) && l.Id != entity.Id && !l.IsDeleted && l.Property.OrganizationId == organizationId - && (l.Status == ApplicationConstants.LeaseStatuses.Active - || l.Status == ApplicationConstants.LeaseStatuses.Pending)) + && l.IsActive) .Where(l => // New lease starts during existing lease (entity.StartDate >= l.StartDate && entity.StartDate <= l.EndDate) || @@ -102,16 +102,19 @@ protected override async Task ValidateEntityAsync(Lease entity) /// public override async Task CreateAsync(Lease entity) { + // Keep IsActive in sync with the lease's initial status so queries like + // GetActiveLeasesAsync() correctly exclude leases created as Pending, etc. + entity.IsActive = ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(entity.Status); + var lease = await base.CreateAsync(entity); // If lease is active, mark property as unavailable - if (entity.Status == ApplicationConstants.LeaseStatuses.Active) + if (entity.IsActive) { var property = await _context.Properties.FindAsync(entity.PropertyId); if (property != null) { property.Status = ApplicationConstants.PropertyStatuses.Occupied; - property.IsActive = false; property.LastModifiedOn = DateTime.UtcNow; property.LastModifiedBy = await _userContext.GetUserIdAsync(); _context.Properties.Update(property); @@ -133,20 +136,39 @@ public override async Task UpdateAsync(Lease entity) var lease = await base.UpdateAsync(entity); - // Handle property status when lease becomes active - if (existingLease != null && - existingLease.Status != ApplicationConstants.LeaseStatuses.Active && - entity.Status == ApplicationConstants.LeaseStatuses.Active) + // Handle property status when lease IsActive changes + if (existingLease != null) { var property = await _context.Properties.FindAsync(entity.PropertyId); if (property != null) { - property.Status = ApplicationConstants.PropertyStatuses.Occupied; - property.IsActive = false; - property.LastModifiedOn = DateTime.UtcNow; - property.LastModifiedBy = await _userContext.GetUserIdAsync(); - _context.Properties.Update(property); - await _context.SaveChangesAsync(); + if (!existingLease.IsActive && entity.IsActive) + { + // Lease became active - mark property Occupied + property.Status = ApplicationConstants.PropertyStatuses.Occupied; + property.LastModifiedOn = DateTime.UtcNow; + property.LastModifiedBy = await _userContext.GetUserIdAsync(); + _context.Properties.Update(property); + await _context.SaveChangesAsync(); + } + else if (existingLease.IsActive && !entity.IsActive) + { + // Lease became inactive - mark property Available if no other active leases + var hasOtherActiveLeases = await _context.Leases + .AnyAsync(l => l.PropertyId == entity.PropertyId + && l.Id != entity.Id + && !l.IsDeleted + && l.IsActive); + + if (!hasOtherActiveLeases) + { + property.Status = ApplicationConstants.PropertyStatuses.Available; + property.LastModifiedOn = DateTime.UtcNow; + property.LastModifiedBy = await _userContext.GetUserIdAsync(); + _context.Properties.Update(property); + await _context.SaveChangesAsync(); + } + } } } @@ -154,32 +176,58 @@ public override async Task UpdateAsync(Lease entity) } /// - /// Deletes (soft deletes) a lease and updates property availability if needed. + /// Deletes a lease and all related child records (invoices with payments, security deposits, + /// documents), then updates property availability if the lease was active. /// public override async Task DeleteAsync(Guid id) { var lease = await GetByIdAsync(id); if (lease == null) return false; + await using var transaction = await _context.Database.BeginTransactionAsync(); + try + { + // Cascade delete: payments → invoices → security deposits → documents + var invoiceIds = await _context.Invoices + .Where(i => i.LeaseId == id) + .Select(i => i.Id) + .ToListAsync(); + + foreach (var invoiceId in invoiceIds) + { + var payments = await _context.Payments.Where(p => p.InvoiceId == invoiceId).ToListAsync(); + _context.Payments.RemoveRange(payments); + } + + var invoices = await _context.Invoices.Where(i => i.LeaseId == id).ToListAsync(); + _context.Invoices.RemoveRange(invoices); + + var securityDeposits = await _context.SecurityDeposits.Where(s => s.LeaseId == id).ToListAsync(); + _context.SecurityDeposits.RemoveRange(securityDeposits); + + var documents = await _context.Documents.Where(d => d.LeaseId == id).ToListAsync(); + _context.Documents.RemoveRange(documents); + + await _context.SaveChangesAsync(); + var result = await base.DeleteAsync(id); // If lease was active, check if property should be marked available - if (result && lease.Status == ApplicationConstants.LeaseStatuses.Active) + if (result && lease.IsActive) { var property = await _context.Properties.FindAsync(lease.PropertyId); if (property != null) { - // Check if there are any other active/pending leases for this property + // Check if there are any other active leases for this property var hasOtherActiveLeases = await _context.Leases .AnyAsync(l => l.PropertyId == lease.PropertyId && l.Id != lease.Id && !l.IsDeleted - && (l.Status == ApplicationConstants.LeaseStatuses.Active - || l.Status == ApplicationConstants.LeaseStatuses.Pending)); + && l.IsActive); if (!hasOtherActiveLeases) { - property.IsActive = true; + property.Status = ApplicationConstants.PropertyStatuses.Available; property.LastModifiedOn = DateTime.UtcNow; property.LastModifiedBy = await _userContext.GetUserIdAsync(); _context.Properties.Update(property); @@ -188,7 +236,14 @@ public override async Task DeleteAsync(Guid id) } } + await transaction.CommitAsync(); return result; + } + catch + { + await transaction.RollbackAsync(); + throw; + } } #endregion @@ -207,7 +262,6 @@ public override async Task DeleteAsync(Guid id) var lease = await _context.Leases .Include(l => l.Property) .Include(l => l.Tenant) - .Include(l => l.Document) .Include(l => l.Documents) .Include(l => l.Invoices) .ThenInclude(i => i.Payments) @@ -237,7 +291,7 @@ public async Task> GetLeasesWithRelationsAsync() return await _context.Leases .Include(l => l.Property) .Include(l => l.Tenant) - .Where(l => !l.IsDeleted && l.Property.OrganizationId == organizationId) + .Where(l => !l.IsDeleted && !l.IsArchived && l.Property.OrganizationId == organizationId) .OrderByDescending(l => l.StartDate) .ToListAsync(); } @@ -248,6 +302,29 @@ public async Task> GetLeasesWithRelationsAsync() } } + /// + /// Gets all archived leases with Property and Tenant relations. + /// + public async Task> GetArchivedLeasesWithRelationsAsync() + { + try + { + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _context.Leases + .Include(l => l.Property) + .Include(l => l.Tenant) + .Where(l => !l.IsDeleted && l.IsArchived && l.Property.OrganizationId == organizationId) + .OrderByDescending(l => l.StartDate) + .ToListAsync(); + } + catch (Exception ex) + { + await HandleExceptionAsync(ex, "GetArchivedLeasesWithRelations"); + throw; + } + } + #endregion #region Business Logic Methods @@ -317,9 +394,7 @@ public async Task> GetActiveLeasesAsync() .Include(l => l.Tenant) .Where(l => !l.IsDeleted && l.Property.OrganizationId == organizationId - && l.Status == ApplicationConstants.LeaseStatuses.Active - && l.StartDate <= today - && l.EndDate >= today) + && l.IsActive) .OrderBy(l => l.Property.Address) .ToListAsync(); } @@ -346,7 +421,7 @@ public async Task> GetLeasesExpiringSoonAsync(int daysThreshold = 90 .Include(l => l.Tenant) .Where(l => !l.IsDeleted && l.Property.OrganizationId == organizationId - && l.Status == ApplicationConstants.LeaseStatuses.Active + && l.IsActive && l.EndDate >= today && l.EndDate <= expirationDate) .OrderBy(l => l.EndDate) @@ -399,8 +474,7 @@ public async Task> GetCurrentAndUpcomingLeasesByPropertyIdAsync(Guid .Where(l => l.PropertyId == propertyId && !l.IsDeleted && l.Property.OrganizationId == organizationId - && (l.Status == ApplicationConstants.LeaseStatuses.Active - || l.Status == ApplicationConstants.LeaseStatuses.Pending)) + && l.IsActive) .OrderBy(l => l.StartDate) .ToListAsync(); } @@ -419,7 +493,6 @@ public async Task> GetActiveLeasesByPropertyIdAsync(Guid propertyId) try { var organizationId = await _userContext.GetActiveOrganizationIdAsync(); - var today = DateTime.Today; return await _context.Leases .Include(l => l.Property) @@ -427,9 +500,7 @@ public async Task> GetActiveLeasesByPropertyIdAsync(Guid propertyId) .Where(l => l.PropertyId == propertyId && !l.IsDeleted && l.Property.OrganizationId == organizationId - && l.Status == ApplicationConstants.LeaseStatuses.Active - && l.StartDate <= today - && l.EndDate >= today) + && l.IsActive) .ToListAsync(); } catch (Exception ex) @@ -479,38 +550,9 @@ public async Task UpdateLeaseStatusAsync(Guid leaseId, string newStatus) } lease.Status = newStatus; + lease.IsActive = ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(newStatus); - // Update property availability based on status - var property = await _context.Properties.FindAsync(lease.PropertyId); - if (property != null) - { - if (newStatus == ApplicationConstants.LeaseStatuses.Active) - { - property.IsActive = false; - } - else if (newStatus == ApplicationConstants.LeaseStatuses.Terminated - || newStatus == ApplicationConstants.LeaseStatuses.Expired) - { - // Only mark available if no other active leases exist - var hasOtherActiveLeases = await _context.Leases - .AnyAsync(l => l.PropertyId == lease.PropertyId - && l.Id != lease.Id - && !l.IsDeleted - && (l.Status == ApplicationConstants.LeaseStatuses.Active - || l.Status == ApplicationConstants.LeaseStatuses.Pending)); - - if (!hasOtherActiveLeases) - { - property.IsActive = true; - property.Status = ApplicationConstants.PropertyStatuses.Available; - } - } - - property.LastModifiedOn = DateTime.UtcNow; - property.LastModifiedBy = await _userContext.GetUserIdAsync(); - _context.Properties.Update(property); - } - + // Property status management delegated to UpdateAsync return await UpdateAsync(lease); } catch (Exception ex) @@ -521,5 +563,88 @@ public async Task UpdateLeaseStatusAsync(Guid leaseId, string newStatus) } #endregion + + #region Cascade Summary + + /// + /// Returns a count of related records that would be permanently deleted with this lease. + /// + public override async Task GetDeleteCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Invoices"] = await _context.Invoices.CountAsync(x => x.LeaseId == id && !x.IsDeleted), + ["Security Deposits"] = await _context.SecurityDeposits.CountAsync(x => x.LeaseId == id && !x.IsDeleted), + ["Documents"] = await _context.Documents.CountAsync(x => x.LeaseId == id && !x.IsDeleted), + }; + return new CascadeSummary { EntityName = "Lease", Counts = counts }; + } + + /// + /// Returns a count of related records that would be archived with this lease. + /// + public override async Task GetArchiveCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Invoices"] = await _context.Invoices.CountAsync(x => x.LeaseId == id && !x.IsDeleted && !x.IsArchived), + ["Documents"] = await _context.Documents.CountAsync(x => x.LeaseId == id && !x.IsDeleted && !x.IsArchived), + }; + return new CascadeSummary { EntityName = "Lease", Counts = counts }; + } + + #endregion + + #region Archive/Restore Override + + /// + /// Archives a lease using a direct SQL update to avoid EF change tracking issues, + /// and cascade-archives all related invoices and documents. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + int rows = await _context.Leases + .Where(l => l.Id == id && !l.IsDeleted && !l.IsArchived) + .ExecuteUpdateAsync(setters => setters + .SetProperty(l => l.IsArchived, true) + .SetProperty(l => l.ArchivedOn, now) + .SetProperty(l => l.ArchivedBy, userId)); + + if (rows > 0) + { + await _context.Invoices + .Where(x => x.LeaseId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Documents + .Where(x => x.LeaseId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + } + + return rows > 0; + } + + /// + /// Restores an archived lease using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.Leases + .Where(l => l.Id == id && l.IsArchived) + .ExecuteUpdateAsync(setters => setters.SetProperty(l => l.IsArchived, false)); + + return rows > 0; + } + + #endregion } } diff --git a/2-Nine.Application/Services/MaintenanceService.cs b/2-Nine.Application/Services/MaintenanceService.cs index 8a63ca8..f538006 100644 --- a/2-Nine.Application/Services/MaintenanceService.cs +++ b/2-Nine.Application/Services/MaintenanceService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using Nine.Application.Services.Workflows; using Nine.Core.Constants; @@ -189,21 +190,36 @@ public override async Task UpdateAsync(MaintenanceRequest en } /// - /// Deletes a maintenance request and removes the associated calendar event. + /// Deletes a maintenance request, nulling out repair associations and removing the calendar event. /// public override async Task DeleteAsync(Guid id) { var maintenanceRequest = await GetByIdAsync(id); - - var result = await base.DeleteAsync(id); - if (result && maintenanceRequest != null) + await using var transaction = await _context.Database.BeginTransactionAsync(); + try { - // Delete associated calendar event - await _calendarEventService.DeleteEventAsync(maintenanceRequest.CalendarEventId); - } + // Delete repairs associated with this maintenance request + var repairs = await _context.Repairs.Where(r => r.MaintenanceRequestId == id).ToListAsync(); + _context.Repairs.RemoveRange(repairs); + await _context.SaveChangesAsync(); + + bool result = await base.DeleteAsync(id); - return result; + if (result && maintenanceRequest != null) + { + // Delete associated calendar event + await _calendarEventService.DeleteEventAsync(maintenanceRequest.CalendarEventId); + } + + await transaction.CommitAsync(); + return result; + } + catch + { + await transaction.RollbackAsync(); + throw; + } } /// @@ -488,5 +504,74 @@ public async Task> GetMaintenanceCostsByPropertyAsync( .Select(g => new { PropertyId = g.Key, TotalCost = g.Sum(m => m.ActualCost) }) .ToDictionaryAsync(x => x.PropertyId, x => x.TotalCost); } + + #region Cascade Summary + + /// + /// Returns a count of related records that would be permanently deleted with this maintenance request. + /// + public override async Task GetDeleteCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Repairs"] = await _context.Repairs.CountAsync(x => x.MaintenanceRequestId == id && !x.IsDeleted), + }; + return new CascadeSummary { EntityName = "Maintenance Request", Counts = counts }; + } + + /// + /// Returns a count of related records that would be archived with this maintenance request. + /// + public override async Task GetArchiveCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Repairs"] = await _context.Repairs.CountAsync(x => x.MaintenanceRequestId == id && !x.IsDeleted && !x.IsArchived), + }; + return new CascadeSummary { EntityName = "Maintenance Request", Counts = counts }; + } + + #endregion + + #region Archive / Restore + + /// + /// Archives a maintenance request and cascades to its repairs. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + await _context.Repairs + .Where(r => r.MaintenanceRequestId == id && !r.IsDeleted && !r.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(r => r.IsArchived, true) + .SetProperty(r => r.ArchivedOn, now) + .SetProperty(r => r.ArchivedBy, userId)); + + int rows = await _context.MaintenanceRequests + .Where(m => m.Id == id && !m.IsDeleted && !m.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(m => m.IsArchived, true) + .SetProperty(m => m.ArchivedOn, now) + .SetProperty(m => m.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Restores an archived maintenance request. Repairs are not automatically restored. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.MaintenanceRequests + .Where(m => m.Id == id && m.IsArchived) + .ExecuteUpdateAsync(s => s.SetProperty(m => m.IsArchived, false)); + + return rows > 0; + } + + #endregion } } diff --git a/2-Nine.Application/Services/NineFinancialReportService.cs b/2-Nine.Application/Services/NineFinancialReportService.cs index ed798f0..e9cd932 100644 --- a/2-Nine.Application/Services/NineFinancialReportService.cs +++ b/2-Nine.Application/Services/NineFinancialReportService.cs @@ -19,6 +19,35 @@ public NineFinancialReportService(IDbContextFactory contex _contextFactory = contextFactory; } + /// + /// Raw sums of actual ExpensePayment amounts by PropertyExpense.ExpenseType for + /// the given period. This app only captures and sums what was recorded — it + /// does not compute tax-deductible portions (e.g. mortgage interest vs. + /// principal); export these sums to a proper financial/tax tool for that. + /// + private static async Task> GetActualFixedExpensesByCategoryAsync( + ApplicationDbContext context, Guid organizationId, Guid? propertyId, DateTime startDate, DateTime endDate) + { + var query = context.Set() + .Include(p => p.ExpenseDue) + .ThenInclude(d => d!.PropertyExpense) + .Where(p => !p.IsDeleted && + p.OrganizationId == organizationId && + p.PaidOn >= startDate && + p.PaidOn <= endDate); + + if (propertyId.HasValue) + { + query = query.Where(p => p.ExpenseDue!.PropertyId == propertyId.Value); + } + + var payments = await query.ToListAsync(); + + return payments + .GroupBy(p => p.ExpenseDue!.PropertyExpense!.ExpenseType) + .ToDictionary(g => g.Key, g => g.Sum(p => p.AmountPaid)); + } + /// /// Generate income statement for a specific period and optional property. /// Uses Repairs for expense tracking (Nine approach). @@ -80,15 +109,19 @@ public async Task GenerateIncomeStatementAsync( var repairs = await repairsQuery.ToListAsync(); - // All repair costs go to MaintenanceExpenses - statement.MaintenanceExpenses = repairs.Sum(r => r.Cost); + var fixedExpenses = await GetActualFixedExpensesByCategoryAsync(context, organizationId, propertyId, startDate, endDate); + decimal GetCategory(string type) => fixedExpenses.TryGetValue(type, out var amt) ? amt : 0m; - // Other expense categories are currently zero (no data tracked for these yet) - statement.UtilityExpenses = 0; - statement.InsuranceExpenses = 0; - statement.TaxExpenses = 0; - statement.ManagementFees = 0; - statement.OtherExpenses = 0; + // Maintenance & Repairs combines ad hoc Repairs with recurring PropertyExpense + // "Maintenance" entries (e.g. a lawn/pest contract) — both are genuine upkeep + // costs, not a double count of the same expense. + statement.MaintenanceExpenses = repairs.Sum(r => r.Cost) + GetCategory(ApplicationConstants.PropertyExpenseTypes.Maintenance); + statement.UtilityExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.Utilities); + statement.InsuranceExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.Insurance); + statement.TaxExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.PropertyTax); + statement.ManagementFees = 0; // No PropertyExpense category maps to this yet + statement.MortgageExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.Mortgage); + statement.OtherExpenses = GetCategory(ApplicationConstants.PropertyExpenseTypes.HOA) + GetCategory(ApplicationConstants.PropertyExpenseTypes.Other); return statement; } @@ -122,8 +155,8 @@ public async Task> GeneratePropertyPerformanceAsync( p.PaidOn <= endDate) .SumAsync(p => p.Amount); - // Calculate expenses from repairs (Nine approach) - var expenses = await context.Repairs + // Calculate expenses from repairs (Nine approach) plus actual fixed expenses + var repairCost = await context.Repairs .Where(r => !r.IsDeleted && r.PropertyId == property.Id && r.OrganizationId == organizationId && @@ -133,16 +166,17 @@ public async Task> GeneratePropertyPerformanceAsync( r.Cost > 0) .SumAsync(r => r.Cost); + var fixedExpenses = await GetActualFixedExpensesByCategoryAsync(context, organizationId, property.Id, startDate, endDate); + var expenses = repairCost + fixedExpenses.Values.Sum(); + // Calculate occupancy days - // Include occupied lease statuses: Active, Renewed, Month-to-Month, Notice Given - // Also include Terminated to count actual days occupied before move-out + // Include active leases (IsActive covers Accepted/MonthToMonth/NoticeGiven/Pending/Offered), + // renewed (historical), and terminated (to count actual days occupied before move-out) var leases = await context.Leases .Where(l => l.PropertyId == property.Id && !l.IsDeleted && - (l.Status == ApplicationConstants.LeaseStatuses.Active || - l.Status == ApplicationConstants.LeaseStatuses.Renewed || - l.Status == ApplicationConstants.LeaseStatuses.MonthToMonth || - l.Status == ApplicationConstants.LeaseStatuses.NoticeGiven || + (l.IsActive || + l.Status == ApplicationConstants.LeaseStatuses.Terminated || l.Status == ApplicationConstants.LeaseStatuses.Terminated) && l.StartDate <= endDate) .ToListAsync(); @@ -236,6 +270,18 @@ public async Task> GenerateTaxReportAsync(Guid organizationI var totalRepairCost = repairExpenses.Sum(r => r.Cost); + var fixedExpenses = await GetActualFixedExpensesByCategoryAsync(context, organizationId, property.Id, startDate, endDate); + decimal GetCategory(string type) => fixedExpenses.TryGetValue(type, out var amt) ? amt : 0m; + + var insurance = GetCategory(ApplicationConstants.PropertyExpenseTypes.Insurance); + var taxes = GetCategory(ApplicationConstants.PropertyExpenseTypes.PropertyTax); + var utilities = GetCategory(ApplicationConstants.PropertyExpenseTypes.Utilities); + // Raw captured Mortgage amount (principal + interest) — use Form 1098, Box 1 + // for the actual tax-deductible interest portion; this app does not compute amortization. + var mortgage = GetCategory(ApplicationConstants.PropertyExpenseTypes.Mortgage); + var repairs = totalRepairCost + GetCategory(ApplicationConstants.PropertyExpenseTypes.Maintenance); + var other = GetCategory(ApplicationConstants.PropertyExpenseTypes.HOA) + GetCategory(ApplicationConstants.PropertyExpenseTypes.Other); + var taxReport = new TaxReportData { Year = year, @@ -244,21 +290,24 @@ public async Task> GenerateTaxReportAsync(Guid organizationI TotalRentIncome = rentIncome, DepreciationAmount = depreciationAmount, - // Currently only repairs are tracked + // Advertising, Cleaning, Legal, Management, and Supplies have no dedicated + // PropertyExpenseType by design — Cleaning rolls into Repairs (Maintenance type) + // and the rest roll into Other if entered; Auto/travel is a business-level + // expense, out of scope for per-property tracking, so it stays $0. Advertising = 0, Cleaning = 0, - Insurance = 0, + Insurance = insurance, Legal = 0, Management = 0, - MortgageInterest = 0, - Repairs = totalRepairCost, // All repair costs + MortgageExpense = mortgage, + Repairs = repairs, Supplies = 0, - Taxes = 0, - Utilities = 0, - Other = 0 + Taxes = taxes, + Utilities = utilities, + Other = other }; - taxReport.TotalExpenses = totalRepairCost; + taxReport.TotalExpenses = insurance + taxes + utilities + mortgage + repairs + other; taxReports.Add(taxReport); } diff --git a/2-Nine.Application/Services/NotificationService.cs b/2-Nine.Application/Services/NotificationService.cs index 383330d..119206d 100644 --- a/2-Nine.Application/Services/NotificationService.cs +++ b/2-Nine.Application/Services/NotificationService.cs @@ -506,4 +506,47 @@ await _hubContext.Clients } #endregion + + #region Sample Data Inheritance + + /// + /// Automatically inherits IsSampleData from the related entity so that + /// notifications created from sample data actions are themselves flagged + /// as sample data and removed when sample data is cleared. + /// + protected override async Task SetCreateDefaultsAsync(Notification entity) + { + entity = await base.SetCreateDefaultsAsync(entity); + + if (!entity.IsSampleData && entity.RelatedEntityId.HasValue && entity.RelatedEntityType != null) + { + entity.IsSampleData = await IsRelatedEntitySampleDataAsync( + entity.RelatedEntityId.Value, + entity.RelatedEntityType); + } + + return entity; + } + + private async Task IsRelatedEntitySampleDataAsync(Guid entityId, string entityType) + { + return entityType switch + { + ApplicationConstants.EntityTypes.Lease => + await _context.Leases.Where(e => e.Id == entityId).Select(e => e.IsSampleData).FirstOrDefaultAsync(), + ApplicationConstants.EntityTypes.Application => + await _context.RentalApplications.Where(e => e.Id == entityId).Select(e => e.IsSampleData).FirstOrDefaultAsync(), + ApplicationConstants.EntityTypes.Property => + await _context.Properties.Where(e => e.Id == entityId).Select(e => e.IsSampleData).FirstOrDefaultAsync(), + ApplicationConstants.EntityTypes.Tenant => + await _context.Tenants.Where(e => e.Id == entityId).Select(e => e.IsSampleData).FirstOrDefaultAsync(), + ApplicationConstants.EntityTypes.Invoice => + await _context.Invoices.Where(e => e.Id == entityId).Select(e => e.IsSampleData).FirstOrDefaultAsync(), + ApplicationConstants.EntityTypes.MaintenanceRequest => + await _context.MaintenanceRequests.Where(e => e.Id == entityId).Select(e => e.IsSampleData).FirstOrDefaultAsync(), + _ => false + }; + } + + #endregion } \ No newline at end of file diff --git a/2-Nine.Application/Services/OrganizationService.cs b/2-Nine.Application/Services/OrganizationService.cs index 00aaa8d..c2069ef 100644 --- a/2-Nine.Application/Services/OrganizationService.cs +++ b/2-Nine.Application/Services/OrganizationService.cs @@ -67,11 +67,11 @@ public async Task CreateOrganizationAsync(string ownerId, string n Name = organization.Name, LateFeeEnabled = true, LateFeeAutoApply = true, - LateFeeGracePeriodDays = 3, + LateFeeGracePeriodDays = 5, LateFeePercentage = 0.05m, MaxLateFeeAmount = 50.00m, PaymentReminderEnabled = true, - PaymentReminderDaysBefore = 3, + PaymentReminderDaysBefore = 10, CreatedOn = DateTime.UtcNow, CreatedBy = ownerId }; @@ -127,11 +127,11 @@ public async Task CreateOrganizationAsync(Organization organizatio Name = organization.Name, LateFeeEnabled = true, LateFeeAutoApply = true, - LateFeeGracePeriodDays = 3, + LateFeeGracePeriodDays = 5, LateFeePercentage = 0.05m, MaxLateFeeAmount = 50.00m, PaymentReminderEnabled = true, - PaymentReminderDaysBefore = 3, + PaymentReminderDaysBefore = 10, CreatedOn = DateTime.UtcNow, CreatedBy = userId }; @@ -308,7 +308,7 @@ public async Task GrantOrganizationAccessAsync(string userId, Guid organiz if (currentUserCount >= _settings.MaxOrganizationUsers) { throw new InvalidOperationException( - $"User limit reached. Nine allows maximum {_settings.MaxOrganizationUsers} user accounts (including system account). " + + "User limit reached. Nine allows a maximum of 4 user accounts (3 login accounts plus the system account). " + "Upgrade to Nine Professional for unlimited users."); } } diff --git a/2-Nine.Application/Services/PaymentService.cs b/2-Nine.Application/Services/PaymentService.cs index 505e6bb..8fc4606 100644 --- a/2-Nine.Application/Services/PaymentService.cs +++ b/2-Nine.Application/Services/PaymentService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using Nine.Core.Constants; using Nine.Core.Entities; @@ -77,8 +78,9 @@ protected override async Task ValidateEntityAsync(Payment entity) .SumAsync(p => p.Amount); var totalWithThisPayment = existingPayments + entity.Amount; - // Invoice amount already includes late fees (added by ScheduledTaskService) - var invoiceTotal = invoice.Amount; + + // Include late fee in invoice total if it has been applied, since payments should cover the full amount due + var invoiceTotal = invoice.Amount + (invoice.LateFeeAmount ?? 0); if (totalWithThisPayment > invoiceTotal) { @@ -556,5 +558,51 @@ private async Task ApplyLateFeeIfEligibleAsync(Invoice invoice, Guid? organizati // Don't throw - we don't want to fail the payment processing if late fee fails } } + + #region Cascade Summary / Archive / Restore + + /// + /// Returns a count of related records that would be permanently deleted with this payment. + /// + public override Task GetDeleteCascadeSummaryAsync(Guid id) + => Task.FromResult(new CascadeSummary { EntityName = "Payment", Counts = new Dictionary() }); + + /// + /// Returns a count of related records that would be archived with this payment. + /// + public override Task GetArchiveCascadeSummaryAsync(Guid id) + => Task.FromResult(new CascadeSummary { EntityName = "Payment", Counts = new Dictionary() }); + + /// + /// Archives a payment using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + int rows = await _context.Payments + .Where(p => p.Id == id && !p.IsDeleted && !p.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(p => p.IsArchived, true) + .SetProperty(p => p.ArchivedOn, now) + .SetProperty(p => p.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Restores an archived payment using a direct SQL update to avoid EF change tracking issues. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.Payments + .Where(p => p.Id == id && p.IsArchived) + .ExecuteUpdateAsync(s => s.SetProperty(p => p.IsArchived, false)); + + return rows > 0; + } + + #endregion } } diff --git a/2-Nine.Application/Services/PdfGenerators/FinancialReportPdfGenerator.cs b/2-Nine.Application/Services/PdfGenerators/FinancialReportPdfGenerator.cs index 30e181c..d286ae2 100644 --- a/2-Nine.Application/Services/PdfGenerators/FinancialReportPdfGenerator.cs +++ b/2-Nine.Application/Services/PdfGenerators/FinancialReportPdfGenerator.cs @@ -88,6 +88,9 @@ public byte[] GenerateIncomeStatementPdf(IncomeStatement statement) table.Cell().PaddingLeft(15).Text("Management Fees"); table.Cell().AlignRight().Text(statement.ManagementFees.ToString("C")); + table.Cell().PaddingLeft(15).Text("Mortgage"); + table.Cell().AlignRight().Text(statement.MortgageExpenses.ToString("C")); + table.Cell().PaddingLeft(15).Text("Other Expenses"); table.Cell().AlignRight().Text(statement.OtherExpenses.ToString("C")); @@ -369,8 +372,8 @@ public byte[] GenerateTaxReportPdf(List taxReports) table.Cell().PaddingLeft(10).Text("12. Management fees"); table.Cell().AlignRight().Text(report.Management.ToString("C")); - table.Cell().PaddingLeft(10).Text("13. Mortgage interest"); - table.Cell().AlignRight().Text(report.MortgageInterest.ToString("C")); + table.Cell().PaddingLeft(10).Text("13. Mortgage Expense (see Form 1098, Box 1 for the tax-deductible interest portion)"); + table.Cell().AlignRight().Text(report.MortgageExpense.ToString("C")); table.Cell().PaddingLeft(10).Text("14. Repairs"); table.Cell().AlignRight().Text(report.Repairs.ToString("C")); diff --git a/2-Nine.Application/Services/PropertyExpenseService.cs b/2-Nine.Application/Services/PropertyExpenseService.cs new file mode 100644 index 0000000..794c208 --- /dev/null +++ b/2-Nine.Application/Services/PropertyExpenseService.cs @@ -0,0 +1,358 @@ +using Nine.Core.Constants; +using Nine.Core.Entities; +using Nine.Core.Interfaces.Services; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; + +namespace Nine.Application.Services; + +/// +/// Service for managing fixed/recurring property expenses (mortgage, insurance, +/// property tax, HOA, maintenance, utilities, and other custom costs). +/// +public class PropertyExpenseService : BaseService +{ + private readonly ExpenseGenerationService _expenseGenerationService; + + public PropertyExpenseService( + ApplicationDbContext context, + ILogger logger, + IUserContextService userContext, + IOptions settings, + ExpenseGenerationService expenseGenerationService) + : base(context, logger, userContext, settings) + { + _expenseGenerationService = expenseGenerationService; + } + + /// + /// Archives a PropertyExpense along with its ExpenseDue and ExpensePayment + /// history, mirroring LeaseService's Lease -> Invoices -> Payments archive + /// cascade. Used when an expense is archived independently of its Property + /// (Property-level archive already cascades to PropertyExpense via + /// PropertyService.ArchiveAsync; this handles the reverse direction so the + /// full expense chain goes offline together either way). + /// + public override async Task ArchiveAsync(Guid id) + { + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + var result = await base.ArchiveAsync(id); + + if (result) + { + await _context.Set() + .Where(d => d.PropertyExpenseId == id && !d.IsDeleted && !d.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(d => d.IsArchived, true) + .SetProperty(d => d.ArchivedOn, now) + .SetProperty(d => d.ArchivedBy, userId)); + + await _context.Set() + .Where(p => !p.IsDeleted && !p.IsArchived && p.ExpenseDue!.PropertyExpenseId == id) + .ExecuteUpdateAsync(s => s + .SetProperty(p => p.IsArchived, true) + .SetProperty(p => p.ArchivedOn, now) + .SetProperty(p => p.ArchivedBy, userId)); + } + + return result; + } + + /// + /// Restores an archived PropertyExpense. ExpenseDue/ExpensePayment history is + /// not automatically restored, matching InvoiceService's Restore behavior. + /// + public override async Task RestoreAsync(Guid id) + { + return await base.RestoreAsync(id); + } + + /// + /// Validates property expense business rules before create/update. + /// + protected override async Task ValidateEntityAsync(PropertyExpense entity) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + // Validate PropertyId exists and belongs to active organization + var propertyExists = await _context.Properties + .AnyAsync(p => p.Id == entity.PropertyId && p.OrganizationId == orgId && !p.IsDeleted); + + if (!propertyExists) + { + throw new InvalidOperationException("Property not found or does not belong to your organization."); + } + + // Validate ExpenseType is a known value + if (!ApplicationConstants.PropertyExpenseTypes.AllPropertyExpenseTypes.Contains(entity.ExpenseType)) + { + throw new InvalidOperationException($"'{entity.ExpenseType}' is not a valid expense type."); + } + + // Validate the required RecurrencePattern + if (entity.RecurrencePattern == null) + { + throw new InvalidOperationException("A recurrence pattern (including one-time) is required."); + } + + if (!ApplicationConstants.ExpenseFrequencies.AllExpenseFrequencies.Contains(entity.RecurrencePattern.Frequency)) + { + throw new InvalidOperationException($"'{entity.RecurrencePattern.Frequency}' is not a valid expense frequency."); + } + + if (entity.RecurrencePattern.Frequency != ApplicationConstants.ExpenseFrequencies.OneTime) + { + if (!entity.RecurrencePattern.DueDayOfMonth.HasValue || + entity.RecurrencePattern.DueDayOfMonth < 1 || + entity.RecurrencePattern.DueDayOfMonth > 31) + { + throw new InvalidOperationException("A due day of month (1-31) is required for recurring expenses."); + } + + if (entity.RecurrencePattern.Frequency != ApplicationConstants.ExpenseFrequencies.Monthly && + (!entity.RecurrencePattern.AnchorMonth.HasValue || + entity.RecurrencePattern.AnchorMonth < 1 || + entity.RecurrencePattern.AnchorMonth > 12)) + { + throw new InvalidOperationException("An anchor month (1-12) is required for quarterly and annual expenses."); + } + } + + // Validate Amount is non-negative + if (entity.Amount < 0) + { + throw new InvalidOperationException("Amount cannot be negative."); + } + + // Validate EndDate is after EffectiveDate + if (entity.EndDate.HasValue && entity.EndDate.Value < entity.EffectiveDate) + { + throw new InvalidOperationException("End date must be on or after the effective date."); + } + + await base.ValidateEntityAsync(entity); + } + + /// + /// Creates a PropertyExpense along with its RecurrencePattern (derived from the + /// user-selected due date) and backfills any elapsed ExpenseDue cycles. This is + /// the primary entry point for adding an expense from the UI. + /// + /// For a OneTime expense, exactly one ExpenseDue is created at the exact + /// selected date, past or present. For a recurring expense (Monthly/ + /// Quarterly/Annual), every cycle between the selected due date and today + /// is backfilled immediately — clamped to no earlier than January 1 of the + /// current year, so a user is never surprised by an auto-generated + /// ExpenseDue landing in a prior (potentially already-reported) tax year. + /// Any cycles before that boundary must be entered manually; the caller + /// should surface to + /// the user when true. + /// + /// + /// The expense to create. .Frequency + /// must already be set; DueDayOfMonth/AnchorMonth are derived here from + /// and do not need to be pre-populated by the caller. + /// + /// + /// The due date explicitly selected by the user at entry time. Never inferred + /// from EffectiveDate. + /// + public async Task CreateExpenseAsync(PropertyExpense expense, DateTime dueDate) + { + if (expense.EffectiveDate.Date == DateTime.Today && dueDate.Date != DateTime.Today) + { + expense.EffectiveDate = dueDate.Date; + } + + expense.RecurrencePattern ??= new RecurrencePattern(); + var frequency = expense.RecurrencePattern.Frequency; + + if (frequency != ApplicationConstants.ExpenseFrequencies.OneTime) + { + expense.RecurrencePattern.DueDayOfMonth = dueDate.Day; + expense.RecurrencePattern.AnchorMonth = frequency == ApplicationConstants.ExpenseFrequencies.Monthly + ? null + : dueDate.Month; + } + else + { + expense.RecurrencePattern.DueDayOfMonth = null; + expense.RecurrencePattern.AnchorMonth = null; + } + + var created = await CreateAsync(expense); + + if (frequency == ApplicationConstants.ExpenseFrequencies.OneTime) + { + var userId = await _userContext.GetUserIdAsync(); + var due = new ExpenseDue + { + Id = Guid.NewGuid(), + OrganizationId = created.OrganizationId, + PropertyExpenseId = created.Id, + PropertyId = created.PropertyId, + DueDate = dueDate, + AmountDue = created.Amount, + CreatedBy = string.IsNullOrEmpty(userId) ? ApplicationConstants.SystemUser.Id : userId, + CreatedOn = DateTime.UtcNow + }; + + _context.Set().Add(due); + await _context.SaveChangesAsync(); + + return new CreateExpenseResult(created, GeneratedDueCount: 1, WasBackfillClamped: false); + } + + var (generatedCount, wasClamped) = await _expenseGenerationService.BackfillForNewExpenseAsync( + created, dueDate, DateTime.Today); + + return new CreateExpenseResult(created, generatedCount, wasClamped); + } + + /// + /// Gets all property expenses for the active organization with Property navigation included. + /// Overrides base method to include navigation properties. + /// + public override async Task> GetAllAsync() + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(e => !e.IsDeleted && !e.IsArchived && e.OrganizationId == orgId) + .Include(e => e.Property) + .OrderBy(e => e.Property!.Address) + .ThenBy(e => e.ExpenseType) + .ToListAsync(); + } + + /// + /// Gets all archived property expenses for the active organization with Property navigation included. + /// + public override async Task> GetArchivedAsync() + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(e => !e.IsDeleted && e.IsArchived && e.OrganizationId == orgId) + .Include(e => e.Property) + .OrderBy(e => e.Property!.Address) + .ThenBy(e => e.ExpenseType) + .ToListAsync(); + } + + /// + /// Gets currently active expenses for a specific property (no EndDate set). + /// + public async Task> GetExpensesByPropertyAsync(Guid propertyId) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(e => e.PropertyId == propertyId && !e.IsDeleted && !e.IsArchived && !e.EndDate.HasValue) + .Include(e => e.Property) + .Where(e => e.Property!.OrganizationId == orgId) + .OrderBy(e => e.ExpenseType) + .ToListAsync(); + } + + /// + /// Gets all expenses (including cancelled) for a property within a date range. + /// Used for lease-period reporting: returns any expense whose effective span + /// overlaps the given period. + /// + public async Task> GetExpensesForLeasePeriodAsync(Guid propertyId, DateTime leaseStart, DateTime leaseEnd) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(e => e.PropertyId == propertyId && !e.IsDeleted) + .Include(e => e.Property) + .Where(e => e.Property!.OrganizationId == orgId) + // Expense was active at some point during the lease period + .Where(e => e.EffectiveDate <= leaseEnd && + (!e.EndDate.HasValue || e.EndDate.Value >= leaseStart)) + .OrderBy(e => e.EffectiveDate) + .ThenBy(e => e.ExpenseType) + .ToListAsync(); + } + + /// + /// Gets the total normalized monthly expense amount for a specific property, + /// summed across all active (non-ended) expenses. + /// + public async Task GetTotalMonthlyExpensesByPropertyAsync(Guid propertyId) + { + var expenses = await GetExpensesByPropertyAsync(propertyId); + var today = DateTime.Today; + + return expenses + .Where(e => !e.EndDate.HasValue || e.EndDate.Value >= today) + .Sum(e => e.MonthlyAmount); + } + + /// + /// Gets total normalized monthly expenses grouped by property, for all properties + /// in the active organization. + /// + public async Task> GetTotalMonthlyExpensesByAllPropertiesAsync() + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + var today = DateTime.Today; + + var expenses = await _dbSet + .Where(e => !e.IsDeleted && !e.IsArchived && e.OrganizationId == orgId) + .Where(e => !e.EndDate.HasValue || e.EndDate.Value >= today) + .ToListAsync(); + + return expenses + .GroupBy(e => e.PropertyId) + .ToDictionary(g => g.Key, g => g.Sum(e => e.MonthlyAmount)); + } + + /// + /// Cancels an expense by setting EndDate to today and optionally recording a reason. + /// The record is permanently retained for audit and lease-period reporting. + /// + public async Task CancelExpenseAsync(Guid id, string? reason = null) + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + var userId = await _userContext.GetUserIdAsync(); + + var expense = await _dbSet + .FirstOrDefaultAsync(e => e.Id == id && !e.IsDeleted && e.OrganizationId == orgId); + + if (expense == null) + throw new InvalidOperationException("Expense not found or does not belong to your organization."); + + expense.EndDate = DateTime.Today; + expense.EndReason = string.IsNullOrWhiteSpace(reason) + ? $"Cancelled by {userId}" + : reason.Trim(); + expense.LastModifiedOn = DateTime.UtcNow; + expense.LastModifiedBy = userId; + + _context.Update(expense); + await _context.SaveChangesAsync(); + } + + /// + /// Voids an expense entered in error. Deletes the record according to + /// ApplicationSettings.SoftDeleteEnabled (hard delete when disabled, soft delete when enabled). + /// + public async Task VoidExpenseAsync(Guid id) + { + await DeleteAsync(id); + } +} + +/// +/// Result of PropertyExpenseService.CreateExpenseAsync — the created expense, +/// how many ExpenseDue cycles were backfilled, and whether the backfill was +/// clamped to January 1 of the current year (meaning the user selected a due +/// date before that boundary, and any cycles prior to it must be entered +/// manually). Callers should surface WasBackfillClamped to the user. +/// +public record CreateExpenseResult(PropertyExpense Expense, int GeneratedDueCount, bool WasBackfillClamped); diff --git a/2-Nine.Application/Services/PropertyManagementService.cs b/2-Nine.Application/Services/PropertyManagementService.cs index 2487dd0..9a51394 100644 --- a/2-Nine.Application/Services/PropertyManagementService.cs +++ b/2-Nine.Application/Services/PropertyManagementService.cs @@ -516,8 +516,7 @@ public async Task> GetCurrentAndUpcomingLeasesByPropertyIdAsync(Guid .Where(l => l.PropertyId == propertyId && !l.IsDeleted && l.Property.OrganizationId == organizationId - && (l.Status == ApplicationConstants.LeaseStatuses.Pending - || l.Status == ApplicationConstants.LeaseStatuses.Active)) + && l.IsActive) .ToListAsync(); } @@ -588,7 +587,6 @@ public async Task> GetLeasesByTenantIdAsync(Guid tenantId) await _dbContext.Leases.AddAsync(lease); - property.IsActive = false; property.LastModifiedOn = DateTime.UtcNow; property.LastModifiedBy = _userId; @@ -1148,17 +1146,6 @@ public async Task DeleteDocumentAsync(Document document) _dbContext.Inspections.Update(inspection); } - // Clear Lease.DocumentId if any lease links to this document - var lease = await _dbContext.Leases - .FirstOrDefaultAsync(l => l.DocumentId == document.Id); - if (lease != null) - { - lease.DocumentId = null; - lease.LastModifiedBy = _userId; - lease.LastModifiedOn = DateTime.UtcNow; - _dbContext.Leases.Update(lease); - } - // Clear Invoice.DocumentId if any invoice links to this document if (document.InvoiceId != null) { @@ -1743,11 +1730,11 @@ public async Task UpdateMaintenanceRequestStatusAsync(Guid id, string status) OrganizationId = organizationId.Value, // This should be set to the actual organization ID LateFeeEnabled = true, LateFeeAutoApply = true, - LateFeeGracePeriodDays = 3, + LateFeeGracePeriodDays = 5, LateFeePercentage = 0.05m, MaxLateFeeAmount = 50.00m, PaymentReminderEnabled = true, - PaymentReminderDaysBefore = 3, + PaymentReminderDaysBefore = 10, CreatedOn = DateTime.UtcNow, CreatedBy = string.IsNullOrEmpty(userId) ? string.Empty : userId }; diff --git a/2-Nine.Application/Services/PropertyService.cs b/2-Nine.Application/Services/PropertyService.cs index e723647..9931abc 100644 --- a/2-Nine.Application/Services/PropertyService.cs +++ b/2-Nine.Application/Services/PropertyService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using System.ComponentModel.DataAnnotations; using Nine.Core.Constants; @@ -141,6 +142,20 @@ protected override async Task ValidateEntityAsync(Property property) throw new ValidationException($"A property with address '{property.Address}' already exists in this location."); } + // Inactive properties must have an inactive status (Off Market or Under Renovation) + if (!property.IsActive && !ApplicationConstants.PropertyStatuses.InactiveStatuses.Contains(property.Status)) + { + throw new ValidationException( + $"An inactive property must have a status of '{ApplicationConstants.PropertyStatuses.OffMarket}' or '{ApplicationConstants.PropertyStatuses.UnderRenovation}'."); + } + + // Properties with an inactive status must be marked inactive + if (property.IsActive && ApplicationConstants.PropertyStatuses.InactiveStatuses.Contains(property.Status)) + { + throw new ValidationException( + $"A property with status '{property.Status}' must be marked as inactive."); + } + await base.ValidateEntityAsync(property); } @@ -211,7 +226,7 @@ public async Task> GetVacantPropertiesAsync() p.OrganizationId == organizationId) .Where(p => !_context.Leases.Any(l => l.PropertyId == p.Id && - l.Status == Core.Constants.ApplicationConstants.LeaseStatuses.Active && + l.IsActive && !l.IsDeleted)) .ToListAsync(); } @@ -250,7 +265,7 @@ public async Task CalculateOccupancyRateAsync() p.OrganizationId == organizationId && _context.Leases.Any(l => l.PropertyId == p.Id && - l.Status == Core.Constants.ApplicationConstants.LeaseStatuses.Active && + l.IsActive && !l.IsDeleted)); return (decimal)occupiedProperties / totalProperties * 100; @@ -280,15 +295,13 @@ public async Task CalculatePropertyOccupancyRateAsync(Guid propertyId, var endDate = startDate.AddYears(1).AddDays(-1); // Get all leases for this property that overlap with the period - // Include all occupied statuses: Active, Renewed, Month-to-Month, Notice Given, Terminated + // Include active leases, renewed (historical), and terminated (for actual move-out) var leases = await _context.Leases .Where(l => l.PropertyId == propertyId && l.OrganizationId == organizationId && !l.IsDeleted && - (l.Status == ApplicationConstants.LeaseStatuses.Active || - l.Status == ApplicationConstants.LeaseStatuses.Renewed || - l.Status == ApplicationConstants.LeaseStatuses.MonthToMonth || - l.Status == ApplicationConstants.LeaseStatuses.NoticeGiven || + (l.IsActive || + l.Status == ApplicationConstants.LeaseStatuses.Terminated || l.Status == ApplicationConstants.LeaseStatuses.Terminated) && l.StartDate <= endDate) .ToListAsync(); @@ -381,10 +394,8 @@ public async Task CalculatePortfolioOccupancyRateAsync(DateTime? period .Where(l => l.PropertyId == propertyId && l.OrganizationId == organizationId && !l.IsDeleted && - (l.Status == ApplicationConstants.LeaseStatuses.Active || - l.Status == ApplicationConstants.LeaseStatuses.Renewed || - l.Status == ApplicationConstants.LeaseStatuses.MonthToMonth || - l.Status == ApplicationConstants.LeaseStatuses.NoticeGiven || + (l.IsActive || + l.Status == ApplicationConstants.LeaseStatuses.Terminated || l.Status == ApplicationConstants.LeaseStatuses.Terminated) && l.StartDate <= endDate) .ToListAsync(); @@ -556,7 +567,353 @@ public async Task> GetPropertiesWithInspectionsDueSoonAsync(int d } } - + + + #endregion + + #region Archive / Unarchive Overrides + + /// + /// Archives the property, sets it inactive with Off Market status, and cascade-archives + /// all active related records (leases, inspections, maintenance requests, documents). + /// + public override async Task ArchiveAsync(Guid id) + { + var result = await base.ArchiveAsync(id); + + if (result) + { + var property = await _dbSet.FirstOrDefaultAsync(p => p.Id == id); + if (property != null) + { + property.IsActive = false; + property.Status = ApplicationConstants.PropertyStatuses.OffMarket; + await _context.SaveChangesAsync(); + } + + // Cascade archive all active related records + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + await _context.Leases + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Inspections + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.MaintenanceRequests + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Documents + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Repairs + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.PropertyExpenses + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + // ExpenseDue/ExpensePayment are PropertyExpense's own children. + // Reached directly here (rather than relying on + // PropertyExpenseService.ArchiveAsync's cascade) so the full + // expense chain goes offline together when the property itself + // is archived, per "Archive Property -> everything follows". + await _context.Set() + .Where(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Set() + .Where(x => !x.IsDeleted && !x.IsArchived && x.ExpenseDue!.PropertyId == id) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + } + + return result; + } + + /// + /// Restores the property to view (removes archive flag only). + /// IsActive and Status are NOT changed — the property remains inactive and off market. + /// The user must explicitly reactivate a property to avoid breaching the active property limit. + /// + public override async Task RestoreAsync(Guid id) + { + return await base.RestoreAsync(id); + } + + /// + /// Unarchives the property. When is true, also unarchives + /// all archived related records (leases, inspections, maintenance requests, documents). + /// IsActive and Status are NOT changed — the user must explicitly reactivate the property. + /// + public async Task RestorePropertyAsync(Guid id, bool restoreRelated) + { + var result = await base.RestoreAsync(id); + + if (result && restoreRelated) + { + await _context.Leases + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.Inspections + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.MaintenanceRequests + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.Documents + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.Repairs + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.PropertyExpenses + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.Set() + .Where(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + + await _context.Set() + .Where(x => !x.IsDeleted && x.IsArchived && x.ExpenseDue!.PropertyId == id) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, false) + .SetProperty(x => x.ArchivedOn, x => (DateTime?)null) + .SetProperty(x => x.ArchivedBy, x => (string?)null)); + } + + return result; + } + + /// + /// Returns a count of currently-archived related records for this property. + /// Used to populate the unarchive confirmation prompt. + /// + public async Task GetRestoreCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Leases"] = await _context.Leases.CountAsync(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived), + ["Inspections"] = await _context.Inspections.CountAsync(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived), + ["Maintenance Requests"] = await _context.MaintenanceRequests.CountAsync(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived), + ["Documents"] = await _context.Documents.CountAsync(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived), + ["Repairs"] = await _context.Repairs.CountAsync(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived), + ["Property Expenses"] = await _context.PropertyExpenses.CountAsync(x => x.PropertyId == id && !x.IsDeleted && x.IsArchived), + }; + return new CascadeSummary { EntityName = "Property", Counts = counts }; + } + + #endregion + + #region Delete Override + + /// + /// Deletes a property and all related records (cascade delete). + /// Removes leases (with invoices, payments, security deposits), maintenance requests + /// (with repairs), inspections, documents, calendar events, tours, and rental applications. + /// + public override async Task DeleteAsync(Guid id) + { + await using var transaction = await _context.Database.BeginTransactionAsync(); + try + { + // Delete invoice payments and invoices for all leases on this property + var leaseIds = await _context.Leases + .Where(l => l.PropertyId == id) + .Select(l => l.Id) + .ToListAsync(); + + foreach (var leaseId in leaseIds) + { + var invoiceIds = await _context.Invoices + .Where(i => i.LeaseId == leaseId) + .Select(i => i.Id) + .ToListAsync(); + + foreach (var invoiceId in invoiceIds) + { + var invoicePayments = await _context.Payments + .Where(p => p.InvoiceId == invoiceId) + .ToListAsync(); + _context.Payments.RemoveRange(invoicePayments); + } + + var invoices = await _context.Invoices.Where(i => i.LeaseId == leaseId).ToListAsync(); + _context.Invoices.RemoveRange(invoices); + + var securityDeposits = await _context.SecurityDeposits.Where(s => s.LeaseId == leaseId).ToListAsync(); + _context.SecurityDeposits.RemoveRange(securityDeposits); + } + + var leases = await _context.Leases.Where(l => l.PropertyId == id).ToListAsync(); + + _context.Leases.RemoveRange(leases); + + // Null out Repair.MaintenanceRequestId before deleting maintenance requests + var maintenanceIds = await _context.MaintenanceRequests + .Where(m => m.PropertyId == id) + .Select(m => m.Id) + .ToListAsync(); + + var repairs = await _context.Repairs + .Where(r => r.PropertyId == id) + .ToListAsync(); + _context.Repairs.RemoveRange(repairs); + + var expenses = await _context.PropertyExpenses + .Where(e => e.PropertyId == id) + .ToListAsync(); + _context.PropertyExpenses.RemoveRange(expenses); + + var maintenanceRequests = await _context.MaintenanceRequests.Where(m => m.PropertyId == id).ToListAsync(); + _context.MaintenanceRequests.RemoveRange(maintenanceRequests); + + // Delete calendar events linked to inspections, then delete inspections + var inspectionIds = await _context.Inspections + .Where(i => i.PropertyId == id) + .Select(i => new { i.Id, i.CalendarEventId }) + .ToListAsync(); + + foreach (var inspection in inspectionIds.Where(i => i.CalendarEventId.HasValue)) + { + var inspectionEvent = await _context.CalendarEvents.FindAsync(inspection.CalendarEventId!.Value); + if (inspectionEvent != null) _context.CalendarEvents.Remove(inspectionEvent); + } + + var inspections = await _context.Inspections.Where(i => i.PropertyId == id).ToListAsync(); + _context.Inspections.RemoveRange(inspections); + + // Delete documents, calendar events, tours, rental applications + var documents = await _context.Documents.Where(d => d.PropertyId == id).ToListAsync(); + _context.Documents.RemoveRange(documents); + + var calendarEvents = await _context.CalendarEvents.Where(c => c.PropertyId == id).ToListAsync(); + _context.CalendarEvents.RemoveRange(calendarEvents); + + var tours = await _context.Tours.Where(t => t.PropertyId == id).ToListAsync(); + _context.Tours.RemoveRange(tours); + + var applicationIds = await _context.RentalApplications + .Where(a => a.PropertyId == id) + .Select(a => a.Id) + .ToListAsync(); + + var screenings = await _context.ApplicationScreenings + .Where(s => applicationIds.Contains(s.RentalApplicationId)) + .ToListAsync(); + _context.ApplicationScreenings.RemoveRange(screenings); + + var applications = await _context.RentalApplications.Where(a => a.PropertyId == id).ToListAsync(); + _context.RentalApplications.RemoveRange(applications); + + await _context.SaveChangesAsync(); + + bool result = await base.DeleteAsync(id); + await transaction.CommitAsync(); + return result; + } + catch + { + await transaction.RollbackAsync(); + throw; + } + } + + #endregion + + #region Cascade Summary + + /// + /// Returns a count of related records that would be permanently deleted with this property. + /// + public override async Task GetDeleteCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Leases"] = await _context.Leases.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Inspections"] = await _context.Inspections.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Maintenance Requests"] = await _context.MaintenanceRequests.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Documents"] = await _context.Documents.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Calendar Events"] = await _context.CalendarEvents.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Tours"] = await _context.Tours.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Rental Applications"] = await _context.RentalApplications.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + ["Property Expenses"] = await _context.PropertyExpenses.CountAsync(x => x.PropertyId == id && !x.IsDeleted), + }; + return new CascadeSummary { EntityName = "Property", Counts = counts }; + } + + /// + /// Returns a count of related records that would be archived with this property. + /// + public override async Task GetArchiveCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Leases"] = await _context.Leases.CountAsync(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived), + ["Inspections"] = await _context.Inspections.CountAsync(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived), + ["Maintenance Requests"] = await _context.MaintenanceRequests.CountAsync(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived), + ["Documents"] = await _context.Documents.CountAsync(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived), + ["Repairs"] = await _context.Repairs.CountAsync(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived), + ["Property Expenses"] = await _context.PropertyExpenses.CountAsync(x => x.PropertyId == id && !x.IsDeleted && !x.IsArchived), + }; + return new CascadeSummary { EntityName = "Property", Counts = counts }; + } #endregion } diff --git a/2-Nine.Application/Services/RepairService.cs b/2-Nine.Application/Services/RepairService.cs index 74206fd..785ed44 100644 --- a/2-Nine.Application/Services/RepairService.cs +++ b/2-Nine.Application/Services/RepairService.cs @@ -22,6 +22,22 @@ public RepairService( { } + /// + /// Gets a repair by id with its Property eagerly loaded. Overridden because + /// BaseService.GetByIdAsync does not include any navigation properties by + /// default; without this, Repair.Property is only populated when another + /// already-Included query (e.g., the Repairs list) happens to have loaded + /// the same Property into this request's change tracker first. + /// + public override async Task GetByIdAsync(Guid id) + { + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _context.Repairs + .Include(r => r.Property) + .FirstOrDefaultAsync(r => r.Id == id && !r.IsDeleted && r.OrganizationId == organizationId); + } + /// /// Validates repair business rules before create/update. /// @@ -130,7 +146,21 @@ public override async Task> GetAllAsync() var orgId = await _userContext.GetActiveOrganizationIdAsync(); return await _dbSet - .Where(r => !r.IsDeleted && r.OrganizationId == orgId) + .Where(r => !r.IsDeleted && !r.IsArchived && r.OrganizationId == orgId) + .Include(r => r.Property) + .OrderByDescending(r => r.CompletedOn ?? r.CreatedOn) + .ToListAsync(); + } + + /// + /// Gets all archived repairs for the active organization with Property navigation included. + /// + public override async Task> GetArchivedAsync() + { + var orgId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _dbSet + .Where(r => !r.IsDeleted && r.IsArchived && r.OrganizationId == orgId) .Include(r => r.Property) .OrderByDescending(r => r.CompletedOn ?? r.CreatedOn) .ToListAsync(); diff --git a/2-Nine.Application/Services/ScheduledTaskService.cs b/2-Nine.Application/Services/ScheduledTaskService.cs index 22a0778..255073c 100644 --- a/2-Nine.Application/Services/ScheduledTaskService.cs +++ b/2-Nine.Application/Services/ScheduledTaskService.cs @@ -108,6 +108,21 @@ private async Task DoWork(CancellationToken stoppingToken) var organizationService = scope.ServiceProvider.GetRequiredService(); var leaseNotificationService = scope.ServiceProvider.GetRequiredService(); + // Cross-organization: catch up any recurring property expense + // ExpenseDue cycles that elapsed since this last ran (e.g. the + // application was closed for a period). Runs at every startup + // and every 24h thereafter; idempotent and bounded to the + // current calendar year (see ExpenseGenerationService), so it + // never silently touches a prior tax year no matter how long + // the app was closed. + var expenseGenerationService = scope.ServiceProvider.GetRequiredService(); + var generatedExpenseDueCount = await expenseGenerationService.GenerateMissingDueAsync(DateTime.Today); + if (generatedExpenseDueCount > 0) + { + _logger.LogInformation("Generated {Count} property expense due record(s) catching up through {Date}", + generatedExpenseDueCount, DateTime.Today.ToString("yyyy-MM-dd")); + } + // Get all distinct organization IDs from OrganizationSettings var organizations = await dbContext.OrganizationSettings .Where(s => !s.IsDeleted) @@ -204,7 +219,6 @@ private async Task ProcessOverdueInvoices( invoice.LateFeeAmount = lateFee; invoice.LateFeeApplied = true; invoice.LateFeeAppliedOn = DateTime.UtcNow; - invoice.Amount += lateFee; invoice.Notes = string.IsNullOrEmpty(invoice.Notes) ? $"Late fee of {lateFee:C} applied on {DateTime.Now:MMM dd, yyyy}" : $"{invoice.Notes}\nLate fee of {lateFee:C} applied on {DateTime.Now:MMM dd, yyyy}"; diff --git a/2-Nine.Application/Services/TenantService.cs b/2-Nine.Application/Services/TenantService.cs index f402b73..ffe27e6 100644 --- a/2-Nine.Application/Services/TenantService.cs +++ b/2-Nine.Application/Services/TenantService.cs @@ -1,3 +1,4 @@ +using Nine.Application.Models; using Nine.Core.Interfaces.Services; using System.ComponentModel.DataAnnotations; using Nine.Core.Constants; @@ -71,7 +72,8 @@ public async Task> GetTenantsWithRelationsAsync() return await _context.Tenants .Include(t => t.Leases) - .Where(t => !t.IsDeleted && t.OrganizationId == organizationId) + .ThenInclude(l => l.Property) + .Where(t => !t.IsDeleted && !t.IsArchived && t.OrganizationId == organizationId) .ToListAsync(); } catch (Exception ex) @@ -81,6 +83,34 @@ public async Task> GetTenantsWithRelationsAsync() } } + /// + /// Retrieves all archived tenants with related entities (Leases and their Properties). + /// + public async Task> GetArchivedTenantsWithRelationsAsync() + { + try + { + var userId = await _userContext.GetUserIdAsync(); + if (string.IsNullOrEmpty(userId)) + { + throw new UnauthorizedAccessException("User is not authenticated."); + } + + var organizationId = await _userContext.GetActiveOrganizationIdAsync(); + + return await _context.Tenants + .Include(t => t.Leases) + .ThenInclude(l => l.Property) + .Where(t => !t.IsDeleted && t.IsArchived && t.OrganizationId == organizationId) + .ToListAsync(); + } + catch (Exception ex) + { + await HandleExceptionAsync(ex, "GetArchivedTenantsWithRelations"); + throw; + } + } + /// /// Validates tenant data before create/update operations. /// @@ -235,7 +265,7 @@ public async Task> GetTenantsWithActiveLeasesAsync() t.OrganizationId == organizationId) .Where(t => _context.Leases.Any(l => l.TenantId == t.Id && - l.Status == ApplicationConstants.LeaseStatuses.Active && + l.IsActive && !l.IsDeleted)) .ToListAsync(); } @@ -414,5 +444,219 @@ public async Task CalculateTenantBalanceAsync(Guid tenantId) } #endregion + + #region Delete Override + + /// + /// Deletes a tenant and all related records (cascade delete). + /// Removes leases (with invoices, payments, security deposits) and documents. + /// + public override async Task DeleteAsync(Guid id) + { + await using var transaction = await _context.Database.BeginTransactionAsync(); + try + { + // Get all lease IDs for this tenant + var leaseIds = await _context.Leases + .Where(l => l.TenantId == id) + .Select(l => l.Id) + .ToListAsync(); + + foreach (var leaseId in leaseIds) + { + var invoiceIds = await _context.Invoices + .Where(i => i.LeaseId == leaseId) + .Select(i => i.Id) + .ToListAsync(); + + foreach (var invoiceId in invoiceIds) + { + var payments = await _context.Payments.Where(p => p.InvoiceId == invoiceId).ToListAsync(); + _context.Payments.RemoveRange(payments); + } + + var invoices = await _context.Invoices.Where(i => i.LeaseId == leaseId).ToListAsync(); + _context.Invoices.RemoveRange(invoices); + } + + var securityDeposits = await _context.SecurityDeposits.Where(s => s.TenantId == id).ToListAsync(); + _context.SecurityDeposits.RemoveRange(securityDeposits); + + var leases = await _context.Leases.Where(l => l.TenantId == id).ToListAsync(); + _context.Leases.RemoveRange(leases); + + var documents = await _context.Documents.Where(d => d.TenantId == id).ToListAsync(); + _context.Documents.RemoveRange(documents); + + await _context.SaveChangesAsync(); + + bool result = await base.DeleteAsync(id); + await transaction.CommitAsync(); + return result; + } + catch + { + await transaction.RollbackAsync(); + throw; + } + } + + #endregion + + #region Cascade Summary + + /// + /// Returns a count of related records that would be permanently deleted with this tenant. + /// + public override async Task GetDeleteCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Leases"] = await _context.Leases.CountAsync(x => x.TenantId == id && !x.IsDeleted), + ["Documents"] = await _context.Documents.CountAsync(x => x.TenantId == id && !x.IsDeleted), + ["Security Deposits"] = await _context.SecurityDeposits.CountAsync(x => x.TenantId == id && !x.IsDeleted), + }; + return new CascadeSummary { EntityName = "Tenant", Counts = counts }; + } + + /// + /// Returns a count of related records that would be archived with this tenant. + /// + public override async Task GetArchiveCascadeSummaryAsync(Guid id) + { + var counts = new Dictionary + { + ["Leases"] = await _context.Leases.CountAsync(x => x.TenantId == id && !x.IsDeleted && !x.IsArchived), + ["Documents"] = await _context.Documents.CountAsync(x => x.TenantId == id && !x.IsDeleted && !x.IsArchived), + }; + return new CascadeSummary { EntityName = "Tenant", Counts = counts }; + } + + /// + /// Returns true if the tenant has any active (non-deleted) leases. + /// Used to guard the archive action in the UI before showing the archive modal. + /// + public async Task HasActiveLeasesAsync(Guid id) + { + return await _context.Leases + .AnyAsync(l => l.TenantId == id && l.IsActive && !l.IsDeleted); + } + + /// + /// Archives a tenant using a direct SQL update to avoid EF change tracking issues. + /// The tenant must have no active leases before archiving. + /// Only the tenant record is archived; leases remain unchanged. + /// + public override async Task ArchiveAsync(Guid id) + { + bool hasActiveLeases = await _context.Leases + .AnyAsync(l => l.TenantId == id && l.IsActive && !l.IsDeleted); + + if (hasActiveLeases) + throw new InvalidOperationException("Cannot archive a tenant with active leases."); + + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + int rows = await _context.Tenants + .Where(t => t.Id == id && !t.IsDeleted && !t.IsArchived) + .ExecuteUpdateAsync(setters => setters + .SetProperty(t => t.IsArchived, true) + .SetProperty(t => t.ArchivedOn, now) + .SetProperty(t => t.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Archives a tenant and all of their inactive leases, cascading to invoices, payments, and documents. + /// The tenant must have no active leases before archiving. + /// + public async Task ArchiveWithLeasesAsync(Guid id) + { + bool hasActiveLeases = await _context.Leases + .AnyAsync(l => l.TenantId == id && l.IsActive && !l.IsDeleted); + + if (hasActiveLeases) + throw new InvalidOperationException("Cannot archive a tenant with active leases."); + + var userId = await _userContext.GetUserIdAsync(); + var now = DateTime.UtcNow; + + List leaseIds = await _context.Leases + .Where(l => l.TenantId == id && !l.IsDeleted && !l.IsArchived) + .Select(l => l.Id) + .ToListAsync(); + + if (leaseIds.Count > 0) + { + List invoiceIds = await _context.Invoices + .Where(x => leaseIds.Contains(x.LeaseId) && !x.IsDeleted && !x.IsArchived) + .Select(x => x.Id) + .ToListAsync(); + + if (invoiceIds.Count > 0) + { + await _context.Payments + .Where(p => invoiceIds.Contains(p.InvoiceId) && !p.IsDeleted && !p.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(p => p.IsArchived, true) + .SetProperty(p => p.ArchivedOn, now) + .SetProperty(p => p.ArchivedBy, userId)); + } + + await _context.Invoices + .Where(x => leaseIds.Contains(x.LeaseId) && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Documents + .Where(x => x.LeaseId != null && leaseIds.Contains(x.LeaseId.Value) && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + await _context.Leases + .Where(l => leaseIds.Contains(l.Id)) + .ExecuteUpdateAsync(s => s + .SetProperty(l => l.IsArchived, true) + .SetProperty(l => l.ArchivedOn, now) + .SetProperty(l => l.ArchivedBy, userId)); + } + + await _context.Documents + .Where(x => x.TenantId == id && !x.IsDeleted && !x.IsArchived) + .ExecuteUpdateAsync(s => s + .SetProperty(x => x.IsArchived, true) + .SetProperty(x => x.ArchivedOn, now) + .SetProperty(x => x.ArchivedBy, userId)); + + int rows = await _context.Tenants + .Where(t => t.Id == id && !t.IsDeleted && !t.IsArchived) + .ExecuteUpdateAsync(setters => setters + .SetProperty(t => t.IsArchived, true) + .SetProperty(t => t.ArchivedOn, now) + .SetProperty(t => t.ArchivedBy, userId)); + + return rows > 0; + } + + /// + /// Restores an archived tenant using a direct SQL update to avoid EF change tracking issues. + /// Leases are not automatically restored and must be restored separately if needed. + /// + public override async Task RestoreAsync(Guid id) + { + int rows = await _context.Tenants + .Where(t => t.Id == id && t.IsArchived) + .ExecuteUpdateAsync(setters => setters.SetProperty(t => t.IsArchived, false)); + + return rows > 0; + } + + #endregion } } diff --git a/2-Nine.Application/Services/Workflows/ApplicationWorkflowService.cs b/2-Nine.Application/Services/Workflows/ApplicationWorkflowService.cs index 981701a..bc36eab 100644 --- a/2-Nine.Application/Services/Workflows/ApplicationWorkflowService.cs +++ b/2-Nine.Application/Services/Workflows/ApplicationWorkflowService.cs @@ -877,6 +877,7 @@ public async Task> AcceptLeaseOfferAsync( SecurityDeposit = leaseOffer.SecurityDeposit, Terms = leaseOffer.Terms, Status = ApplicationConstants.LeaseStatuses.Active, + IsActive = true, SignedOn = DateTime.UtcNow, CreatedBy = userId, CreatedOn = DateTime.UtcNow diff --git a/2-Nine.Application/Services/Workflows/LeaseWorkflowService.cs b/2-Nine.Application/Services/Workflows/LeaseWorkflowService.cs index 5a1cdbf..656a950 100644 --- a/2-Nine.Application/Services/Workflows/LeaseWorkflowService.cs +++ b/2-Nine.Application/Services/Workflows/LeaseWorkflowService.cs @@ -12,11 +12,11 @@ public enum LeaseStatus { Pending, Active, - Renewed, - MonthToMonth, NoticeGiven, Expired, - Terminated + Terminated, + Declined, + Interrupted } /// @@ -54,34 +54,24 @@ public List GetValidNextStates(LeaseStatus currentStatus) LeaseStatus.Pending => new() { LeaseStatus.Active, - LeaseStatus.Terminated // Can cancel before activation + LeaseStatus.Declined, + LeaseStatus.Terminated }, LeaseStatus.Active => new() { - LeaseStatus.Renewed, - LeaseStatus.MonthToMonth, LeaseStatus.NoticeGiven, LeaseStatus.Expired, LeaseStatus.Terminated }, - LeaseStatus.Renewed => new() - { - LeaseStatus.Active, // New term starts - LeaseStatus.NoticeGiven, - LeaseStatus.Terminated - }, - LeaseStatus.MonthToMonth => new() + LeaseStatus.NoticeGiven => new() { - LeaseStatus.NoticeGiven, - LeaseStatus.Renewed, // Sign new fixed-term lease LeaseStatus.Terminated }, - LeaseStatus.NoticeGiven => new() + LeaseStatus.Expired => new() { - LeaseStatus.Expired, // Notice period ends naturally - LeaseStatus.Terminated // Early termination + LeaseStatus.Terminated // Tenant vacates without renewal }, - _ => new List() // Terminal states have no valid transitions + _ => new List() // Terminal states: Terminated, Declined, Interrupted }; } @@ -122,6 +112,7 @@ public async Task ActivateLeaseAsync(Guid leaseId, DateTime? mov // Update lease lease.Status = ApplicationConstants.LeaseStatuses.Active; + lease.IsActive = true; lease.SignedOn = moveInDate ?? DateTime.Today; lease.LastModifiedBy = userId; lease.LastModifiedOn = DateTime.UtcNow; @@ -184,8 +175,7 @@ public async Task RecordTerminationNoticeAsync( var activeStatuses = new[] { ApplicationConstants.LeaseStatuses.Active, - ApplicationConstants.LeaseStatuses.MonthToMonth, - ApplicationConstants.LeaseStatuses.Renewed + ApplicationConstants.LeaseStatuses.NoticeGiven // Allow re-noticing }; if (!activeStatuses.Contains(lease.Status)) @@ -259,8 +249,9 @@ public async Task ConvertToMonthToMonthAsync(Guid leaseId, decim var userId = await GetCurrentUserIdAsync(); var oldStatus = lease.Status; - // Update lease - lease.Status = ApplicationConstants.LeaseStatuses.MonthToMonth; + // Convert: change the lease type; reset status to Active if currently Expired + lease.LeaseType = ApplicationConstants.LeaseTypes.MonthToMonth; + lease.Status = ApplicationConstants.LeaseStatuses.Active; if (newMonthlyRent.HasValue && newMonthlyRent > 0) { lease.MonthlyRent = newMonthlyRent.Value; @@ -305,13 +296,17 @@ public async Task> RenewLeaseAsync( var renewableStatuses = new[] { ApplicationConstants.LeaseStatuses.Active, - ApplicationConstants.LeaseStatuses.MonthToMonth, - ApplicationConstants.LeaseStatuses.NoticeGiven // Can be cancelled with renewal + ApplicationConstants.LeaseStatuses.NoticeGiven // Notice can be cancelled with renewal }; if (!renewableStatuses.Contains(existingLease.Status)) return WorkflowResult.Fail( - $"Lease must be in an active state to renew. Current status: {existingLease.Status}"); + $"Lease must be active to renew. Current status: {existingLease.Status}"); + + // Month-to-month leases do not need renewal; convert back to Term type first + if (existingLease.LeaseType == ApplicationConstants.LeaseTypes.MonthToMonth) + return WorkflowResult.Fail( + "Month-to-month leases do not require renewal. Create a new fixed-term lease instead."); // Validate renewal terms if (model.NewEndDate <= existingLease.EndDate) @@ -324,20 +319,22 @@ public async Task> RenewLeaseAsync( var orgId = await GetActiveOrganizationIdAsync(); var oldStatus = existingLease.Status; - // Create renewal record (new lease linked to existing) + // Create new lease record linked to the existing one var renewalLease = new Lease { Id = Guid.NewGuid(), OrganizationId = orgId, PropertyId = existingLease.PropertyId, TenantId = existingLease.TenantId, - PreviousLeaseId = existingLease.Id, // Link to previous lease + PreviousLeaseId = existingLease.Id, StartDate = model.NewStartDate ?? existingLease.EndDate.AddDays(1), EndDate = model.NewEndDate, MonthlyRent = model.NewMonthlyRent, SecurityDeposit = model.UpdatedSecurityDeposit ?? existingLease.SecurityDeposit, Terms = model.NewTerms ?? existingLease.Terms, + LeaseType = ApplicationConstants.LeaseTypes.Term, // Renewal always creates a fixed-term lease Status = ApplicationConstants.LeaseStatuses.Active, + IsActive = true, SignedOn = DateTime.Today, RenewalNumber = existingLease.RenewalNumber + 1, CreatedBy = userId, @@ -346,8 +343,9 @@ public async Task> RenewLeaseAsync( _context.Leases.Add(renewalLease); - // Update existing lease status - existingLease.Status = ApplicationConstants.LeaseStatuses.Renewed; + // Terminate the existing lease — it is now a historical record + existingLease.Status = ApplicationConstants.LeaseStatuses.Terminated; + existingLease.IsActive = false; existingLease.LastModifiedBy = userId; existingLease.LastModifiedOn = DateTime.UtcNow; @@ -417,6 +415,7 @@ public async Task CompleteMoveOutAsync( // Update lease lease.Status = ApplicationConstants.LeaseStatuses.Terminated; + lease.IsActive = false; lease.ActualMoveOutDate = actualMoveOutDate; lease.LastModifiedBy = userId; lease.LastModifiedOn = DateTime.UtcNow; @@ -436,8 +435,7 @@ public async Task CompleteMoveOutAsync( .AnyAsync(l => l.TenantId == lease.TenantId && l.Id != leaseId && l.OrganizationId == orgId && - (l.Status == ApplicationConstants.LeaseStatuses.Active || - l.Status == ApplicationConstants.LeaseStatuses.MonthToMonth) && + l.IsActive && !l.IsDeleted); if (!hasOtherActiveLeases) @@ -498,9 +496,9 @@ public async Task EarlyTerminateAsync( var terminableStatuses = new[] { ApplicationConstants.LeaseStatuses.Active, - ApplicationConstants.LeaseStatuses.MonthToMonth, ApplicationConstants.LeaseStatuses.NoticeGiven, - ApplicationConstants.LeaseStatuses.Pending + ApplicationConstants.LeaseStatuses.Pending, + ApplicationConstants.LeaseStatuses.Expired }; if (!terminableStatuses.Contains(lease.Status)) @@ -515,6 +513,7 @@ public async Task EarlyTerminateAsync( // Update lease lease.Status = ApplicationConstants.LeaseStatuses.Terminated; + lease.IsActive = false; lease.TerminationReason = $"[{terminationType}] {reason}"; lease.ActualMoveOutDate = effectiveDate; lease.LastModifiedBy = userId; @@ -536,8 +535,7 @@ public async Task EarlyTerminateAsync( .AnyAsync(l => l.TenantId == lease.TenantId && l.Id != leaseId && l.OrganizationId == orgId && - (l.Status == ApplicationConstants.LeaseStatuses.Active || - l.Status == ApplicationConstants.LeaseStatuses.MonthToMonth) && + l.IsActive && !l.IsDeleted); if (!hasOtherActiveLeases) @@ -589,14 +587,14 @@ public async Task> ExpireOverdueLeaseAsync(Guid organization return await ExecuteWorkflowAsync(async () => { // Called from background service — no Blazor circuit, use "System" as the actor. - var userId = await _userContext.GetUserIdAsync() ?? "System"; + var userId = await _userContext.GetUserIdAsync() ?? ApplicationConstants.SystemUser.Id; // Find active leases past their end date var expiredLeases = await _context.Leases .Include(l => l.Property) .Include(l => l.Tenant) .Where(l => l.OrganizationId == organizationId && - l.Status == ApplicationConstants.LeaseStatuses.Active && + l.IsActive && l.EndDate < DateTime.Today && !l.IsDeleted) .ToListAsync(); @@ -607,28 +605,14 @@ public async Task> ExpireOverdueLeaseAsync(Guid organization { var oldStatus = lease.Status; lease.Status = ApplicationConstants.LeaseStatuses.Expired; + lease.IsActive = false; lease.RenewalStatus = "Expired"; lease.LastModifiedBy = userId; lease.LastModifiedOn = DateTime.UtcNow; - // Update property status if no other active leases exist for it - if (lease.Property != null) - { - var hasOtherActiveLeases = await _context.Leases - .AnyAsync(l => l.PropertyId == lease.PropertyId - && l.Id != lease.Id - && !l.IsDeleted - && (l.Status == ApplicationConstants.LeaseStatuses.Active - || l.Status == ApplicationConstants.LeaseStatuses.Pending)); - - if (!hasOtherActiveLeases) - { - lease.Property.Status = ApplicationConstants.PropertyStatuses.Available; - lease.Property.IsActive = true; - lease.Property.LastModifiedBy = userId; - lease.Property.LastModifiedOn = DateTime.UtcNow; - } - } + // Property status is intentionally NOT changed on lease expiry. + // An expired end date does not mean the tenant has vacated — the tenancy + // continues on a hold-over basis until explicitly terminated. await LogTransitionAsync( "Lease", @@ -674,7 +658,7 @@ public async Task NotifyLeasesExpiringInAsync(int daysUntilExpiration) var expiringLeases = await _context.Leases .Where(l => l.EndDate.Date == targetDate - && l.Status == ApplicationConstants.LeaseStatuses.Active + && l.IsActive && l.OrganizationId == orgId && !l.IsDeleted) .Include(l => l.Property) @@ -865,8 +849,7 @@ public async Task GetLeaseWorkflowStateAsync(Guid leaseId) AuditHistory = auditHistory, DaysUntilExpiration = (lease.EndDate - DateTime.Today).Days, IsExpiring = (lease.EndDate - DateTime.Today).Days <= 60, - CanRenew = lease.Status == ApplicationConstants.LeaseStatuses.Active || - lease.Status == ApplicationConstants.LeaseStatuses.MonthToMonth, + CanRenew = lease.IsActive, CanTerminate = lease.Status != ApplicationConstants.LeaseStatuses.Terminated && lease.Status != ApplicationConstants.LeaseStatuses.Expired }; @@ -884,7 +867,7 @@ public async Task> GetExpiringLeasesAsync(int withinDays = 60) .Include(l => l.Tenant) .Include(l => l.Property) .Where(l => l.OrganizationId == orgId && - l.Status == ApplicationConstants.LeaseStatuses.Active && + l.IsActive && l.EndDate <= cutoffDate && l.EndDate >= DateTime.Today && !l.IsDeleted) diff --git a/2-Nine.Application/Services/Workflows/SampleDataWorkflowService.cs b/2-Nine.Application/Services/Workflows/SampleDataWorkflowService.cs index 75e1cf6..07c0e6f 100644 --- a/2-Nine.Application/Services/Workflows/SampleDataWorkflowService.cs +++ b/2-Nine.Application/Services/Workflows/SampleDataWorkflowService.cs @@ -61,6 +61,9 @@ public async Task GenerateSampleDataAsync() var properties = await GeneratePropertiesAsync(orgId, systemUserId); _logger.LogInformation($"Created {properties.Count} properties"); + var propertyExpenses = await GeneratePropertyExpensesAsync(properties, orgId, systemUserId); + _logger.LogInformation($"Created {propertyExpenses.Count} property expenses"); + var calendarEvents = await GenerateCalendarEventsForPropertiesAsync(properties); _logger.LogInformation($"Created {calendarEvents.Count} calendar events"); @@ -194,7 +197,10 @@ public async Task RemoveSampleDataAsync() var tenantsDeleted = await RemoveTenantsAsync(orgId); _logger.LogInformation($"Deleted {tenantsDeleted} tenants"); - + + var propertyExpensesDeleted = await RemovePropertyExpensesAsync(orgId); + _logger.LogInformation($"Deleted {propertyExpensesDeleted} property expenses"); + var propertiesDeleted = await RemovePropertiesAsync(orgId); _logger.LogInformation($"Deleted {propertiesDeleted} properties"); @@ -205,7 +211,7 @@ public async Task RemoveSampleDataAsync() repairsDeleted + maintenanceRequestsDeleted + inspectionsDeleted + toursDeleted + applicationScreeningsDeleted + rentalApplicationsDeleted + prospectiveTenantsDeleted + leaseOffersDeleted + securityDepositsDeleted + securityDepositDividendsDeleted + - securityDepositInvestmentPoolsDeleted; + securityDepositInvestmentPoolsDeleted + propertyExpensesDeleted; // Log workflow completion await LogTransitionAsync( @@ -239,18 +245,21 @@ private async Task> GeneratePropertiesAsync(Guid organizationId, var properties = new List(); var now = DateTime.UtcNow; - // Define 9 properties in Texas with varied characteristics + // Define 9 properties in Texas with varied characteristics. + // Rent is intentionally NOT hardcoded here — it is derived from + // calculated monthly expenses at 1.5x so sample data always shows + // a healthy margin rather than an operating loss. var propertyData = new[] { - new { Address = "1234 Riverside Dr", City = "Austin", State = "TX", Zip = "78701", Type = ApplicationConstants.PropertyTypes.House, Beds = 3, Baths = 2.0m, SqFt = 1850, Rent = 1850m, Status = ApplicationConstants.PropertyStatuses.Occupied }, - new { Address = "5678 Oak Street", City = "Houston", State = "TX", Zip = "77002", Type = ApplicationConstants.PropertyTypes.Apartment, Beds = 2, Baths = 2.0m, SqFt = 1200, Rent = 1450m, Status = ApplicationConstants.PropertyStatuses.Occupied }, - new { Address = "910 Maple Ave", City = "Dallas", State = "TX", Zip = "75201", Type = ApplicationConstants.PropertyTypes.House, Beds = 4, Baths = 3.0m, SqFt = 2500, Rent = 2200m, Status = ApplicationConstants.PropertyStatuses.Occupied }, - new { Address = "1122 Pine Ln", City = "San Antonio", State = "TX", Zip = "78205", Type = ApplicationConstants.PropertyTypes.Condo, Beds = 2, Baths = 1.0m, SqFt = 1100, Rent = 1200m, Status = ApplicationConstants.PropertyStatuses.Available }, - new { Address = "3344 Elm Ct", City = "Fort Worth", State = "TX", Zip = "76102", Type = ApplicationConstants.PropertyTypes.House, Beds = 3, Baths = 2.0m, SqFt = 1750, Rent = 1750m, Status = ApplicationConstants.PropertyStatuses.Available }, - new { Address = "5566 Cedar Rd", City = "El Paso", State = "TX", Zip = "79901", Type = ApplicationConstants.PropertyTypes.Apartment, Beds = 1, Baths = 1.0m, SqFt = 850, Rent = 1100m, Status = ApplicationConstants.PropertyStatuses.Available }, - new { Address = "7789 Bluebonnet Blvd", City = "Austin", State = "TX", Zip = "78758", Type = ApplicationConstants.PropertyTypes.House, Beds = 3, Baths = 2.5m, SqFt = 2000, Rent = 1950m, Status = ApplicationConstants.PropertyStatuses.Occupied }, - new { Address = "9012 Ranch Road", City = "Plano", State = "TX", Zip = "75024", Type = ApplicationConstants.PropertyTypes.Townhouse, Beds = 3, Baths = 2.5m, SqFt = 1650, Rent = 1800m, Status = ApplicationConstants.PropertyStatuses.Occupied }, - new { Address = "4455 Lonestar Dr", City = "Corpus Christi", State = "TX", Zip = "78401", Type = ApplicationConstants.PropertyTypes.Condo, Beds = 2, Baths = 2.0m, SqFt = 1300, Rent = 1350m, Status = ApplicationConstants.PropertyStatuses.Available } + new { Address = "1234 Riverside Dr", City = "Austin", State = "TX", Zip = "78701", Type = ApplicationConstants.PropertyTypes.House, Beds = 3, Baths = 2.0m, SqFt = 1850, Status = ApplicationConstants.PropertyStatuses.Occupied }, + new { Address = "5678 Oak Street", City = "Houston", State = "TX", Zip = "77002", Type = ApplicationConstants.PropertyTypes.Apartment, Beds = 2, Baths = 2.0m, SqFt = 1200, Status = ApplicationConstants.PropertyStatuses.Occupied }, + new { Address = "910 Maple Ave", City = "Dallas", State = "TX", Zip = "75201", Type = ApplicationConstants.PropertyTypes.House, Beds = 4, Baths = 3.0m, SqFt = 2500, Status = ApplicationConstants.PropertyStatuses.Occupied }, + new { Address = "1122 Pine Ln", City = "San Antonio", State = "TX", Zip = "78205", Type = ApplicationConstants.PropertyTypes.Condo, Beds = 2, Baths = 1.0m, SqFt = 1100, Status = ApplicationConstants.PropertyStatuses.Available }, + new { Address = "3344 Elm Ct", City = "Fort Worth", State = "TX", Zip = "76102", Type = ApplicationConstants.PropertyTypes.House, Beds = 3, Baths = 2.0m, SqFt = 1750, Status = ApplicationConstants.PropertyStatuses.Available }, + new { Address = "5566 Cedar Rd", City = "El Paso", State = "TX", Zip = "79901", Type = ApplicationConstants.PropertyTypes.Apartment, Beds = 1, Baths = 1.0m, SqFt = 850, Status = ApplicationConstants.PropertyStatuses.Available }, + new { Address = "7789 Bluebonnet Blvd", City = "Austin", State = "TX", Zip = "78758", Type = ApplicationConstants.PropertyTypes.House, Beds = 3, Baths = 2.5m, SqFt = 2000, Status = ApplicationConstants.PropertyStatuses.Occupied }, + new { Address = "9012 Ranch Road", City = "Plano", State = "TX", Zip = "75024", Type = ApplicationConstants.PropertyTypes.Townhouse, Beds = 3, Baths = 2.5m, SqFt = 1650, Status = ApplicationConstants.PropertyStatuses.Occupied }, + new { Address = "4455 Lonestar Dr", City = "Corpus Christi", State = "TX", Zip = "78401", Type = ApplicationConstants.PropertyTypes.Condo, Beds = 2, Baths = 2.0m, SqFt = 1300, Status = ApplicationConstants.PropertyStatuses.Available } }; for (int i = 0; i < propertyData.Length; i++) @@ -258,6 +267,10 @@ private async Task> GeneratePropertiesAsync(Guid organizationId, var data = propertyData[i]; var createdDate = GetRandomDate(new DateTime(2025, 4, 1), new DateTime(2025, 6, 30)); + // Calculate expense totals from square footage so rent can be set at 1.5x. + var totalMonthlyExpenses = CalculateSampleMonthlyExpenses(data.SqFt); + var rent = Math.Round(totalMonthlyExpenses * 1.5m, 0); + var property = new Property { Id = Guid.NewGuid(), @@ -270,9 +283,9 @@ private async Task> GeneratePropertiesAsync(Guid organizationId, Bedrooms = data.Beds, Bathrooms = data.Baths, SquareFeet = data.SqFt, - MonthlyRent = data.Rent, + MonthlyRent = rent, Status = data.Status, - IsActive = data.Status == ApplicationConstants.PropertyStatuses.Available, + IsActive = true, Description = $"Beautiful {data.Beds} bedroom, {data.Baths} bath {data.Type.ToLower()} in {data.City}. " + $"{data.SqFt} square feet with modern amenities and convenient location.", RoutineInspectionIntervalMonths = 12, @@ -295,6 +308,243 @@ private async Task> GeneratePropertiesAsync(Guid organizationId, #endregion + #region Property Expense Generation + + private async Task> GeneratePropertyExpensesAsync(List properties, Guid organizationId, string userId) + { + var expenses = new List(); + var today = DateTime.Today; + + foreach (var property in properties) + { + // Use the same sq-footage rates as CalculateSampleMonthlyExpenses so that + // the amounts saved here are consistent with the rent set during property generation. + var sqFt = property.SquareFeet; + var mortgageMonthly = Math.Round(sqFt * 0.55m, 2); + var insuranceAnnual = Math.Round(sqFt * 0.864m, 2); // $0.072/sqft/mo × 12 + var taxAnnual = Math.Round(sqFt * 1.08m, 2); // $0.09/sqft/mo × 12 + var hoaQuarterly = Math.Round(sqFt * 0.90m, 2); // $0.30/sqft/mo x 3 + + var propertyExpenses = new[] + { + new PropertyExpense + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + PropertyId = property.Id, + ExpenseType = ApplicationConstants.PropertyExpenseTypes.Mortgage, + Description = "Primary mortgage", + Amount = mortgageMonthly, + RecurrencePattern = new RecurrencePattern + { + Frequency = ApplicationConstants.ExpenseFrequencies.Monthly, + DueDayOfMonth = 1 + }, + EffectiveDate = today.AddYears(-1), + CreatedBy = userId, + CreatedOn = property.CreatedOn, + IsSampleData = true + }, + new PropertyExpense + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + PropertyId = property.Id, + ExpenseType = ApplicationConstants.PropertyExpenseTypes.Insurance, + Description = "Homeowner's insurance (annual)", + Amount = insuranceAnnual, + RecurrencePattern = new RecurrencePattern + { + Frequency = ApplicationConstants.ExpenseFrequencies.Annual, + DueDayOfMonth = 1, + AnchorMonth = today.AddYears(-1).Month + }, + EffectiveDate = today.AddYears(-1), + CreatedBy = userId, + CreatedOn = property.CreatedOn, + IsSampleData = true + }, + new PropertyExpense + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + PropertyId = property.Id, + ExpenseType = ApplicationConstants.PropertyExpenseTypes.PropertyTax, + Description = "Annual property tax", + Amount = taxAnnual, + RecurrencePattern = new RecurrencePattern + { + Frequency = ApplicationConstants.ExpenseFrequencies.Annual, + DueDayOfMonth = 1, + AnchorMonth = today.AddYears(-1).Month + }, + EffectiveDate = today.AddYears(-1), + CreatedBy = userId, + CreatedOn = property.CreatedOn, + IsSampleData = true + }, + new PropertyExpense + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + PropertyId = property.Id, + ExpenseType = ApplicationConstants.PropertyExpenseTypes.HOA, + Description = "HOA dues (quarterly)", + Amount = hoaQuarterly, + // Demonstrates a non-1st due day, e.g. quarterly due on the 22nd. + RecurrencePattern = new RecurrencePattern + { + Frequency = ApplicationConstants.ExpenseFrequencies.Quarterly, + DueDayOfMonth = 22, + AnchorMonth = today.AddYears(-1).Month + }, + EffectiveDate = today.AddYears(-1), + CreatedBy = userId, + CreatedOn = property.CreatedOn, + IsSampleData = true + }, + new PropertyExpense + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + PropertyId = property.Id, + ExpenseType = ApplicationConstants.PropertyExpenseTypes.Maintenance, + Description = "Move-in inspection fee", + Amount = 150m, + // One-off expense: no recurrence at all. + RecurrencePattern = new RecurrencePattern + { + Frequency = ApplicationConstants.ExpenseFrequencies.OneTime + }, + EffectiveDate = today.AddMonths(-6), + CreatedBy = userId, + CreatedOn = property.CreatedOn, + IsSampleData = true + } + }; + + _context.PropertyExpenses.AddRange(propertyExpenses); + expenses.AddRange(propertyExpenses); + } + + await _context.SaveChangesAsync(); + + await GenerateExpenseDueHistoryAsync(expenses, organizationId, userId); + + return expenses; + } + + /// + /// Seeds ExpenseDue (and mostly-paid ExpensePayment) history for sample + /// PropertyExpenses, from EffectiveDate through today, so demos show + /// realistic cycle-by-cycle due/paid data rather than an empty history. + /// The most recent cycle for each expense is left unpaid to demonstrate + /// the "Mark Paid" action. + /// + private async Task GenerateExpenseDueHistoryAsync(List expenses, Guid organizationId, string userId) + { + var today = DateTime.Today; + var duesToAdd = new List(); + var paymentsToAdd = new List(); + + foreach (var expense in expenses) + { + var cycles = BuildSampleCycleDates(expense, today); + + for (var i = 0; i < cycles.Count; i++) + { + var due = new ExpenseDue + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + PropertyExpenseId = expense.Id, + PropertyId = expense.PropertyId, + DueDate = cycles[i], + AmountDue = expense.Amount, + CreatedBy = userId, + CreatedOn = expense.CreatedOn, + IsSampleData = true + }; + duesToAdd.Add(due); + + // Leave the most recent cycle unpaid so demos show a pending payment. + var isMostRecentCycle = i == cycles.Count - 1; + if (!isMostRecentCycle) + { + paymentsToAdd.Add(new ExpensePayment + { + Id = Guid.NewGuid(), + OrganizationId = organizationId, + ExpenseDueId = due.Id, + AmountPaid = due.AmountDue, + PaidOn = due.DueDate, + CreatedBy = userId, + CreatedOn = due.CreatedOn, + IsSampleData = true + }); + } + } + } + + _context.Set().AddRange(duesToAdd); + _context.Set().AddRange(paymentsToAdd); + await _context.SaveChangesAsync(); + } + + /// + /// Builds the list of cycle due dates from EffectiveDate through today for + /// a sample expense, based on its RecurrencePattern. OneTime expenses + /// produce exactly one date (EffectiveDate itself). + /// + private static List BuildSampleCycleDates(PropertyExpense expense, DateTime today) + { + var pattern = expense.RecurrencePattern; + var dates = new List(); + + if (pattern.Frequency == ApplicationConstants.ExpenseFrequencies.OneTime) + { + dates.Add(expense.EffectiveDate); + return dates; + } + + var day = pattern.DueDayOfMonth ?? 1; + var monthStep = pattern.Frequency switch + { + ApplicationConstants.ExpenseFrequencies.Monthly => 1, + ApplicationConstants.ExpenseFrequencies.Quarterly => 3, + ApplicationConstants.ExpenseFrequencies.Annual => 12, + _ => 1 + }; + + var cursor = new DateTime(expense.EffectiveDate.Year, expense.EffectiveDate.Month, + Math.Min(day, DateTime.DaysInMonth(expense.EffectiveDate.Year, expense.EffectiveDate.Month))); + + while (cursor <= today) + { + dates.Add(cursor); + cursor = cursor.AddMonths(monthStep); + cursor = new DateTime(cursor.Year, cursor.Month, + Math.Min(day, DateTime.DaysInMonth(cursor.Year, cursor.Month))); + } + + return dates; + } + + /// + /// Calculates the total normalized monthly expense for a property based on square footage. + /// Mortgage is monthly; insurance and tax are annual (divided by 12 for monthly equivalent). + /// Used during sample data generation so rent can be set at 1.5× expenses. + /// + private static decimal CalculateSampleMonthlyExpenses(int squareFeet) + { + var mortgageMonthly = squareFeet * 0.55m; // $0.55/sqft/mo + var insuranceMonthlyEquiv = squareFeet * 0.072m; // annual ÷ 12 + var taxMonthlyEquiv = squareFeet * 0.09m; // annual ÷ 12 + return mortgageMonthly + insuranceMonthlyEquiv + taxMonthlyEquiv; + } + + #endregion + #region Tenant Generation private async Task> GenerateTenantsAsync(Guid organizationId, string userId) @@ -384,7 +634,9 @@ private async Task> GenerateLeasesAsync( MonthlyRent = property.MonthlyRent, SecurityDeposit = property.MonthlyRent, // 1x rent Status = ApplicationConstants.LeaseStatuses.Active, - Terms = $"12-month {ApplicationConstants.LeaseTypes.FixedTerm} lease. Rent: ${property.MonthlyRent}/month. " + + LeaseType = ApplicationConstants.LeaseTypes.Term, + IsActive = true, + Terms = $"12-month {ApplicationConstants.LeaseTypes.Term} lease. Rent: ${property.MonthlyRent}/month. " + $"Security Deposit: ${property.MonthlyRent}. Payment due on the 5th of each month.", SignedOn = startDate.AddDays(-10), // Signed 10 days before start OfferedOn = startDate.AddDays(-20), // Offered 20 days before start @@ -399,7 +651,6 @@ private async Task> GenerateLeasesAsync( // Update property status to Occupied property.Status = ApplicationConstants.PropertyStatuses.Occupied; - property.IsActive = false; } // Create 2 new leases expiring soon (properties 6 and 7, tenants 3 and 4) @@ -417,7 +668,9 @@ private async Task> GenerateLeasesAsync( MonthlyRent = properties[6].MonthlyRent, SecurityDeposit = properties[6].MonthlyRent, Status = ApplicationConstants.LeaseStatuses.Active, - Terms = $"12-month {ApplicationConstants.LeaseTypes.FixedTerm} lease. Rent: ${properties[6].MonthlyRent}/month. " + + LeaseType = ApplicationConstants.LeaseTypes.Term, + IsActive = true, + Terms = $"12-month {ApplicationConstants.LeaseTypes.Term} lease. Rent: ${properties[6].MonthlyRent}/month. " + $"Security Deposit: ${properties[6].MonthlyRent}. Payment due on the 5th of each month. EXPIRING SOON.", SignedOn = startDate30.AddDays(-10), // Signed 10 days before start OfferedOn = startDate30.AddDays(-20), // Offered 20 days before start @@ -429,7 +682,6 @@ private async Task> GenerateLeasesAsync( _context.Leases.Add(lease30Days); leases.Add(lease30Days); properties[6].Status = ApplicationConstants.PropertyStatuses.Occupied; - properties[6].IsActive = false; // Lease 2: Expires in 60 days from current date var endDate60 = currentDate.AddDays(60); @@ -445,7 +697,9 @@ private async Task> GenerateLeasesAsync( MonthlyRent = properties[7].MonthlyRent, SecurityDeposit = properties[7].MonthlyRent, Status = ApplicationConstants.LeaseStatuses.Active, - Terms = $"12-month {ApplicationConstants.LeaseTypes.FixedTerm} lease. Rent: ${properties[7].MonthlyRent}/month. " + + LeaseType = ApplicationConstants.LeaseTypes.Term, + IsActive = true, + Terms = $"12-month {ApplicationConstants.LeaseTypes.Term} lease. Rent: ${properties[7].MonthlyRent}/month. " + $"Security Deposit: ${properties[7].MonthlyRent}. Payment due on the 5th of each month. EXPIRING SOON.", SignedOn = startDate60.AddDays(-10), // Signed 10 days before start OfferedOn = startDate60.AddDays(-20), // Offered 20 days before start @@ -457,7 +711,6 @@ private async Task> GenerateLeasesAsync( _context.Leases.Add(lease60Days); leases.Add(lease60Days); properties[7].Status = ApplicationConstants.PropertyStatuses.Occupied; - properties[7].IsActive = false; await _context.SaveChangesAsync(); _logger.LogInformation($"Generated {leases.Count} leases"); @@ -647,6 +900,14 @@ private async Task> GeneratePaymentsAsync( invoice.PaidOn = paymentDate; invoice.LastModifiedBy = userId; invoice.LastModifiedOn = paymentDate; + + // Record late fee on invoice so BalanceDue = Amount + LateFeeAmount - AmountPaid = 0 + if (lateFee > 0) + { + invoice.LateFeeAmount = lateFee; + invoice.LateFeeApplied = true; + invoice.LateFeeAppliedOn = paymentDate; + } // Save invoice status update immediately await _context.SaveChangesAsync(); @@ -914,6 +1175,20 @@ private async Task RemoveRepairsAsync(Guid organizationId) return repairs.Count; } + private async Task RemovePropertyExpensesAsync(Guid organizationId) + { + var expenses = await _context.PropertyExpenses + .Where(e => e.OrganizationId == organizationId && e.IsSampleData) + .ToListAsync(); + + // PropertyExpense -> ExpenseDue -> ExpensePayment cascade on delete, + // so removing the expense is sufficient to remove its full history. + _context.PropertyExpenses.RemoveRange(expenses); + await _context.SaveChangesAsync(); + + return expenses.Count; + } + private async Task RemoveMaintenanceRequestsAsync(Guid organizationId) { var maintenanceRequests = await _context.MaintenanceRequests diff --git a/3-Nine.Shared.UI/Components/Common/ActionConfirmModal.razor b/3-Nine.Shared.UI/Components/Common/ActionConfirmModal.razor new file mode 100644 index 0000000..7d2da19 --- /dev/null +++ b/3-Nine.Shared.UI/Components/Common/ActionConfirmModal.razor @@ -0,0 +1,103 @@ +@namespace Nine.Shared.UI.Components.Common +@using Nine.Application.Models + +@if (IsVisible) +{ + +} + +@code { + /// Controls the visibility of the modal. + [Parameter] public bool IsVisible { get; set; } + + /// Modal title text. + [Parameter] public string Title { get; set; } = "Confirm"; + + /// Body message displayed to the user. + [Parameter] public string Message { get; set; } = "Are you sure?"; + + /// Text for the confirm button. + [Parameter] public string ConfirmText { get; set; } = "Confirm"; + + /// + /// Visual variant: "danger" (red, for delete) or "warning" (yellow, for archive). + /// + [Parameter] public string Variant { get; set; } = "danger"; + + /// Optional cascade summary showing related records that will be affected. + [Parameter] public CascadeSummary? Cascade { get; set; } + + /// Whether an async operation is in progress (shows spinner, disables buttons). + [Parameter] public bool IsProcessing { get; set; } + + /// Fired when the user confirms the primary action. + [Parameter] public EventCallback OnConfirm { get; set; } + + /// Fired when the user cancels. + [Parameter] public EventCallback OnCancel { get; set; } + + /// + /// Optional text for a secondary confirm button (e.g., "Property Only" in an unarchive prompt). + /// When set, a second button is shown between Cancel and the primary confirm. + /// + [Parameter] public string? SecondaryConfirmText { get; set; } + + /// Fired when the user selects the secondary confirm action. + [Parameter] public EventCallback OnSecondaryConfirm { get; set; } + + /// Label shown above the cascade record list. Defaults to "Related records affected:". + [Parameter] public string CascadeLabel { get; set; } = "Related records affected:"; + + private string HeaderClass => Variant == "warning" ? "bg-warning text-dark" : "bg-danger"; + private string ConfirmButtonClass => Variant == "warning" ? "btn-warning" : "btn-danger"; + private string IconClass => Variant == "warning" ? "bi-archive" : "bi-trash"; + + private async Task HandleConfirm() => await OnConfirm.InvokeAsync(); + private async Task HandleCancel() => await OnCancel.InvokeAsync(); + private async Task HandleSecondaryConfirm() => await OnSecondaryConfirm.InvokeAsync(); +} diff --git a/3-Nine.Shared.UI/Components/Common/EntityFilterBar.razor b/3-Nine.Shared.UI/Components/Common/EntityFilterBar.razor index e45cfd0..0d73909 100644 --- a/3-Nine.Shared.UI/Components/Common/EntityFilterBar.razor +++ b/3-Nine.Shared.UI/Components/Common/EntityFilterBar.razor @@ -68,16 +68,28 @@ } - @* Group Toggle *@ - @if (ShowGroupToggle && GroupedDataAvailable) + @* Group Toggle and Archived Toggle *@ + @if (ShowGroupToggle || ShowArchivedToggle) {
-
- - -
+ @if (ShowGroupToggle) + { +
+ + +
+ } + @if (ShowArchivedToggle) + { +
+ + +
+ }
} @@ -130,12 +142,18 @@ [Parameter] public bool GroupByProperty { get; set; } [Parameter] public EventCallback OnGroupToggled { get; set; } + // Archived toggle parameters + [Parameter] public bool ShowArchivedToggle { get; set; } = false; + [Parameter] public bool ShowArchived { get; set; } = false; + [Parameter] public EventCallback OnShowArchivedToggled { get; set; } + // Clear button parameters [Parameter] public bool ShowClearButton { get; set; } = false; [Parameter] public EventCallback OnClearFilters { get; set; } - // Generate unique ID for the toggle to avoid label conflicts + // Generate unique IDs for the toggles to avoid label conflicts private string GroupToggleId => $"groupToggle_{Guid.NewGuid():N}"; + private string ArchivedToggleId => $"archivedToggle_{Guid.NewGuid():N}"; private async Task HandleSearchInput(ChangeEventArgs e) { @@ -161,4 +179,9 @@ { await OnGroupToggled.InvokeAsync(e.Value is bool boolValue && boolValue); } + + private async Task HandleArchivedToggle(ChangeEventArgs e) + { + await OnShowArchivedToggled.InvokeAsync(e.Value is bool boolValue && boolValue); + } } diff --git a/3-Nine.Shared.UI/Components/Common/MetricsCard.razor b/3-Nine.Shared.UI/Components/Common/MetricsCard.razor index 301a165..3af3b11 100644 --- a/3-Nine.Shared.UI/Components/Common/MetricsCard.razor +++ b/3-Nine.Shared.UI/Components/Common/MetricsCard.razor @@ -3,8 +3,8 @@
-

@Count

@Title

+

@Count

diff --git a/3-Nine.Shared.UI/Components/Entities/Invoices/InvoiceList.razor b/3-Nine.Shared.UI/Components/Entities/Invoices/InvoiceList.razor index 057863d..710f7f3 100644 --- a/3-Nine.Shared.UI/Components/Entities/Invoices/InvoiceList.razor +++ b/3-Nine.Shared.UI/Components/Entities/Invoices/InvoiceList.razor @@ -7,7 +7,7 @@ @if (Invoices.Any()) {
- @foreach (var invoice in Invoices.OrderByDescending(i => i.InvoiceNumber)) + @foreach (var invoice in PagedInvoices) {
@@ -37,6 +37,17 @@
}
+ @if (TotalPages > 1) + { +
+ @(((_currentPage - 1) * PageSize) + 1)–@(Math.Min(_currentPage * PageSize, SortedInvoices.Count)) of @SortedInvoices.Count +
+ + + +
+
+ } } else { @@ -46,7 +57,6 @@
@code { [Parameter, EditorRequired] - public List Invoices { get; set; } = new(); [Parameter] @@ -55,12 +65,24 @@ [Parameter] public string HeaderCssClass { get; set; } = ""; + [Parameter] + public int PageSize { get; set; } = 5; + [Parameter] public EventCallback OnViewAll { get; set; } [Parameter] public EventCallback OnViewItem { get; set; } + private int _currentPage = 1; + + private List SortedInvoices => Invoices.OrderByDescending(i => i.InvoiceNumber).ToList(); + private int TotalPages => (int)Math.Ceiling(SortedInvoices.Count / (double)PageSize); + private List PagedInvoices => SortedInvoices.Skip((_currentPage - 1) * PageSize).Take(PageSize).ToList(); + + private void PrevPage() { if (_currentPage > 1) _currentPage--; } + private void NextPage() { if (_currentPage < TotalPages) _currentPage++; } + private string GetInvoiceStatusBadgeClass(string status) { return status switch diff --git a/3-Nine.Shared.UI/Components/Entities/Leases/LeaseLifeCycleCard.razor b/3-Nine.Shared.UI/Components/Entities/Leases/LeaseLifeCycleCard.razor index 04afb9a..9ed0c84 100644 --- a/3-Nine.Shared.UI/Components/Entities/Leases/LeaseLifeCycleCard.razor +++ b/3-Nine.Shared.UI/Components/Entities/Leases/LeaseLifeCycleCard.razor @@ -1,27 +1,50 @@ +@using Nine.Core.Constants +@using Nine.Core.Entities
-@* Lease Lifecycle Management Card *@ -@if (Lease.Status == "Active" || Lease.Status == "MonthToMonth" || Lease.Status == "NoticeGiven") +@* Lease Lifecycle Management Card — shown for any actionable lease state *@ +@{ + var isActive = Lease.Status == ApplicationConstants.LeaseStatuses.Active; + var isNotice = Lease.Status == ApplicationConstants.LeaseStatuses.NoticeGiven; + var isExpired = Lease.Status == ApplicationConstants.LeaseStatuses.Expired; + var isTerm = Lease.LeaseType == ApplicationConstants.LeaseTypes.Term; + var isMTM = Lease.LeaseType == ApplicationConstants.LeaseTypes.MonthToMonth; +} +@if (isActive || isNotice || isExpired) { -
-
-
Lease Management
+
+
+
+ Lease Management + @Lease.LeaseType +
- @if (Lease.Status == "Active" || Lease.Status == "MonthToMonth") + @if (isActive) { + @* Renewal only applies to Term leases — MTM continues automatically *@ + @if (isTerm) + { + + } - + @* Convert to MTM only makes sense for Term leases *@ + @if (isTerm) + { + + } } - @if (Lease.Status == "NoticeGiven") + @if (isNotice) {
@@ -36,6 +59,22 @@ Early Termination } + @if (isExpired) + { +
+ + Lease Expired: @Lease.EndDate.ToString("MMM dd, yyyy")
+ The tenant remains in occupancy without a current lease agreement. + Convert to month-to-month or create a new lease. +
+
+ + + }
@@ -43,15 +82,10 @@
@code { - [Parameter] - public Lease Lease { get; set; } = new Lease(); - - [Parameter] - public EventCallback OnShowTerminationNoticeModal { get; set; } - [Parameter] - public EventCallback OnShowEarlyTerminationModal { get; set; } - [Parameter] - public EventCallback OnShowConvertMTMModal { get; set; } - [Parameter] - public EventCallback OnShowMoveOutModal { get; set; } -} \ No newline at end of file + [Parameter] public Lease Lease { get; set; } = new Lease(); + [Parameter] public EventCallback OnShowRenewLeaseModal { get; set; } + [Parameter] public EventCallback OnShowTerminationNoticeModal { get; set; } + [Parameter] public EventCallback OnShowEarlyTerminationModal { get; set; } + [Parameter] public EventCallback OnShowConvertMTMModal { get; set; } + [Parameter] public EventCallback OnShowMoveOutModal { get; set; } +} diff --git a/3-Nine.Shared.UI/Components/Entities/Leases/LeaseListView.razor b/3-Nine.Shared.UI/Components/Entities/Leases/LeaseListView.razor index 4594968..422a8c1 100644 --- a/3-Nine.Shared.UI/Components/Entities/Leases/LeaseListView.razor +++ b/3-Nine.Shared.UI/Components/Entities/Leases/LeaseListView.razor @@ -13,7 +13,7 @@ ShowActive="true" ShowExpiringSoon="true" ShowTotalMonthlyRent="true" /> } - +
+ OnGroupToggled="@HandleGroupByPropertyChanged" + ShowArchivedToggle="true" + ShowArchived="@ShowArchived" + OnShowArchivedToggled="@HandleShowArchivedChanged"> - - - - + @foreach (var status in ApplicationConstants.LeaseStatuses.AllLeaseStatuses) + { + + }
diff --git a/3-Nine.Shared.UI/Components/Entities/Properties/PropertyCard.razor b/3-Nine.Shared.UI/Components/Entities/Properties/PropertyCard.razor index 96afa5a..a678461 100644 --- a/3-Nine.Shared.UI/Components/Entities/Properties/PropertyCard.razor +++ b/3-Nine.Shared.UI/Components/Entities/Properties/PropertyCard.razor @@ -58,6 +58,18 @@ + @if (!ShowArchived && OnArchive.HasDelegate) + { + + } + @if (ShowArchived && OnRestore.HasDelegate) + { + + }
[Parameter] public EventCallback OnDelete { get; set; } + + /// + /// Callback when Archive button is clicked + /// + [Parameter] + public EventCallback OnArchive { get; set; } + + /// + /// Callback when Unarchive button is clicked + /// + [Parameter] + public EventCallback OnRestore { get; set; } + + /// + /// When true, shows Unarchive button instead of Archive; hides Delete + /// + [Parameter] + public bool ShowArchived { get; set; } private string DisplayAddress => string.IsNullOrWhiteSpace(UnitNumber) ? Address @@ -192,6 +222,16 @@ { await OnDelete.InvokeAsync(PropertyId); } + + private async Task HandleArchive() + { + await OnArchive.InvokeAsync(PropertyId); + } + + private async Task HandleRestore() + { + await OnRestore.InvokeAsync(PropertyId); + } private string GetStatusBadgeClass() { diff --git a/3-Nine.Shared.UI/Components/Entities/Properties/PropertyForm.razor b/3-Nine.Shared.UI/Components/Entities/Properties/PropertyForm.razor index 2a36e29..f1c0f3b 100644 --- a/3-Nine.Shared.UI/Components/Entities/Properties/PropertyForm.razor +++ b/3-Nine.Shared.UI/Components/Entities/Properties/PropertyForm.razor @@ -12,11 +12,18 @@ }
-
+
+
+ +
+ + +
+
@@ -79,15 +86,34 @@
+
+ +
+ + +
+
- - - - - - - + @* @if (!Model.IsActive) + { +
Select the reason this property is inactive.
+ } *@ + + @if (Model.IsActive) + { + + + + + } + else + { + + + }
@@ -119,17 +145,6 @@
-
-
-
- - -
-
-
-
@@ -64,7 +65,10 @@ ShowEditDelete="@ShowEditDelete" OnView="@OnView" OnEdit="@OnEdit" - OnDelete="@OnDelete" /> + OnDelete="@OnDelete" + OnArchive="@OnArchive" + OnRestore="@OnRestore" + ShowArchived="@ShowArchived" />
} @@ -154,9 +158,24 @@ else @if (ShowEditDelete) { - + @if (!ShowArchived) + { + + } + @if (!ShowArchived && OnArchive.HasDelegate) + { + + } + @if (ShowArchived && OnRestore.HasDelegate) + { + + }
[Parameter] public EventCallback OnDelete { get; set; } + + /// + /// Callback when Archive button is clicked + /// + [Parameter] + public EventCallback OnArchive { get; set; } + + /// + /// Callback when Unarchive button is clicked + /// + [Parameter] + public EventCallback OnRestore { get; set; } + + /// + /// When true, shows Unarchive button instead of Archive/Edit + /// + [Parameter] + public bool ShowArchived { get; set; } private async Task HandleSearchChanged(ChangeEventArgs e) { @@ -324,6 +361,16 @@ else { await OnDelete.InvokeAsync(propertyId); } + + private async Task HandleArchive(Guid propertyId) + { + await OnArchive.InvokeAsync(propertyId); + } + + private async Task HandleRestore(Guid propertyId) + { + await OnRestore.InvokeAsync(propertyId); + } private string GetStatusBadgeClass(string status) { diff --git a/3-Nine.Shared.UI/Components/Entities/Properties/PropertyMetricsCard.razor b/3-Nine.Shared.UI/Components/Entities/Properties/PropertyMetricsCard.razor index da1b7cb..1e7aae7 100644 --- a/3-Nine.Shared.UI/Components/Entities/Properties/PropertyMetricsCard.razor +++ b/3-Nine.Shared.UI/Components/Entities/Properties/PropertyMetricsCard.razor @@ -1,17 +1,17 @@ @using Nine.Shared.UI.Components.Common
- @if(ShowTotalProperties){ - - } @if(ShowAvailableProperties){ + } + @if(ShowTotalProperties){ + } @if(ShowOccupiedProperties){ +/// Payload for the PropertyExpenseEditModal.OnMarkPaid callback: which +/// ExpenseDue the payment applies to, and the payment details entered by the +/// user. +///
+public record ExpensePaymentRequest(Guid ExpenseDueId, decimal AmountPaid, DateTime PaidOn, string? Notes); diff --git a/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseEditModal.razor b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseEditModal.razor new file mode 100644 index 0000000..0af2ee8 --- /dev/null +++ b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseEditModal.razor @@ -0,0 +1,280 @@ +@using Nine.Core.Entities +@using Nine.Shared.UI.Components.Common +@using Microsoft.Extensions.Options +@namespace Nine.Shared.UI.Components.Entities.PropertyExpenses + + + + @if (Expense != null) + { +
+
+ @Expense.ExpenseType + @Expense.MonthlyAmount.ToString("C")/mo +
+ @if (!string.IsNullOrWhiteSpace(Expense.Description)) + { +
@Expense.Description
+ } +
@Expense.Amount.ToString("C") — @Expense.RecurrencePattern.Frequency
+
Effective: @Expense.EffectiveDate.ToShortDateString()
+
+ + @if (CurrentDue != null) + { +
+
+ Current Due: @CurrentDue.DueDate.ToShortDateString() + @CurrentDue.Status +
+
+ Due @CurrentDue.AmountDue.ToString("C") — Paid @CurrentDue.AmountPaid.ToString("C") + — Balance @CurrentDue.BalanceDue.ToString("C") +
+ +
+ + @if (CurrentDue.WaivedOn == null) + { + + } +
+ + @if (activeAction == "markpaid") + { +
+ +
+ $ + +
+ + + + +
+ + +
+
+ } + + @if (activeAction == "waive") + { +
+ + +
+ + +
+
+ } +
+ } + +
+
+
+ + @if (activeAction == "cancel") + { +
+

+ Sets the end date to today. The expense record is retained permanently for audit and lease reporting. +

+ + +
+ + +
+
+ } +
+
+ + @if (activeAction == "void") + { +
+

+ + This record will be @(SoftDeleteEnabled ? "marked as deleted" : "permanently removed") as if it never existed. +

+ @if (SoftDeleteEnabled) + { + + + } +
+ + +
+
+ } +
+
+ + @if (!string.IsNullOrEmpty(errorMessage)) + { +
@errorMessage
+ } + } +
+ + + +
+ +@code { + [Parameter] public bool IsVisible { get; set; } + [Parameter] public PropertyExpense? Expense { get; set; } + [Parameter] public ExpenseDue? CurrentDue { get; set; } + [Parameter] public bool SoftDeleteEnabled { get; set; } + [Parameter] public EventCallback OnCancelExpense { get; set; } + [Parameter] public EventCallback OnVoidExpense { get; set; } + [Parameter] public EventCallback OnMarkPaid { get; set; } + [Parameter] public EventCallback OnWaiveExpenseDue { get; set; } + [Parameter] public EventCallback OnDismiss { get; set; } + + private string? activeAction; + private string? cancelReason; + private string? voidReason; + private decimal markPaidAmount; + private DateTime markPaidOn = DateTime.Today; + private string? markPaidNotes; + private string? waiveReason; + private bool isSaving; + private string? errorMessage; + + protected override void OnParametersSet() + { + if (!IsVisible) + { + activeAction = null; + cancelReason = null; + voidReason = null; + markPaidNotes = null; + waiveReason = null; + errorMessage = null; + } + } + + private void ShowCancelForm() => activeAction = "cancel"; + private void ShowVoidForm() => activeAction = "void"; + + private void ShowMarkPaidForm() + { + markPaidAmount = CurrentDue?.BalanceDue > 0 ? CurrentDue.BalanceDue : (CurrentDue?.AmountDue ?? 0m); + markPaidOn = DateTime.Today; + activeAction = "markpaid"; + } + + private void ShowWaiveForm() => activeAction = "waive"; + private void ResetActions() => activeAction = null; + + private static string StatusBadgeClass(string status) => status switch + { + "Paid" => "bg-success", + "PartiallyPaid" => "bg-warning text-dark", + "Overpaid" => "bg-info text-dark", + "Waived" => "bg-secondary", + _ => "bg-danger" + }; + + private async Task ConfirmCancel() + { + try + { + isSaving = true; + errorMessage = null; + await OnCancelExpense.InvokeAsync(string.IsNullOrWhiteSpace(cancelReason) ? null : cancelReason.Trim()); + } + catch (Exception ex) + { + errorMessage = $"Error: {ex.Message}"; + } + finally { isSaving = false; } + } + + private async Task ConfirmVoid() + { + try + { + isSaving = true; + errorMessage = null; + await OnVoidExpense.InvokeAsync(); + } + catch (Exception ex) + { + errorMessage = $"Error: {ex.Message}"; + } + finally { isSaving = false; } + } + + private async Task ConfirmMarkPaid() + { + if (CurrentDue == null) return; + + try + { + isSaving = true; + errorMessage = null; + await OnMarkPaid.InvokeAsync(new ExpensePaymentRequest(CurrentDue.Id, markPaidAmount, markPaidOn, markPaidNotes)); + activeAction = null; + } + catch (Exception ex) + { + errorMessage = $"Error: {ex.Message}"; + } + finally { isSaving = false; } + } + + private async Task ConfirmWaive() + { + if (CurrentDue == null || string.IsNullOrWhiteSpace(waiveReason)) return; + + try + { + isSaving = true; + errorMessage = null; + await OnWaiveExpenseDue.InvokeAsync(waiveReason.Trim()); + activeAction = null; + } + catch (Exception ex) + { + errorMessage = $"Error: {ex.Message}"; + } + finally { isSaving = false; } + } + + private async Task HandleDismiss() + { + activeAction = null; + await OnDismiss.InvokeAsync(); + } +} diff --git a/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseFormModel.cs b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseFormModel.cs new file mode 100644 index 0000000..7722b86 --- /dev/null +++ b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseFormModel.cs @@ -0,0 +1,36 @@ +using System.ComponentModel.DataAnnotations; +using Nine.Core.Constants; + +namespace Nine.Shared.UI.Components.Entities.PropertyExpenses; + +/// +/// Form model for adding an expense to a property via the Add Property Expense +/// modal. Frequency and DueDate are always required and explicitly chosen by the +/// user — DueDate is never inferred from EffectiveDate. +/// +public class PropertyExpenseFormModel +{ + [Required(ErrorMessage = "Expense type is required.")] + [StringLength(50)] + public string ExpenseType { get; set; } = ApplicationConstants.PropertyExpenseTypes.Mortgage; + + [StringLength(200)] + public string? Description { get; set; } + + [Required(ErrorMessage = "Amount is required.")] + [Range(0.01, double.MaxValue, ErrorMessage = "Amount must be greater than 0.")] + public decimal Amount { get; set; } + + [Required(ErrorMessage = "Frequency is required.")] + [StringLength(20)] + public string Frequency { get; set; } = ApplicationConstants.ExpenseFrequencies.Monthly; + + /// + /// The date this expense is due, explicitly selected by the user. For + /// recurring expenses, only the day (and month, for Quarterly/Annual) are + /// retained as the recurring cadence; for One-Time expenses, the exact date + /// is used as-is. + /// + [Required(ErrorMessage = "Due date is required.")] + public DateTime DueDate { get; set; } = DateTime.Today; +} diff --git a/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseList.razor b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseList.razor new file mode 100644 index 0000000..b941e70 --- /dev/null +++ b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseList.razor @@ -0,0 +1,71 @@ +@using Nine.Core.Entities +@namespace Nine.Shared.UI.Components.Entities.PropertyExpenses + +
+
+
Property Expenses
+ @if (ShowAddButton) + { + + } +
+
+ @if (Expenses == null || !Expenses.Any()) + { +

No fixed expenses have been added for this property yet.

+ } + else + { +
    + @foreach (var expense in Expenses) + { +
  • +
    +
    @expense.ExpenseType
    + @if (!string.IsNullOrWhiteSpace(expense.Description)) + { +
    @expense.Description
    + } +
    @expense.RecurrencePattern.Frequency
    +
    +
    + @expense.MonthlyAmount.ToString("C")/mo + @if (ShowEditButton) + { + + } +
    +
  • + } +
+
+ Total + @TotalMonthlyAmount.ToString("C")/mo +
+ } +
+
+ +@code { + [Parameter] + public List? Expenses { get; set; } + + [Parameter] + public bool ShowAddButton { get; set; } = true; + + [Parameter] + public bool ShowEditButton { get; set; } = false; + + [Parameter] + public EventCallback OnAddExpense { get; set; } + + [Parameter] + public EventCallback OnEditExpense { get; set; } + + private decimal TotalMonthlyAmount => Expenses?.Sum(e => e.MonthlyAmount) ?? 0m; +} diff --git a/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseModal.razor b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseModal.razor new file mode 100644 index 0000000..84f6045 --- /dev/null +++ b/3-Nine.Shared.UI/Components/Entities/PropertyExpenses/PropertyExpenseModal.razor @@ -0,0 +1,139 @@ +@using Nine.Core.Constants +@using Nine.Shared.UI.Components.Common +@namespace Nine.Shared.UI.Components.Entities.PropertyExpenses + + + + + + + @if (!string.IsNullOrEmpty(ErrorMessage)) + { + + } + +
+ + + @foreach (var type in ApplicationConstants.PropertyExpenseTypes.AllPropertyExpenseTypes) + { + + } + + +
+ +
+ +
+ $ + +
+ +
+ +
+ + + @foreach (var frequency in ApplicationConstants.ExpenseFrequencies.AllExpenseFrequencies) + { + + } + + +
+ This amount will be allocated to a monthly equivalent for reporting purposes. +
+
+ +
+ + + +
+ + @if (Model.Frequency == ApplicationConstants.ExpenseFrequencies.OneTime) + { + The exact date this expense is due. + } + else + { + The day (and month, for quarterly/annual) this expense recurs on going forward. + } +
+ @if (ShowsPriorYearBackfillNotice) + { + + } +
+ +
+ + + +
+ +
+ + +
+
+
+
+ +@code { + [Parameter] + public bool IsVisible { get; set; } + + [Parameter] + public bool IsSaving { get; set; } + + [Parameter] + public string ErrorMessage { get; set; } = string.Empty; + + [Parameter] + public EventCallback OnSave { get; set; } + + [Parameter] + public EventCallback OnCancel { get; set; } + + private PropertyExpenseFormModel Model { get; set; } = new(); + private bool wasVisible; + private DateTime CurrentYearStart => new(DateTime.Today.Year, 1, 1); + private bool ShowsPriorYearBackfillNotice => + Model.Frequency != ApplicationConstants.ExpenseFrequencies.OneTime && + Model.DueDate.Date < CurrentYearStart; + + protected override void OnParametersSet() + { + // Reset to a fresh model only on the transition from hidden -> visible, + // so in-progress input isn't wiped out on unrelated re-renders. + if (IsVisible && !wasVisible) + { + Model = new PropertyExpenseFormModel(); + } + wasVisible = IsVisible; + } + + private async Task HandleValidSubmit() + { + await OnSave.InvokeAsync(Model); + } + + private async Task HandleCancel() + { + await OnCancel.InvokeAsync(); + } +} diff --git a/3-Nine.Shared.UI/Components/Entities/Repairs/RepairDocumentsCard.razor b/3-Nine.Shared.UI/Components/Entities/Repairs/RepairDocumentsCard.razor new file mode 100644 index 0000000..cfa4c9f --- /dev/null +++ b/3-Nine.Shared.UI/Components/Entities/Repairs/RepairDocumentsCard.razor @@ -0,0 +1,231 @@ +@namespace Nine.Shared.UI.Components.Entities.Repairs +@using Nine.Shared.UI.Components.Entities.Documents +@inject DocumentService DocumentService +@inject IJSRuntime JSRuntime + +
+ +
+ +@if (showUploadModal) +{ +
+
+
Upload Document
+ +
+
+ +
+ + + + Anything that supports this repair you'd like to keep on record + — e.g., a receipt, invoice, warranty, user guide, or photo. + +
+
+ + + @if (!string.IsNullOrEmpty(selectedDocumentFileName)) + { + Selected: @selectedDocumentFileName (@selectedDocumentFileSize) + } +
+
+ + +
+
+ + +
+
+
+
+} + +@code { + [Parameter, EditorRequired] + public Guid RepairId { get; set; } + + /// + /// The repair's PropertyId, denormalized onto each uploaded Document so it + /// participates in the central Documents page's property filter/grouping, + /// matching the convention used elsewhere in the system. + /// + [Parameter] + public Guid? PropertyId { get; set; } + + /// + /// Raised with a user-facing message after a successful upload or delete. + /// The host page is responsible for displaying it (e.g., via its own + /// ToastService) — ToastService itself lives in the 4-Nine product + /// project and is not available for injection from Shared.UI. + /// + [Parameter] + public EventCallback OnSuccess { get; set; } + + /// + /// Raised with a user-facing message after a failed upload or delete. + /// + [Parameter] + public EventCallback OnError { get; set; } + + private List repairDocuments = new(); + private bool showUploadModal = false; + private bool isUploadingDocument = false; + private IBrowserFile? selectedDocumentFile; + private string selectedDocumentFileName = string.Empty; + private string selectedDocumentFileSize = string.Empty; + private string documentDescription = string.Empty; + private string selectedDocumentType = ApplicationConstants.DocumentTypes.Receipt; + + protected override async Task OnInitializedAsync() + { + await LoadDocuments(); + } + + private async Task LoadDocuments() + { + repairDocuments = await DocumentService.GetDocumentsByRepairIdAsync(RepairId); + } + + private void ShowUploadModal() + { + showUploadModal = true; + selectedDocumentFile = null; + selectedDocumentFileName = string.Empty; + selectedDocumentFileSize = string.Empty; + documentDescription = string.Empty; + selectedDocumentType = ApplicationConstants.DocumentTypes.Receipt; + } + + private void CancelUpload() + { + showUploadModal = false; + selectedDocumentFile = null; + selectedDocumentFileName = string.Empty; + selectedDocumentFileSize = string.Empty; + documentDescription = string.Empty; + } + + private void HandleRepairDocumentFileSelected(InputFileChangeEventArgs e) + { + selectedDocumentFile = e.File; + selectedDocumentFileName = selectedDocumentFile.Name; + selectedDocumentFileSize = FormatFileSize(selectedDocumentFile.Size); + } + + private async Task HandleUploadRepairDocument() + { + if (selectedDocumentFile == null) return; + + isUploadingDocument = true; + try + { + using var memoryStream = new MemoryStream(); + await selectedDocumentFile.OpenReadStream(maxAllowedSize: 10 * 1024 * 1024).CopyToAsync(memoryStream); // 10MB max + + var document = new Document + { + FileName = selectedDocumentFile.Name, + FileExtension = Path.GetExtension(selectedDocumentFile.Name), + FileData = memoryStream.ToArray(), + FileSize = selectedDocumentFile.Size, + FileType = selectedDocumentFile.ContentType, + DocumentType = selectedDocumentType, + FilePath = string.Empty, + Description = documentDescription ?? string.Empty, + RepairId = RepairId, + PropertyId = PropertyId, + }; + + await DocumentService.CreateAsync(document); + await OnSuccess.InvokeAsync("Document uploaded successfully."); + CancelUpload(); + await LoadDocuments(); + } + catch (Exception ex) + { + await OnError.InvokeAsync($"Error uploading document: {ex.Message}"); + } + finally + { + isUploadingDocument = false; + } + } + + private async Task ViewRepairDocument(Guid documentId) + { + var doc = repairDocuments.FirstOrDefault(d => d.Id == documentId); + if (doc == null) return; + + var base64Data = Convert.ToBase64String(doc.FileData); + await JSRuntime.InvokeVoidAsync("viewFile", base64Data, doc.FileType); + } + + private async Task DownloadRepairDocument(Guid documentId) + { + var doc = repairDocuments.FirstOrDefault(d => d.Id == documentId); + if (doc == null) return; + + await JSRuntime.InvokeVoidAsync("downloadFile", doc.FileName, Convert.ToBase64String(doc.FileData), doc.FileType); + } + + private async Task ConfirmDeleteRepairDocument(Guid documentId) + { + var doc = repairDocuments.FirstOrDefault(d => d.Id == documentId); + if (doc == null) return; + + if (await JSRuntime.InvokeAsync("confirm", $"Are you sure you want to delete '{doc.FileName}'?")) + { + try + { + await DocumentService.DeleteAsync(documentId); + await OnSuccess.InvokeAsync("Document deleted successfully."); + await LoadDocuments(); + } + catch (Exception ex) + { + await OnError.InvokeAsync($"Error deleting document: {ex.Message}"); + } + } + } + + private string FormatFileSize(long bytes) + { + string[] sizes = { "B", "KB", "MB", "GB" }; + double len = bytes; + int order = 0; + while (len >= 1024 && order < sizes.Length - 1) + { + order++; + len = len / 1024; + } + return $"{len:0.##} {sizes[order]}"; + } +} diff --git a/3-Nine.Shared.UI/Components/Entities/Repairs/RepairMetricsCard.razor b/3-Nine.Shared.UI/Components/Entities/Repairs/RepairMetricsCard.razor new file mode 100644 index 0000000..4688461 --- /dev/null +++ b/3-Nine.Shared.UI/Components/Entities/Repairs/RepairMetricsCard.razor @@ -0,0 +1,64 @@ +
+ @if(ShowScheduled){ +
+
+
+
Scheduled
+

@ScheduledCount

+
+
+
+ } + @if(ShowInProgress){ +
+
+
+
In Progress
+

@InProgressCount

+
+
+
+ } + @if(ShowTotalCount){ +
+
+
+
Total
+

@TotalCount

+
+
+
+ } + @if(ShowTotalExpense){ +
+
+
+
Total Expense
+

@TotalExpense.ToString("C")

+
+
+
+ } +
+@code { + [Parameter] + public int ScheduledCount { get; set; } + + [Parameter] + public int InProgressCount { get; set; } + + [Parameter] + public decimal TotalExpense { get; set; } + + [Parameter] + public int TotalCount { get; set; } + + [Parameter] + public bool ShowScheduled { get; set; } = false; + [Parameter] + public bool ShowInProgress { get; set; } = false; + [Parameter] + public bool ShowTotalExpense { get; set; } = false; + [Parameter] + public bool ShowTotalCount { get; set; } = false; +} \ No newline at end of file diff --git a/3-Nine.Shared.UI/Components/Layout/SharedMainLayout.razor.css b/3-Nine.Shared.UI/Components/Layout/SharedMainLayout.razor.css index e6da861..8fee15f 100644 --- a/3-Nine.Shared.UI/Components/Layout/SharedMainLayout.razor.css +++ b/3-Nine.Shared.UI/Components/Layout/SharedMainLayout.razor.css @@ -66,6 +66,8 @@ article.content { height: 100vh; position: sticky; top: 0; + display: flex; + flex-direction: column; } .top-row { diff --git a/3-Nine.Shared.UI/Components/Notifications/NotificationCenter.razor b/3-Nine.Shared.UI/Components/Notifications/NotificationCenter.razor index 5964cc9..f2f6071 100644 --- a/3-Nine.Shared.UI/Components/Notifications/NotificationCenter.razor +++ b/3-Nine.Shared.UI/Components/Notifications/NotificationCenter.razor @@ -645,12 +645,9 @@ SortAndPaginateNotifications(); } - private void ViewNotification(Guid id){ - var notification = notifications.FirstOrDefault(n => n.Id == id); - if (notification != null) - { - // Implement the logic to view the notification details - } + private async Task ViewNotification(Guid id) + { + await OpenMessageModal(id); } private async Task ToggleReadStatus(Guid id) diff --git a/3-Nine.Shared.UI/Components/Notifications/NotificationPreferences.razor b/3-Nine.Shared.UI/Components/Notifications/NotificationPreferences.razor index 1cb104c..c608aa6 100644 --- a/3-Nine.Shared.UI/Components/Notifications/NotificationPreferences.razor +++ b/3-Nine.Shared.UI/Components/Notifications/NotificationPreferences.razor @@ -55,98 +55,6 @@ - -
-
-
- Email Notifications -
- - Coming Soon - -
-
-
- - Email notifications are coming soon! This feature requires email service integration and will be enabled in a future release. -
-
- - -
-
-
- - -
-
-
- SMS Notifications -
- - Coming Soon - -
-
-
- - SMS notifications are coming soon! This feature requires SMS service integration and will be enabled in a future release. -
-
- - -
-
-
- - -
-
-
- Digest Preferences -
- - Coming Soon - -
-
-
- - Digest notifications are coming soon! This feature requires email service integration and will be enabled in a future release. -
- -
-
-
Daily Digest
-
- - -
-
- -
-
Weekly Digest
-
- - -
-
-
-
-
-
@@ -185,13 +93,6 @@ private bool isLoading = true; private bool isSaving = false; - // Helper property for time binding (InputDate doesn't bind TimeSpan directly) - private DateTime DailyDigestTimeValue - { - get => DateTime.Today.Add(preferences?.DailyDigestTime ?? new TimeSpan(9, 0, 0)); - set => preferences!.DailyDigestTime = value.TimeOfDay; - } - protected override async Task OnInitializedAsync() { try @@ -217,14 +118,11 @@ try { - Console.WriteLine($"Saving preferences - EnableInApp: {preferences.EnableInAppNotifications}, EnableEmail: {preferences.EnableEmailNotifications}"); - await NotificationService.UpdateUserPreferencesAsync(preferences); - Console.WriteLine("Preferences saved successfully"); + await NotificationService.UpdateUserPreferencesAsync(preferences); ToastService.ShowSuccess("Notification preferences saved successfully!"); } catch (Exception ex) { - Console.WriteLine($"Error saving preferences: {ex.Message}"); ToastService.ShowError($"Failed to save preferences: {ex.Message}"); } finally @@ -243,21 +141,6 @@ // Reset to defaults preferences.EnableInAppNotifications = true; - preferences.EnableEmailNotifications = true; - preferences.EnableSMSNotifications = false; - preferences.EmailLeaseExpiring = true; - preferences.EmailPaymentDue = true; - preferences.EmailPaymentReceived = true; - preferences.EmailApplicationStatusChange = true; - preferences.EmailMaintenanceUpdate = true; - preferences.EmailInspectionScheduled = true; - preferences.SMSPaymentDue = false; - preferences.SMSMaintenanceEmergency = true; - preferences.SMSLeaseExpiringUrgent = false; - preferences.EnableDailyDigest = false; - preferences.DailyDigestTime = new TimeSpan(9, 0, 0); - preferences.EnableWeeklyDigest = false; - preferences.WeeklyDigestDay = DayOfWeek.Monday; await SavePreferences(); } diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/CreateForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/CreateForm.razor index dd47620..7ae2df3 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/CreateForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/CreateForm.razor @@ -157,7 +157,7 @@
  • - Select an active lease to create an invoice + Select an active, month-to-month, or expired (holdover) lease to create an invoice
  • @@ -203,7 +203,9 @@ private async Task LoadLeases() { var allLeases = await LeaseService.GetAllAsync(); - leases = allLeases.Where(l => l.Status == "Active").ToList(); + leases = allLeases.Where(l => + ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(l.Status) || + l.Status == ApplicationConstants.LeaseStatuses.Expired).ToList(); } private void OnLeaseSelected() diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/EditForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/EditForm.razor index f2ff132..89f190e 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/EditForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/EditForm.razor @@ -122,7 +122,7 @@ else
  • - Balance Due: @((invoiceModel.Amount - invoiceModel.AmountPaid).ToString("C")) + Balance Due: @((invoiceModel.Amount + (invoiceModel.LateFeeAmount ?? 0) - invoiceModel.AmountPaid).ToString("C"))
    @@ -252,6 +252,7 @@ else Description = invoice.Description, Status = invoice.Status, AmountPaid = invoice.AmountPaid, + LateFeeAmount = invoice.LateFeeAmount, PaidOn = invoice.PaidOn, Notes = invoice.Notes }; @@ -380,6 +381,8 @@ else [Range(0, double.MaxValue, ErrorMessage = "Paid amount cannot be negative")] public decimal AmountPaid { get; set; } + public decimal? LateFeeAmount { get; set; } + public DateTime? PaidOn { get; set; } [StringLength(500, ErrorMessage = "Notes cannot exceed 500 characters")] diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ListForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ListForm.razor index 07c5226..c22fe35 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ListForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ListForm.razor @@ -8,9 +8,16 @@

    Invoices

    - +
    +
    + + +
    + +
    @if (invoices == null) @@ -179,10 +186,22 @@ else - - + + } + @if (_showArchived) + { + + } +
    @@ -295,10 +314,22 @@ else - - + + } + @if (_showArchived) + { + + } + @@ -361,6 +392,16 @@ else } + + + + @code { private List? invoices; private List filteredInvoices = new(); @@ -385,6 +426,12 @@ else private int pageSize = 20; private int totalPages = 1; private int totalRecords = 0; + private Guid _pendingId; + private CascadeSummary? _cascade; + private bool _showArchiveModal; + private bool _showDeleteModal; + private bool _isProcessing; + private bool _showArchived; [CascadingParameter] private Task AuthenticationStateTask { get; set; } = default!; @@ -405,7 +452,9 @@ else if (!string.IsNullOrEmpty(userId)) { - invoices = await InvoiceService.GetAllAsync(); + invoices = _showArchived + ? await InvoiceService.GetArchivedAsync() + : await InvoiceService.GetAllAsync(); if (LeaseId.HasValue) { invoices = invoices.Where(i => i.LeaseId == LeaseId.Value).ToList(); @@ -415,6 +464,11 @@ else } } + private async Task RefreshView() + { + await LoadInvoices(); + } + private void FilterInvoices() { if (invoices == null) return; @@ -574,12 +628,48 @@ else Navigation.NavigateTo($"/propertymanagement/invoices/{id}/edit"); } - private async Task DeleteInvoice(Invoice invoice) + private async Task ShowArchiveModal(Guid id) { - if (await JSRuntime.InvokeAsync("confirm", $"Are you sure you want to delete invoice {invoice.InvoiceNumber}?")) - { - await InvoiceService.DeleteAsync(invoice.Id); - await LoadInvoices(); - } + _pendingId = id; + _cascade = await InvoiceService.GetArchiveCascadeSummaryAsync(id); + _showArchiveModal = true; + } + + private async Task ShowDeleteModal(Guid id) + { + _pendingId = id; + _cascade = await InvoiceService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmArchive() + { + _isProcessing = true; + await InvoiceService.ArchiveAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadInvoices(); + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await InvoiceService.DeleteAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadInvoices(); + } + + private async Task UnarchiveInvoice(Guid id) + { + await InvoiceService.RestoreAsync(id); + await LoadInvoices(); + } + + private void CloseModals() + { + _showArchiveModal = false; + _showDeleteModal = false; + _cascade = null; } } \ No newline at end of file diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ViewForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ViewForm.razor index cb02628..8e769dc 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ViewForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Invoices/ViewForm.razor @@ -78,22 +78,31 @@ else
    -
    +
    @invoice.Amount.ToString("C")
    -
    + @if (invoice.LateFeeApplied == true && invoice.LateFeeAmount.HasValue) + { +
    +
    + +
    @invoice.LateFeeAmount.Value.ToString("C")
    +
    +
    + } +
    @invoice.AmountPaid.ToString("C")
    -
    +
    -
    +
    @invoice.BalanceDue.ToString("C")
    diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Leases/CreateForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Leases/CreateForm.razor index 1a4c6ef..e3146b2 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Leases/CreateForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Leases/CreateForm.razor @@ -89,10 +89,20 @@
    +
    + + + @foreach (var type in ApplicationConstants.LeaseTypes.AllLeaseTypes) + { + + } + + +
    - - @foreach (var status in ApplicationConstants.LeaseStatuses.DefaultStatuses) + + @foreach (var status in ApplicationConstants.LeaseStatuses.AllLeaseStatuses) { } @@ -225,7 +235,13 @@ // Set default values leaseModel.StartDate = DateTime.Today; leaseModel.EndDate = DateTime.Today.AddYears(1); - leaseModel.Status = ApplicationConstants.LeaseStatuses.Active; + leaseModel.Status = ApplicationConstants.LeaseStatuses.Pending; + leaseModel.IsActive = true; + } + + private void OnStatusChanged() + { + leaseModel.IsActive = ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(leaseModel.Status); } private async Task OnPropertyChanged() @@ -287,7 +303,6 @@ var lease = new Lease { - PropertyId = leaseModel.PropertyId, TenantId = leaseModel.TenantId, StartDate = leaseModel.StartDate, @@ -295,20 +310,14 @@ MonthlyRent = leaseModel.MonthlyRent, SecurityDeposit = leaseModel.SecurityDeposit, Status = leaseModel.Status, + LeaseType = leaseModel.LeaseType, + IsActive = leaseModel.IsActive, Terms = leaseModel.Terms, Notes = leaseModel.Notes }; await LeaseService.CreateAsync(lease); - // Mark property as unavailable if lease is active - if (leaseModel.Status == ApplicationConstants.LeaseStatuses.Active) - { - property.IsActive = false; - } - - await PropertyService.UpdateAsync(property); - Navigation.NavigateTo("/propertymanagement/properties/" + leaseModel.PropertyId); } catch (Exception ex) @@ -360,7 +369,13 @@ [Required(ErrorMessage = "Status is required")] [StringLength(50)] - public string Status { get; set; } = ApplicationConstants.LeaseStatuses.Active; + public string Status { get; set; } = ApplicationConstants.LeaseStatuses.Pending; + + [Required(ErrorMessage = "Lease type is required")] + [StringLength(50)] + public string LeaseType { get; set; } = ApplicationConstants.LeaseTypes.Term; + + public bool IsActive { get; set; } = true; [StringLength(1000, ErrorMessage = "Terms cannot exceed 1000 characters")] public string Terms { get; set; } = string.Empty; diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Leases/EditForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Leases/EditForm.razor index 9d5cae0..bc5d4fb 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Leases/EditForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Leases/EditForm.razor @@ -89,13 +89,23 @@ else
    +
    + + + @foreach (var type in ApplicationConstants.LeaseTypes.AllLeaseTypes) + { + + } + + +
    - - - - - + + @foreach (var status in ApplicationConstants.LeaseStatuses.AllLeaseStatuses) + { + + }
    @@ -215,47 +225,34 @@ else MonthlyRent = lease.MonthlyRent, SecurityDeposit = lease.SecurityDeposit, Status = lease.Status, + LeaseType = lease.LeaseType, + IsActive = lease.IsActive, Terms = lease.Terms, }; } private async Task UpdateLease() { + if (lease == null) + { + errorMessage = "Lease not found."; + return; + } try { isSubmitting = true; errorMessage = string.Empty; successMessage = string.Empty; - var oldStatus = lease!.Status; - // Update lease with form data lease.StartDate = leaseModel.StartDate; lease.EndDate = leaseModel.EndDate; lease.MonthlyRent = leaseModel.MonthlyRent; lease.SecurityDeposit = leaseModel.SecurityDeposit; lease.Status = leaseModel.Status; + lease.LeaseType = leaseModel.LeaseType; + lease.IsActive = leaseModel.IsActive; lease.Terms = leaseModel.Terms; - - // Update property availability based on lease status change - if (lease.Property != null && oldStatus != leaseModel.Status) - { - if (leaseModel.Status == "Active") - { - lease.Property.IsActive = false; - } - else if (oldStatus == "Active" && leaseModel.Status != "Active") - { - // Check if there are other active leases for this property - var activeLeases = await LeaseService.GetActiveLeasesByPropertyIdAsync(lease.PropertyId); - var otherActiveLeases = activeLeases.Any(l => l.PropertyId == lease.PropertyId && l.Id != LeaseId && l.Status == "Active"); - - if (!otherActiveLeases) - { - lease.Property.IsActive = true; - } - } - } await LeaseService.UpdateAsync(lease); successMessage = "Lease updated successfully!"; @@ -273,6 +270,7 @@ else private void OnStatusChanged() { + leaseModel.IsActive = ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(leaseModel.Status); statusChangeWarning = true; StateHasChanged(); } @@ -298,18 +296,6 @@ else { try { - // If deleting an active lease, make property available - if (lease.Status == "Active" && lease.Property != null) - { - var otherActiveLeases = await LeaseService.GetActiveLeasesByPropertyIdAsync(lease.PropertyId); - var otherActiveLeasesExist = otherActiveLeases.Any(l => l.Id != LeaseId && l.Status == "Active"); - - if (!otherActiveLeasesExist) - { - lease.Property.IsActive = true; - } - } - await LeaseService.DeleteAsync(lease.Id); Navigation.NavigateTo("/propertymanagement/leases"); } @@ -337,7 +323,13 @@ else [Required(ErrorMessage = "Status is required")] [StringLength(50)] - public string Status { get; set; } = "Active"; + public string Status { get; set; } = ApplicationConstants.LeaseStatuses.Pending; + + [Required(ErrorMessage = "Lease type is required")] + [StringLength(50)] + public string LeaseType { get; set; } = ApplicationConstants.LeaseTypes.Term; + + public bool IsActive { get; set; } = true; [StringLength(5000, ErrorMessage = "Terms cannot exceed 2000 characters")] public string Terms { get; set; } = string.Empty; diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Leases/ListForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Leases/ListForm.razor index bba9c25..514351b 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Leases/ListForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Leases/ListForm.razor @@ -52,7 +52,7 @@ }
    - +
    @if (leases == null) {
    @@ -114,7 +114,7 @@ else OnView="@HandleView" OnEdit="@HandleEdit" OnDelete="@HandleDelete" /> - +
    @if (totalPages > 1 && !groupByProperty) { @if (isLoading) @@ -137,9 +146,17 @@ else @request.ScheduledOn?.ToString("MMM dd") @request.DaysOpen days - +
    + + + +
    } @@ -212,6 +229,21 @@ else + @if (!_showArchived) + { + + } + @if (_showArchived) + { + + } +
    @@ -231,6 +263,16 @@ else
    } + + + + @code { private List allRequests = new(); private List filteredRequests = new(); @@ -245,6 +287,12 @@ else private string currentTypeFilter = ""; private bool isLoading = true; + private bool _showArchived; + private Guid _pendingId; + private CascadeSummary? _cascade; + private bool _showArchiveModal; + private bool _showDeleteModal; + private bool _isProcessing; [Parameter] [SupplyParameterFromQuery] @@ -260,7 +308,9 @@ else isLoading = true; try { - allRequests = await MaintenanceService.GetAllAsync(); + allRequests = _showArchived + ? await MaintenanceService.GetArchivedAsync() + : await MaintenanceService.GetAllAsync(); if (PropertyId.HasValue) { @@ -328,6 +378,53 @@ else ApplyFilters(); } + private async Task RefreshView() { await LoadData(); } + + private async Task ShowArchiveModal(Guid id) + { + _pendingId = id; + _cascade = await MaintenanceService.GetArchiveCascadeSummaryAsync(id); + _showArchiveModal = true; + } + + private async Task ShowDeleteModal(Guid id) + { + _pendingId = id; + _cascade = await MaintenanceService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmArchive() + { + _isProcessing = true; + await MaintenanceService.ArchiveAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadData(); + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await MaintenanceService.DeleteAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadData(); + } + + private async Task UnarchiveRequest(Guid id) + { + await MaintenanceService.RestoreAsync(id); + await LoadData(); + } + + private void CloseModals() + { + _showArchiveModal = false; + _showDeleteModal = false; + _cascade = null; + } + private void CreateNew() { NavigationManager.NavigateTo("/propertymanagement/maintenance/create"); diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Payments/ListForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Payments/ListForm.razor index 50f3dd4..3642c65 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Payments/ListForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Payments/ListForm.razor @@ -1,15 +1,22 @@ @using Nine.Core.Entities +@using Nine.Application.Services @using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Forms @inject NavigationManager Navigation @inject PaymentService PaymentService -@inject IJSRuntime JSRuntime

    Payments

    - +
    +
    + + +
    + +
    @if (payments == null) @@ -154,10 +161,22 @@ else - - + + } + @if (_showArchived) + { + + } +
    @@ -223,10 +242,22 @@ else - - + + } + @if (_showArchived) + { + + } +
    @@ -289,6 +320,16 @@ else
    } + + + + @code { private List? payments; private List filteredPayments = new(); @@ -313,6 +354,12 @@ else private int pageSize = 20; private int totalPages = 1; private int totalRecords = 0; + private Guid _pendingId; + private CascadeSummary? _cascade; + private bool _showArchiveModal; + private bool _showDeleteModal; + private bool _isProcessing; + private bool _showArchived; [CascadingParameter] private Task AuthenticationStateTask { get; set; } = default!; @@ -322,6 +369,11 @@ else await LoadPayments(); } + private async Task RefreshView() + { + await LoadPayments(); + } + private async Task LoadPayments() { var authState = await AuthenticationStateTask; @@ -329,7 +381,9 @@ else if (!string.IsNullOrEmpty(userId)) { - payments = await PaymentService.GetPaymentsWithRelationsAsync(); + payments = _showArchived + ? await PaymentService.GetArchivedAsync() + : await PaymentService.GetPaymentsWithRelationsAsync(); FilterPayments(); UpdateStatistics(); } @@ -475,10 +529,51 @@ else private async Task DeletePayment(Payment payment) { - if (await JSRuntime.InvokeAsync("confirm", $"Are you sure you want to delete this payment of {payment.Amount:C}?")) - { - await PaymentService.DeleteAsync(payment.Id); - await LoadPayments(); - } + await ShowDeleteModal(payment.Id); + } + + private async Task ShowArchiveModal(Guid id) + { + _pendingId = id; + _cascade = await PaymentService.GetArchiveCascadeSummaryAsync(id); + _showArchiveModal = true; + } + + private async Task ShowDeleteModal(Guid id) + { + _pendingId = id; + _cascade = await PaymentService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmArchive() + { + _isProcessing = true; + await PaymentService.ArchiveAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadPayments(); + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await PaymentService.DeleteAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadPayments(); + } + + private async Task UnarchivePayment(Guid id) + { + await PaymentService.RestoreAsync(id); + await LoadPayments(); + } + + private void CloseModals() + { + _showArchiveModal = false; + _showDeleteModal = false; + _cascade = null; } } diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Properties/PropertyCreateForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Properties/PropertyCreateForm.razor index b4f8e87..94c4814 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Properties/PropertyCreateForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Properties/PropertyCreateForm.razor @@ -1,8 +1,12 @@ @using Nine.Core.Constants @using Nine.Core.Entities @using Nine.Shared.UI.Components.Entities.Properties +@using Nine.Shared.UI.Components.Entities.PropertyExpenses +@using Microsoft.Extensions.Options @inject NavigationManager Navigation @inject PropertyService PropertyService +@inject PropertyExpenseService PropertyExpenseService +@inject IOptions AppSettings @namespace Nine.Shared.UI.Features.PropertyManagement.Properties
    @@ -23,12 +27,39 @@
    +
    + +
    + + + + @code { private PropertyFormModel propertyModel = new(); private bool isSubmitting = false; private string errorMessage = string.Empty; + private bool showExpenseModal = false; + private bool showEditExpenseModal = false; + private PropertyExpense? selectedExpense; + private List pendingExpenses = new(); + private Dictionary pendingExpenseDueDates = new(); private async Task SaveProperty(PropertyFormModel model) { @@ -52,11 +83,81 @@ IsActive = model.IsActive, }; - await PropertyService.CreateAsync(property); + var createdProperty = await PropertyService.CreateAsync(property); + + // Persist any expenses queued before the property existed. + foreach (var expense in pendingExpenses) + { + expense.PropertyId = createdProperty.Id; + var dueDate = pendingExpenseDueDates.TryGetValue(expense.Id, out var d) ? d : DateTime.Today; + await PropertyExpenseService.CreateExpenseAsync(expense, dueDate); + } + isSubmitting = false; Navigation.NavigateTo("/propertymanagement/properties"); } + private void ShowExpenseModal() + { + showExpenseModal = true; + } + + private void CloseExpenseModal() + { + showExpenseModal = false; + } + + private void AddPendingExpense(PropertyExpenseFormModel model) + { + var expense = new PropertyExpense + { + Id = Guid.NewGuid(), + ExpenseType = model.ExpenseType, + Description = model.Description ?? string.Empty, + Amount = model.Amount, + EffectiveDate = model.DueDate, + RecurrencePattern = new RecurrencePattern { Frequency = model.Frequency }, + }; + pendingExpenses.Add(expense); + pendingExpenseDueDates[expense.Id] = model.DueDate; + showExpenseModal = false; + } + + private void RemovePendingExpense(Guid id) + { + pendingExpenses.RemoveAll(e => e.Id == id); + pendingExpenseDueDates.Remove(id); + } + + private void ShowEditExpenseModal(PropertyExpense expense) + { + selectedExpense = expense; + showEditExpenseModal = true; + } + + private void CloseEditExpenseModal() + { + showEditExpenseModal = false; + selectedExpense = null; + } + + // For pending (not yet saved) expenses, both Cancel and Void just remove from the list. + private Task HandleCancelPendingExpense(string? reason) + { + if (selectedExpense != null) + pendingExpenses.RemoveAll(e => e.Id == selectedExpense.Id); + CloseEditExpenseModal(); + return Task.CompletedTask; + } + + private Task HandleVoidPendingExpense() + { + if (selectedExpense != null) + pendingExpenses.RemoveAll(e => e.Id == selectedExpense.Id); + CloseEditExpenseModal(); + return Task.CompletedTask; + } + private void Cancel() { Navigation.NavigateTo("/propertymanagement/properties"); diff --git a/3-Nine.Shared.UI/Features/PropertyManagement/Tenants/ListForm.razor b/3-Nine.Shared.UI/Features/PropertyManagement/Tenants/ListForm.razor index 92548df..f6947a9 100644 --- a/3-Nine.Shared.UI/Features/PropertyManagement/Tenants/ListForm.razor +++ b/3-Nine.Shared.UI/Features/PropertyManagement/Tenants/ListForm.razor @@ -9,14 +9,51 @@

    Tenants

    - @if (!isReadOnlyUser) - { - - } +
    + @if (!isReadOnlyUser) + { + + } +
    - +
    +
    +
    +
    +
    +
    Active Tenants
    +

    @activeTenantsCount

    +
    +
    +
    +
    +
    +
    +
    Without Lease
    +

    @tenantsWithoutLeaseCount

    +
    +
    +
    +
    +
    +
    +
    Total Tenants
    +

    @filteredTenants.Count

    +
    +
    +
    +
    +
    +
    +
    New This Month
    +

    @newThisMonthCount

    +
    +
    +
    +
    +
    @if (tenants == null) {
    @@ -25,17 +62,9 @@
    } -else if (!tenants.Any()) -{ -
    -

    No Tenants Found

    -

    Get started by converting a Prospective Tenant to your first tenant in the system.

    - -
    -} else { -
    +
    @@ -52,54 +81,52 @@ else
    -
    +
    -
    +
    -
    - -
    -
    -
    -
    -
    Active Tenants
    -

    @activeTenantsCount

    -
    -
    -
    -
    -
    -
    -
    Without Lease
    -

    @tenantsWithoutLeaseCount

    -
    -
    -
    -
    -
    -
    -
    Total Tenants
    -

    @filteredTenants.Count

    -
    +
    +
    + +
    -
    -
    -
    -
    -
    New This Month
    -

    @newThisMonthCount

    -
    +
    + +
    +
    + @if (!tenants.Any()) + { + @if (_showArchived) + { +
    +

    No Archived Tenants

    +

    No archived tenants found.

    +
    + } + else + { +
    +

    No Tenants Found

    +

    Get started by converting a Prospective Tenant to your first tenant in the system.

    + +
    + } + } + else + {
    @@ -165,6 +192,101 @@ else + @if (_groupByProperty) + { + @foreach (var group in _groupedTenants) + { + + @group.Key @group.Count() + + @foreach (var tenant in group) + { + + +
    + @tenant.FullName + @if (!string.IsNullOrEmpty(tenant.Notes)) + { +
    + @tenant.Notes + } +
    + + @tenant.Email + @tenant.PhoneNumber + + @if (tenant.DateOfBirth.HasValue) + { + @tenant.DateOfBirth.Value.ToString("MMM dd, yyyy") + } + else + { + Not provided + } + + + @if (tenant.IsActive) + { + Active + } + else + { + Inactive + } + + @tenant.CreatedOn.ToString("MMM dd, yyyy") + + @{ + var activeLease = tenant.Leases?.FirstOrDefault(l => l.Status == "Active"); + var latestLease = tenant.Leases?.OrderByDescending(l => l.StartDate).FirstOrDefault(); + } + @if (activeLease != null) + { + Active + } + else if (latestLease != null) + { + @latestLease.Status + } + else + { + No Lease + } + + +
    + + @if (!isReadOnlyUser) + { + @if (!_showArchived) + { + + + } + @if (_showArchived) + { + + } + + } +
    + + + } + } + } + else + { @foreach (var tenant in pagedTenants) { @@ -226,10 +348,22 @@ else @if (!isReadOnlyUser) { - - + + } + @if (_showArchived) + { + + } + } @@ -237,11 +371,12 @@ else } + }
    - @if (totalPages > 1) + @if (!_groupByProperty && totalPages > 1) {
    @@ -288,6 +423,54 @@ else }
    + } +} + + + + + +@if (_showCannotProceedModal) +{ + } @code { @@ -306,6 +489,16 @@ else private int pageSize = 20; private int totalPages = 1; private int totalRecords = 0; + private Guid _pendingId; + private CascadeSummary? _cascade; + private bool _showArchiveModal; + private bool _showDeleteModal; + private bool _showCannotProceedModal; + private List _cannotProceedReasons = new(); + private bool _isProcessing; + private bool _showArchived; + private bool _groupByProperty; + private IEnumerable> _groupedTenants = Enumerable.Empty>(); [CascadingParameter] private Task AuthenticationStateTask { get; set; } = default!; @@ -325,7 +518,16 @@ else private async Task LoadTenants() { - tenants = await TenantService.GetAllAsync(); + tenants = _showArchived + ? await TenantService.GetArchivedTenantsWithRelationsAsync() + : await TenantService.GetTenantsWithRelationsAsync(); + } + + private async Task RefreshView() + { + await LoadTenants(); + FilterTenants(); + CalculateMetrics(); } private void CreateTenant() @@ -343,16 +545,66 @@ else Navigation.NavigateTo($"/propertymanagement/tenants/{id}/edit"); } - private async Task DeleteTenant(Guid id) + private async Task ShowArchiveModal(Guid id) { - var tenant = await TenantService.GetByIdAsync(id); - if (tenant != null) + _pendingId = id; + bool hasActiveLeases = await TenantService.HasActiveLeasesAsync(id); + if (hasActiveLeases) { - await TenantService.DeleteAsync(tenant.Id); - await LoadTenants(); - FilterTenants(); - CalculateMetrics(); + _cannotProceedReasons = new List { "Tenant has one or more active leases." }; + _showCannotProceedModal = true; + return; } + _cascade = await TenantService.GetArchiveCascadeSummaryAsync(id); + _showArchiveModal = true; + } + + private async Task ShowDeleteModal(Guid id) + { + _pendingId = id; + _cascade = await TenantService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmArchiveWithLeases() + { + _isProcessing = true; + await TenantService.ArchiveWithLeasesAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await RefreshView(); + } + + private async Task ConfirmArchiveTenantOnly() + { + _isProcessing = true; + await TenantService.ArchiveAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await RefreshView(); + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await TenantService.DeleteAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await RefreshView(); + } + + private async Task UnarchiveTenant(Guid id) + { + await TenantService.RestoreAsync(id); + await RefreshView(); + } + + private void CloseModals() + { + _showArchiveModal = false; + _showDeleteModal = false; + _showCannotProceedModal = false; + _cascade = null; } private void FilterTenants() @@ -371,12 +623,26 @@ else t.PhoneNumber.Contains(searchTerm, StringComparison.OrdinalIgnoreCase) || t.Notes.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) && (string.IsNullOrEmpty(selectedLeaseStatus) || GetTenantLeaseStatus(t) == selectedLeaseStatus) && - (selectedTenantStatus == 1 ? t.IsActive : !t.IsActive) + (_showArchived || (selectedTenantStatus == 1 ? t.IsActive : !t.IsActive)) ).ToList(); SortTenants(); UpdatePagination(); CalculateMetrics(); + + if (_groupByProperty) + { + _groupedTenants = filteredTenants + .GroupBy(t => + t.Leases?.FirstOrDefault(l => l.Status == "Active")?.Property?.Address ?? + t.Leases?.OrderByDescending(l => l.StartDate).FirstOrDefault()?.Property?.Address ?? + "No Property") + .OrderBy(g => g.Key); + } + else + { + _groupedTenants = Enumerable.Empty>(); + } } private string GetTenantLeaseStatus(Tenant tenant) diff --git a/3-Nine.Shared.UI/Nine.Shared.UI.csproj.lscache b/3-Nine.Shared.UI/Nine.Shared.UI.csproj.lscache new file mode 100644 index 0000000..9536d1f --- /dev/null +++ b/3-Nine.Shared.UI/Nine.Shared.UI.csproj.lscache @@ -0,0 +1,645 @@ +version=1 + +# This file caches language service data to improve the performance of C# Dev Kit. +# It is not intended for manual editing. It can safely be deleted and will be +# regenerated automatically. For more information, see https://aka.ms/lscache +# +# To control where cache files are stored, use the following VS Code setting: +# "dotnet.projectsystem.cacheInProjectFolder": true + +[project] +language=C# +primary +lastDtbSucceeded + +[properties] +AssemblyName=Nine.Shared.UI +CommandLineArgsForDesignTimeEvaluation=-langversion:14.0 -define:TRACE +CompilerGeneratedFilesOutputPath= +MaxSupportedLangVersion=14.0 +ProjectAssetsFile=obj/project.assets.json +RootNamespace=Nine.Shared.UI +RunAnalyzers= +RunAnalyzersDuringLiveAnalysis= +SolutionPath=../Nine.sln +TargetFrameworkIdentifier=.NETCoreApp +TargetPath=bin/Debug/net10.0/Nine.Shared.UI.dll +TargetRefPath=obj/Debug/net10.0/ref/Nine.Shared.UI.dll +TemporaryDependencyNodeTargetIdentifier=net10.0 + +[commandLineArguments] +/noconfig +/unsafe- +/checked- +/nowarn:1701,1702,1701,1702 +/fullpaths +/nostdlib+ +/errorreport:prompt +/warn:10 +/define:TRACE;DEBUG;NET;NET10_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NET8_0_OR_GREATER;NET9_0_OR_GREATER;NET10_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER +/highentropyva+ +/nullable:enable +/features:"InterceptorsNamespaces=;Microsoft.Extensions.Validation.Generated" +/debug+ +/debug:portable +/filealign:512 +/optimize- +/out:obj/Debug/net10.0/Nine.Shared.UI.dll +/refout:obj/Debug/net10.0/refint/Nine.Shared.UI.dll +/target:library +/warnaserror- +/utf8output +/deterministic+ +/langversion:14.0 +/features:use-roslyn-tokenizer=true +/warnaserror+:NU1605,SYSLIB0011 + +[sourceFiles] +Components/Common/ + ModalPosition.cs + ModalSize.cs +Components/Entities/ + Organizations/OrganizationViewModel.cs + OrganizationUsers/OrganizationUserViewModel.cs + Properties/ + PropertyFormModel.cs + PropertyListViewMode.cs +obj/Debug/net10.0/ + .NETCoreApp,Version=v10.0.AssemblyAttributes.cs + EmbeddedAttribute.cs + Nine.Shared.UI.AssemblyInfo.cs + Nine.Shared.UI.GlobalUsings.g.cs + ValidatableTypeAttribute.cs + +[metadataReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.AspNetCore.Antiforgery.dll + Microsoft.AspNetCore.Authentication.Abstractions.dll + Microsoft.AspNetCore.Authentication.BearerToken.dll + Microsoft.AspNetCore.Authentication.Cookies.dll + Microsoft.AspNetCore.Authentication.Core.dll + Microsoft.AspNetCore.Authentication.dll + Microsoft.AspNetCore.Authentication.OAuth.dll + Microsoft.AspNetCore.Authorization.dll + Microsoft.AspNetCore.Authorization.Policy.dll + Microsoft.AspNetCore.Components.Authorization.dll + Microsoft.AspNetCore.Components.dll + Microsoft.AspNetCore.Components.Endpoints.dll + Microsoft.AspNetCore.Components.Forms.dll + Microsoft.AspNetCore.Components.Server.dll + Microsoft.AspNetCore.Components.Web.dll + Microsoft.AspNetCore.Connections.Abstractions.dll + Microsoft.AspNetCore.CookiePolicy.dll + Microsoft.AspNetCore.Cors.dll + Microsoft.AspNetCore.Cryptography.Internal.dll + Microsoft.AspNetCore.Cryptography.KeyDerivation.dll + Microsoft.AspNetCore.DataProtection.Abstractions.dll + Microsoft.AspNetCore.DataProtection.dll + Microsoft.AspNetCore.DataProtection.Extensions.dll + Microsoft.AspNetCore.Diagnostics.Abstractions.dll + Microsoft.AspNetCore.Diagnostics.dll + Microsoft.AspNetCore.Diagnostics.HealthChecks.dll + Microsoft.AspNetCore.dll + Microsoft.AspNetCore.HostFiltering.dll + Microsoft.AspNetCore.Hosting.Abstractions.dll + Microsoft.AspNetCore.Hosting.dll + Microsoft.AspNetCore.Hosting.Server.Abstractions.dll + Microsoft.AspNetCore.Html.Abstractions.dll + Microsoft.AspNetCore.Http.Abstractions.dll + Microsoft.AspNetCore.Http.Connections.Common.dll + Microsoft.AspNetCore.Http.Connections.dll + Microsoft.AspNetCore.Http.dll + Microsoft.AspNetCore.Http.Extensions.dll + Microsoft.AspNetCore.Http.Features.dll + Microsoft.AspNetCore.Http.Results.dll + Microsoft.AspNetCore.HttpLogging.dll + Microsoft.AspNetCore.HttpOverrides.dll + Microsoft.AspNetCore.HttpsPolicy.dll + Microsoft.AspNetCore.Identity.dll + Microsoft.AspNetCore.Localization.dll + Microsoft.AspNetCore.Localization.Routing.dll + Microsoft.AspNetCore.Metadata.dll + Microsoft.AspNetCore.Mvc.Abstractions.dll + Microsoft.AspNetCore.Mvc.ApiExplorer.dll + Microsoft.AspNetCore.Mvc.Core.dll + Microsoft.AspNetCore.Mvc.Cors.dll + Microsoft.AspNetCore.Mvc.DataAnnotations.dll + Microsoft.AspNetCore.Mvc.dll + Microsoft.AspNetCore.Mvc.Formatters.Json.dll + Microsoft.AspNetCore.Mvc.Formatters.Xml.dll + Microsoft.AspNetCore.Mvc.Localization.dll + Microsoft.AspNetCore.Mvc.Razor.dll + Microsoft.AspNetCore.Mvc.RazorPages.dll + Microsoft.AspNetCore.Mvc.TagHelpers.dll + Microsoft.AspNetCore.Mvc.ViewFeatures.dll + Microsoft.AspNetCore.OutputCaching.dll + Microsoft.AspNetCore.RateLimiting.dll + Microsoft.AspNetCore.Razor.dll + Microsoft.AspNetCore.Razor.Runtime.dll + Microsoft.AspNetCore.RequestDecompression.dll + Microsoft.AspNetCore.ResponseCaching.Abstractions.dll + Microsoft.AspNetCore.ResponseCaching.dll + Microsoft.AspNetCore.ResponseCompression.dll + Microsoft.AspNetCore.Rewrite.dll + Microsoft.AspNetCore.Routing.Abstractions.dll + Microsoft.AspNetCore.Routing.dll + Microsoft.AspNetCore.Server.HttpSys.dll + Microsoft.AspNetCore.Server.IIS.dll + Microsoft.AspNetCore.Server.IISIntegration.dll + Microsoft.AspNetCore.Server.Kestrel.Core.dll + Microsoft.AspNetCore.Server.Kestrel.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll + Microsoft.AspNetCore.Session.dll + Microsoft.AspNetCore.SignalR.Common.dll + Microsoft.AspNetCore.SignalR.Core.dll + Microsoft.AspNetCore.SignalR.dll + Microsoft.AspNetCore.SignalR.Protocols.Json.dll + Microsoft.AspNetCore.StaticAssets.dll + Microsoft.AspNetCore.StaticFiles.dll + Microsoft.AspNetCore.WebSockets.dll + Microsoft.AspNetCore.WebUtilities.dll + Microsoft.Extensions.Caching.Abstractions.dll + Microsoft.Extensions.Caching.Memory.dll + Microsoft.Extensions.Configuration.Abstractions.dll + Microsoft.Extensions.Configuration.Binder.dll + Microsoft.Extensions.Configuration.CommandLine.dll + Microsoft.Extensions.Configuration.dll + Microsoft.Extensions.Configuration.EnvironmentVariables.dll + Microsoft.Extensions.Configuration.FileExtensions.dll + Microsoft.Extensions.Configuration.Ini.dll + Microsoft.Extensions.Configuration.Json.dll + Microsoft.Extensions.Configuration.KeyPerFile.dll + Microsoft.Extensions.Configuration.UserSecrets.dll + Microsoft.Extensions.Configuration.Xml.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + Microsoft.Extensions.DependencyInjection.dll + Microsoft.Extensions.Diagnostics.Abstractions.dll + Microsoft.Extensions.Diagnostics.dll + Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll + Microsoft.Extensions.Diagnostics.HealthChecks.dll + Microsoft.Extensions.Features.dll + Microsoft.Extensions.FileProviders.Abstractions.dll + Microsoft.Extensions.FileProviders.Composite.dll + Microsoft.Extensions.FileProviders.Embedded.dll + Microsoft.Extensions.FileProviders.Physical.dll + Microsoft.Extensions.FileSystemGlobbing.dll + Microsoft.Extensions.Hosting.Abstractions.dll + Microsoft.Extensions.Hosting.dll + Microsoft.Extensions.Http.dll + Microsoft.Extensions.Identity.Core.dll + Microsoft.Extensions.Identity.Stores.dll + Microsoft.Extensions.Localization.Abstractions.dll + Microsoft.Extensions.Localization.dll + Microsoft.Extensions.Logging.Abstractions.dll + Microsoft.Extensions.Logging.Configuration.dll + Microsoft.Extensions.Logging.Console.dll + Microsoft.Extensions.Logging.Debug.dll + Microsoft.Extensions.Logging.dll + Microsoft.Extensions.Logging.EventLog.dll + Microsoft.Extensions.Logging.EventSource.dll + Microsoft.Extensions.Logging.TraceSource.dll + Microsoft.Extensions.ObjectPool.dll + Microsoft.Extensions.Options.ConfigurationExtensions.dll + Microsoft.Extensions.Options.DataAnnotations.dll + Microsoft.Extensions.Options.dll + Microsoft.Extensions.Primitives.dll + Microsoft.Extensions.Validation.dll + Microsoft.Extensions.WebEncoders.dll + Microsoft.JSInterop.dll + Microsoft.Net.Http.Headers.dll + System.Diagnostics.EventLog.dll + System.Formats.Cbor.dll + System.Security.Cryptography.Xml.dll + System.Threading.RateLimiting.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.CSharp.dll + Microsoft.VisualBasic.Core.dll + Microsoft.VisualBasic.dll + Microsoft.Win32.Primitives.dll + Microsoft.Win32.Registry.dll + mscorlib.dll + netstandard.dll + System.AppContext.dll + System.Buffers.dll + System.Collections.Concurrent.dll + System.Collections.dll + System.Collections.Immutable.dll + System.Collections.NonGeneric.dll + System.Collections.Specialized.dll + System.ComponentModel.Annotations.dll + System.ComponentModel.DataAnnotations.dll + System.ComponentModel.dll + System.ComponentModel.EventBasedAsync.dll + System.ComponentModel.Primitives.dll + System.ComponentModel.TypeConverter.dll + System.Configuration.dll + System.Console.dll + System.Core.dll + System.Data.Common.dll + System.Data.DataSetExtensions.dll + System.Data.dll + System.Diagnostics.Contracts.dll + System.Diagnostics.Debug.dll + System.Diagnostics.DiagnosticSource.dll + System.Diagnostics.FileVersionInfo.dll + System.Diagnostics.Process.dll + System.Diagnostics.StackTrace.dll + System.Diagnostics.TextWriterTraceListener.dll + System.Diagnostics.Tools.dll + System.Diagnostics.TraceSource.dll + System.Diagnostics.Tracing.dll + System.dll + System.Drawing.dll + System.Drawing.Primitives.dll + System.Dynamic.Runtime.dll + System.Formats.Asn1.dll + System.Formats.Tar.dll + System.Globalization.Calendars.dll + System.Globalization.dll + System.Globalization.Extensions.dll + System.IO.Compression.Brotli.dll + System.IO.Compression.dll + System.IO.Compression.FileSystem.dll + System.IO.Compression.ZipFile.dll + System.IO.dll + System.IO.FileSystem.AccessControl.dll + System.IO.FileSystem.dll + System.IO.FileSystem.DriveInfo.dll + System.IO.FileSystem.Primitives.dll + System.IO.FileSystem.Watcher.dll + System.IO.IsolatedStorage.dll + System.IO.MemoryMappedFiles.dll + System.IO.Pipelines.dll + System.IO.Pipes.AccessControl.dll + System.IO.Pipes.dll + System.IO.UnmanagedMemoryStream.dll + System.Linq.AsyncEnumerable.dll + System.Linq.dll + System.Linq.Expressions.dll + System.Linq.Parallel.dll + System.Linq.Queryable.dll + System.Memory.dll + System.Net.dll + System.Net.Http.dll + System.Net.Http.Json.dll + System.Net.HttpListener.dll + System.Net.Mail.dll + System.Net.NameResolution.dll + System.Net.NetworkInformation.dll + System.Net.Ping.dll + System.Net.Primitives.dll + System.Net.Quic.dll + System.Net.Requests.dll + System.Net.Security.dll + System.Net.ServerSentEvents.dll + System.Net.ServicePoint.dll + System.Net.Sockets.dll + System.Net.WebClient.dll + System.Net.WebHeaderCollection.dll + System.Net.WebProxy.dll + System.Net.WebSockets.Client.dll + System.Net.WebSockets.dll + System.Numerics.dll + System.Numerics.Vectors.dll + System.ObjectModel.dll + System.Reflection.DispatchProxy.dll + System.Reflection.dll + System.Reflection.Emit.dll + System.Reflection.Emit.ILGeneration.dll + System.Reflection.Emit.Lightweight.dll + System.Reflection.Extensions.dll + System.Reflection.Metadata.dll + System.Reflection.Primitives.dll + System.Reflection.TypeExtensions.dll + System.Resources.Reader.dll + System.Resources.ResourceManager.dll + System.Resources.Writer.dll + System.Runtime.CompilerServices.Unsafe.dll + System.Runtime.CompilerServices.VisualC.dll + System.Runtime.dll + System.Runtime.Extensions.dll + System.Runtime.Handles.dll + System.Runtime.InteropServices.dll + System.Runtime.InteropServices.JavaScript.dll + System.Runtime.InteropServices.RuntimeInformation.dll + System.Runtime.Intrinsics.dll + System.Runtime.Loader.dll + System.Runtime.Numerics.dll + System.Runtime.Serialization.dll + System.Runtime.Serialization.Formatters.dll + System.Runtime.Serialization.Json.dll + System.Runtime.Serialization.Primitives.dll + System.Runtime.Serialization.Xml.dll + System.Security.AccessControl.dll + System.Security.Claims.dll + System.Security.Cryptography.Algorithms.dll + System.Security.Cryptography.Cng.dll + System.Security.Cryptography.Csp.dll + System.Security.Cryptography.dll + System.Security.Cryptography.Encoding.dll + System.Security.Cryptography.OpenSsl.dll + System.Security.Cryptography.Primitives.dll + System.Security.Cryptography.X509Certificates.dll + System.Security.dll + System.Security.Principal.dll + System.Security.Principal.Windows.dll + System.Security.SecureString.dll + System.ServiceModel.Web.dll + System.ServiceProcess.dll + System.Text.Encoding.CodePages.dll + System.Text.Encoding.dll + System.Text.Encoding.Extensions.dll + System.Text.Encodings.Web.dll + System.Text.Json.dll + System.Text.RegularExpressions.dll + System.Threading.AccessControl.dll + System.Threading.Channels.dll + System.Threading.dll + System.Threading.Overlapped.dll + System.Threading.Tasks.Dataflow.dll + System.Threading.Tasks.dll + System.Threading.Tasks.Extensions.dll + System.Threading.Tasks.Parallel.dll + System.Threading.Thread.dll + System.Threading.ThreadPool.dll + System.Threading.Timer.dll + System.Transactions.dll + System.Transactions.Local.dll + System.ValueTuple.dll + System.Web.dll + System.Web.HttpUtility.dll + System.Windows.dll + System.Xml.dll + System.Xml.Linq.dll + System.Xml.ReaderWriter.dll + System.Xml.Serialization.dll + System.Xml.XDocument.dll + System.Xml.XmlDocument.dll + System.Xml.XmlSerializer.dll + System.Xml.XPath.dll + System.Xml.XPath.XDocument.dll + WindowsBase.dll +../ + 0-Nine.Core/obj/Debug/net10.0/ref/Nine.Core.dll + 1-Nine.Infrastructure/obj/Debug/net10.0/ref/Nine.Infrastructure.dll + 2-Nine.Application/obj/Debug/net10.0/ref/Nine.Application.dll +/ + microsoft.aspnetcore.diagnostics.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll + microsoft.aspnetcore.http.connections.client/10.0.1/lib/net10.0/Microsoft.AspNetCore.Http.Connections.Client.dll + microsoft.aspnetcore.identity.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll + microsoft.aspnetcore.signalr.client.core/10.0.1/lib/net10.0/Microsoft.AspNetCore.SignalR.Client.Core.dll + microsoft.aspnetcore.signalr.client/10.0.1/lib/net10.0/Microsoft.AspNetCore.SignalR.Client.dll + microsoft.data.sqlite.core/10.0.1/lib/net8.0/Microsoft.Data.Sqlite.dll + microsoft.entityframeworkcore.abstractions/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Abstractions.dll + microsoft.entityframeworkcore.relational/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Relational.dll + microsoft.entityframeworkcore.sqlite.core/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Sqlite.dll + microsoft.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.dll + microsoft.extensions.dependencymodel/10.0.1/lib/net10.0/Microsoft.Extensions.DependencyModel.dll + microsoft.identitymodel.abstractions/8.3.1/lib/net9.0/Microsoft.IdentityModel.Abstractions.dll + microsoft.identitymodel.jsonwebtokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.JsonWebTokens.dll + microsoft.identitymodel.logging/8.3.1/lib/net9.0/Microsoft.IdentityModel.Logging.dll + microsoft.identitymodel.tokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.Tokens.dll + newtonsoft.json/13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll + questpdf/2025.12.1/lib/net10.0/QuestPDF.dll + sendgrid/9.29.3/lib/netstandard2.0/SendGrid.dll + sqlitepclraw.bundle_e_sqlite3/2.1.11/lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll + sqlitepclraw.core/2.1.11/lib/netstandard2.0/SQLitePCLRaw.core.dll + sqlitepclraw.provider.e_sqlcipher/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlcipher.dll + sqlitepclraw.provider.e_sqlite3/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll + starkbank-ecdsa/1.3.3/lib/netstandard2.1/StarkbankEcdsa.dll + system.identitymodel.tokens.jwt/8.3.1/lib/net9.0/System.IdentityModel.Tokens.Jwt.dll + system.security.cryptography.protecteddata/9.0.0/lib/net9.0/System.Security.Cryptography.ProtectedData.dll + twilio/7.14.0/lib/net6.0/Twilio.dll + +[analyzerReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.AspNetCore.App.Analyzers.dll + Microsoft.AspNetCore.App.CodeFixes.dll + Microsoft.AspNetCore.App.SourceGenerators.dll + Microsoft.AspNetCore.Components.Analyzers.dll + Microsoft.Extensions.Logging.Generators.dll + Microsoft.Extensions.Options.SourceGeneration.dll + Microsoft.Extensions.Validation.ValidationsGenerator.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.Interop.ComInterfaceGenerator.dll + Microsoft.Interop.JavaScript.JSImportGenerator.dll + Microsoft.Interop.LibraryImportGenerator.dll + Microsoft.Interop.SourceGeneration.dll + System.Text.Json.SourceGeneration.dll + System.Text.RegularExpressions.Generator.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk.Razor/source-generators/ + Microsoft.AspNetCore.Razor.Utilities.Shared.dll + Microsoft.CodeAnalysis.Razor.Compiler.dll + Microsoft.Extensions.ObjectPool.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/ + Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll + Microsoft.CodeAnalysis.NetAnalyzers.dll +/microsoft.entityframeworkcore.analyzers/10.0.1/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll + +[analyzerConfigFiles] +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig +obj/Debug/net10.0/Nine.Shared.UI.GeneratedMSBuildEditorConfig.editorconfig + +[additionalFiles] +Components/Common/ + ActionConfirmModal.razor + Card.razor + DataTable.razor + EntityFilterBar.razor + FormField.razor + MetricsCard.razor + Modal.razor + TrimmedInputText.razor + UserAvatar.razor +Components/Entities/ + Documents/DocumentListView.razor + Inspections/ + InspectionChecklistItem.razor + InspectionModalView.razor + InspectionSectionView.razor + RoutineInspectionCard.razor + Invoices/InvoiceList.razor + Leases/ + ActiveLeaseCard.razor + LeaseCard.razor + LeaseDetailsCard.razor + LeaseDocumentsCard.razor + LeaseLifeCycleCard.razor + LeaseList.razor + LeaseListView.razor + LeaseMetricsCard.razor + LeasePaymentsCard.razor + LeaseQuickActionsCard.razor + LeaseRenewalCard.razor + LeaseRenewalList.razor + LeaseSearchAndFilter.razor + LeaseSummaryCard.razor + LeaseTransactionsCard.razor + MaintenanceRequests/ + MaintenanceRequestCard.razor + MaintenanceRequestDetails.razor + MaintenanceRequestForm.razor + MaintenanceRequestListView.razor + Organizations/ + OrganizationCard.razor + OrganizationUsersListView.razor + OrganizationUserStatistics.razor + OrganizationUsers/ + UserAccessCard.razor + UserProfileCard.razor + Properties/ + PropertyCard.razor + PropertyDetails.razor + PropertyForm.razor + PropertyList.razor + PropertyListView.razor + PropertyMetricsCard.razor + PropertyOccupancyMetricsCard.razor + Repairs/ + RepairList.razor + RepairMetricsCard.razor +Components/ + Layout/SharedMainLayout.razor + Notifications/ + NotificationBell.razor + NotificationCenter.razor + NotificationPreferences.razor + OrganizationSwitcher/OrganizationSwitcher.razor +Features/Administration/Organizations/ + OrganizationDetails.razor + OrganizationForm.razor + OrganizationListView.razor +Features/PropertyManagement/Invoices/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +Features/PropertyManagement/Leases/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +Features/PropertyManagement/MaintenanceRequests/ + MaintenanceCreateForm.razor + MaintenanceEditForm.razor + MaintenanceListForm.razor + MaintenanceViewForm.razor +Features/PropertyManagement/Payments/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +Features/PropertyManagement/Properties/ + PropertyCreateForm.razor + PropertyEditForm.razor + PropertyListForm.razor + PropertyViewForm.razor +Features/PropertyManagement/Tenants/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +_Imports.razor + +[dynamicFiles] +Components/Common/ + ActionConfirmModal.razor + Card.razor + DataTable.razor + EntityFilterBar.razor + FormField.razor + MetricsCard.razor + Modal.razor + TrimmedInputText.razor + UserAvatar.razor +Components/Entities/ + Documents/DocumentListView.razor + Inspections/ + InspectionChecklistItem.razor + InspectionModalView.razor + InspectionSectionView.razor + RoutineInspectionCard.razor + Invoices/InvoiceList.razor + Leases/ + ActiveLeaseCard.razor + LeaseCard.razor + LeaseDetailsCard.razor + LeaseDocumentsCard.razor + LeaseLifeCycleCard.razor + LeaseList.razor + LeaseListView.razor + LeaseMetricsCard.razor + LeasePaymentsCard.razor + LeaseQuickActionsCard.razor + LeaseRenewalCard.razor + LeaseRenewalList.razor + LeaseSearchAndFilter.razor + LeaseSummaryCard.razor + LeaseTransactionsCard.razor + MaintenanceRequests/ + MaintenanceRequestCard.razor + MaintenanceRequestDetails.razor + MaintenanceRequestForm.razor + MaintenanceRequestListView.razor + Organizations/ + OrganizationCard.razor + OrganizationUsersListView.razor + OrganizationUserStatistics.razor + OrganizationUsers/ + UserAccessCard.razor + UserProfileCard.razor + Properties/ + PropertyCard.razor + PropertyDetails.razor + PropertyForm.razor + PropertyList.razor + PropertyListView.razor + PropertyMetricsCard.razor + PropertyOccupancyMetricsCard.razor + Repairs/ + RepairList.razor + RepairMetricsCard.razor +Components/ + Layout/SharedMainLayout.razor + Notifications/ + NotificationBell.razor + NotificationCenter.razor + NotificationPreferences.razor + OrganizationSwitcher/OrganizationSwitcher.razor +Features/Administration/Organizations/ + OrganizationDetails.razor + OrganizationForm.razor + OrganizationListView.razor +Features/PropertyManagement/Invoices/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +Features/PropertyManagement/Leases/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +Features/PropertyManagement/MaintenanceRequests/ + MaintenanceCreateForm.razor + MaintenanceEditForm.razor + MaintenanceListForm.razor + MaintenanceViewForm.razor +Features/PropertyManagement/Payments/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +Features/PropertyManagement/Properties/ + PropertyCreateForm.razor + PropertyEditForm.razor + PropertyListForm.razor + PropertyViewForm.razor +Features/PropertyManagement/Tenants/ + CreateForm.razor + EditForm.razor + ListForm.razor + ViewForm.razor +_Imports.razor diff --git a/3-Nine.Shared.UI/_Imports.razor b/3-Nine.Shared.UI/_Imports.razor index 8e3e887..1e4e21c 100644 --- a/3-Nine.Shared.UI/_Imports.razor +++ b/3-Nine.Shared.UI/_Imports.razor @@ -8,3 +8,5 @@ @using Nine.Core.Entities @using Nine.Core.Constants @using Nine.Core.Utilities +@using Nine.Application.Models +@using Nine.Shared.UI.Components.Common diff --git a/4-Nine/.github/copilot-instructions.md b/4-Nine/.github/copilot-instructions.md index fe7243c..bfe2dea 100644 --- a/4-Nine/.github/copilot-instructions.md +++ b/4-Nine/.github/copilot-instructions.md @@ -401,14 +401,19 @@ public async Task AddEntityAsync(Entity entity) ### Database Changes 1. **EF Core Migrations**: Primary approach for schema changes - - Migrations stored in `Data/Migrations/` - - Run `dotnet ef migrations add MigrationName --project Nine` - - Apply with `dotnet ef database update --project Nine` + - Migrations stored in `1-Nine.Infrastructure/Data/Migrations/` + - Add migration: `dotnet ef migrations add MigrationName --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/Migrations` + - Apply to database: `dotnet ef database update --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext` - Generate SQL script: `dotnet ef migrations script --output schema.sql` -2. **SQL Scripts**: Reference scripts in `Data/Scripts/` (not executed, for documentation) -3. Update `ApplicationDbContext.cs` with DbSet and entity configuration -4. Connection string in `appsettings.json`: `"DefaultConnection": "DataSource=Infrastructure/Data/app.db;Cache=Shared"` -5. **Database**: SQLite (not SQL Server) - scripts will be SQLite syntax +2. **Regenerate Compiled Model** (REQUIRED after every schema change): + - The app uses a **pre-compiled EF Core model** (`1-Nine.Infrastructure/Data/CompiledModels/`) for performance. + - After every migration, regenerate it or EF will throw `InvalidOperationException: Cannot create a DbSet for 'X' because this type is not included in the model for the context.` + - Command: `dotnet ef dbcontext optimize --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/CompiledModels --namespace Nine.Infrastructure.Data.CompiledModels` + - **Three steps for every schema change**: `migrations add` → `database update` → `dbcontext optimize` +3. **SQL Scripts**: Reference scripts in `Data/Scripts/` (not executed, for documentation) +4. Update `ApplicationDbContext.cs` with DbSet and entity configuration +5. Connection string in `appsettings.json`: `"DefaultConnection": "DataSource=Infrastructure/Data/app.db;Cache=Shared"` +6. **Database**: SQLite (not SQL Server) - scripts will be SQLite syntax ### Development Workflows diff --git a/4-Nine/Assets/co.nineapp.nine.appdata.xml b/4-Nine/Assets/co.nineapp.nine.appdata.xml index 28328c4..ad60b3c 100644 --- a/4-Nine/Assets/co.nineapp.nine.appdata.xml +++ b/4-Nine/Assets/co.nineapp.nine.appdata.xml @@ -4,7 +4,7 @@ MIT MIT Nine - Property management perfected for portfolios of up to nine properties + Property management for portfolios of up to nine properties

    @@ -14,18 +14,15 @@

    Key Features:

      -
    • Property Management - Track up to 9 residential properties with photos and documents
    • -
    • Tenant Lifecycle - Complete prospect-to-tenant journey with digital applications and screening
    • -
    • Lease Management - Digital lease creation with acceptance tracking and multi-lease support
    • -
    • Financial Management - Automated rent invoicing, payment tracking, and late fee application
    • -
    • Maintenance Tracking - Work order management with vendor assignment and scheduling
    • -
    • Inspections - Comprehensive 26-item checklist with PDF report generation
    • -
    • Security Deposit Investment - Track annual dividends distributed to tenants
    • -
    • Multi-user Support - Role-based access control for administrators and property managers
    • +
    • Property Management - Track up to 9 residential properties
    • +
    • Tenant Management
    • +
    • Lease Management
    • +
    • Financial Management - Invoicing, payment tracking, and late fee application
    • +
    • Repairs Tracking - Capture and track repair requests
    • +
    • Inspections - Comprehensive checklist with PDF report generation

    - Perfect for independent landlords, property owners who self-manage their rentals, and anyone seeking - affordable, easy-to-use property management software. + Perfect for independent landlords, property owners who self-manage their rentals, and anyone seeking an easy-to-use property management software.

    @@ -34,33 +31,33 @@ Dashboard with property overview and metrics - https://raw.githubusercontent.com/xnodeoncode/nine/main/Documentation/Screenshots/dashboard.png + https://raw.githubusercontent.com/xnodeoncode/Nine/main/Documentation/Screenshots/dashboard.png Property management interface - https://raw.githubusercontent.com/xnodeoncode/nine/main/Documentation/Screenshots/properties.png + https://raw.githubusercontent.com/xnodeoncode/Nine/main/Documentation/Screenshots/properties.png Lease workflow and tenant management - https://raw.githubusercontent.com/xnodeoncode/nine/main/Documentation/Screenshots/lease.png + https://raw.githubusercontent.com/xnodeoncode/Nine/main/Documentation/Screenshots/lease.png Invoice and payment tracking - https://raw.githubusercontent.com/xnodeoncode/nine/main/Documentation/Screenshots/invoice.png + https://raw.githubusercontent.com/xnodeoncode/Nine/main/Documentation/Screenshots/invoice.png Calendar list - https://raw.githubusercontent.com/xnodeoncode/nine/main/Documentation/Screenshots/calendar.png + https://raw.githubusercontent.com/xnodeoncode/Nine/main/Documentation/Screenshots/calendar.png Routine Inspections - https://raw.githubusercontent.com/xnodeoncode/nine/main/Documentation/Screenshots/inspection.png + https://raw.githubusercontent.com/xnodeoncode/Nine/main/Documentation/Screenshots/inspection.png https://www.nineapp.co - https://github.com/xnodeoncode/nine/issues - https://github.com/xnodeoncode/nine/blob/main/README.md + https://github.com/xnodeoncode/Nine/issues + https://github.com/xnodeoncode/Nine/blob/main/README.md xnodeoncode @@ -71,17 +68,15 @@ - + -

    Initial release of Nine. — property management desktop application.

    +

    Nine — property management desktop application.

    • Complete property, tenant, and lease management
    • -
    • Automated invoicing and payment tracking
    • -
    • Maintenance request tracking with vendor management
    • +
    • Invoicing and payment tracking
    • +
    • Repair tracking
    • Comprehensive property inspections with PDF reports
    • -
    • Security deposit investment tracking with dividends
    • -
    • Multi-user support with role-based access control
    • -
    • Linux AppImage with 2-second startup (performance optimized)
    • +
    • Role-based access control
    diff --git a/4-Nine/Assets/diagnose-startup.sh b/4-Nine/Assets/diagnose-startup.sh deleted file mode 100755 index 0ce7b48..0000000 --- a/4-Nine/Assets/diagnose-startup.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash -# -# Nine Startup Performance Diagnostic Tool -# Profiles AppImage startup to identify bottlenecks -# - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -APPIMAGE="${1:-$HOME/Applications/Nine-1.0.0.AppImage}" - -if [ ! -f "$APPIMAGE" ]; then - echo -e "${RED}Error: AppImage not found at: $APPIMAGE${NC}" - echo "Usage: $0 [path-to-appimage]" - exit 1 -fi - -echo -e "${BLUE}Nine Startup Performance Diagnostic${NC}" -echo "==========================================" -echo "" -echo "AppImage: $(basename "$APPIMAGE")" -echo "Size: $(du -h "$APPIMAGE" | cut -f1)" -echo "" - -# Test 1: AppImage Mount Time -echo -e "${YELLOW}Test 1: AppImage FUSE Mount Time${NC}" -START=$(date +%s.%N) -"$APPIMAGE" --appimage-help > /dev/null 2>&1 -END=$(date +%s.%N) -MOUNT_TIME=$(echo "$END - $START" | bc) -echo " Mount time: ${MOUNT_TIME}s" -echo "" - -# Test 2: .NET Runtime Initialization -echo -e "${YELLOW}Test 2: .NET Runtime Startup${NC}" -echo " Starting AppImage with timestamps..." -START=$(date +%s.%N) - -# Launch AppImage and capture its PID -"$APPIMAGE" > /tmp/aquiis-startup.log 2>&1 & -APPIMAGE_PID=$! - -# Monitor for process start -DOTNET_PID="" -ELAPSED=0 -while [ -z "$DOTNET_PID" ] && [ $ELAPSED -lt 60 ]; do - sleep 0.5 - DOTNET_PID=$(pgrep -P $APPIMAGE_PID | head -1) - ELAPSED=$((ELAPSED + 1)) -done - -if [ -n "$DOTNET_PID" ]; then - DOTNET_START=$(date +%s.%N) - DOTNET_LAUNCH=$(echo "$DOTNET_START - $START" | bc) - echo " .NET process spawned: ${DOTNET_LAUNCH}s" - - # Wait for Kestrel to start (check for port 8888) - KESTREL_READY=0 - KESTREL_ELAPSED=0 - while [ $KESTREL_READY -eq 0 ] && [ $KESTREL_ELAPSED -lt 120 ]; do - if netstat -tunl 2>/dev/null | grep -q ":8888 " || ss -tunl 2>/dev/null | grep -q ":8888 "; then - KESTREL_READY=1 - KESTREL_END=$(date +%s.%N) - KESTREL_TIME=$(echo "$KESTREL_END - $DOTNET_START" | bc) - echo " Kestrel listening on port 8888: ${KESTREL_TIME}s" - fi - sleep 0.5 - KESTREL_ELAPSED=$((KESTREL_ELAPSED + 1)) - done - - if [ $KESTREL_READY -eq 0 ]; then - echo " ${RED}Warning: Kestrel did not start within 60s${NC}" - fi - - # Wait for Electron window - ELECTRON_PID="" - ELECTRON_ELAPSED=0 - while [ -z "$ELECTRON_PID" ] && [ $ELECTRON_ELAPSED -lt 120 ]; do - ELECTRON_PID=$(pgrep -f "electron.*aquiis" | head -1) - if [ -z "$ELECTRON_PID" ]; then - sleep 0.5 - ELECTRON_ELAPSED=$((ELECTRON_ELAPSED + 1)) - fi - done - - if [ -n "$ELECTRON_PID" ]; then - ELECTRON_END=$(date +%s.%N) - ELECTRON_TIME=$(echo "$ELECTRON_END - $START" | bc) - echo " Electron window opened: ${ELECTRON_TIME}s" - fi - - # Total startup time - TOTAL_END=$(date +%s.%N) - TOTAL_TIME=$(echo "$TOTAL_END - $START" | bc) - - echo "" - echo -e "${GREEN}Startup Timeline:${NC}" - echo " 1. AppImage mount: ${MOUNT_TIME}s" - echo " 2. .NET launch: ${DOTNET_LAUNCH}s" - echo " 3. Kestrel ready: ${KESTREL_TIME}s (at ${KESTREL_END}s total)" - echo " 4. Window open: ${ELECTRON_TIME}s" - echo "" - echo -e "${BLUE}Total startup: ${TOTAL_TIME}s${NC}" - - # Kill the test instance - echo "" - echo -e "${YELLOW}Stopping test instance...${NC}" - kill $APPIMAGE_PID 2>/dev/null - sleep 2 - pkill -9 -f "Nine" 2>/dev/null -else - echo " ${RED}Error: .NET process did not start${NC}" - kill $APPIMAGE_PID 2>/dev/null -fi - -echo "" -echo -e "${YELLOW}Test 3: System Information${NC}" -echo " CPU: $(grep "model name" /proc/cpuinfo | head -1 | cut -d: -f2 | xargs)" -echo " RAM: $(free -h | awk '/^Mem:/ {print $2}')" -echo " Disk (AppImage): $(df -h "$APPIMAGE" | tail -1 | awk '{print $1 " (" $4 " free)"}')" -echo " Disk (Config): $(df -h ~/.config/Nine 2>/dev/null | tail -1 | awk '{print $1 " (" $4 " free)")' || echo "Not initialized"}" - -echo "" -echo -e "${YELLOW}Test 4: Database Check${NC}" -if [ -f ~/.config/Nine/Data/app_v1.0.0.db ]; then - DB_SIZE=$(du -h ~/.config/Nine/Data/app_v1.0.0.db | cut -f1) - echo " Database size: $DB_SIZE" - echo " Database location: ~/.config/Nine/Data/app_v1.0.0.db" -else - echo " Database: Not initialized (first run will be slower)" -fi - -echo "" -echo -e "${YELLOW}Test 5: AppImage Properties${NC}" -"$APPIMAGE" --appimage-version 2>/dev/null || echo " AppImage runtime: Type 2" -echo " Compression: $(file "$APPIMAGE" | grep -o "gzip\|xz\|zstd" || echo "unknown")" - -echo "" -echo -e "${GREEN}Diagnostic complete!${NC}" -echo "" -echo "If startup is still slow (>20s), check:" -echo " 1. Antivirus/security software scanning AppImage" -echo " 2. Slow disk (HDD vs SSD)" -echo " 3. Check /tmp/aquiis-startup.log for .NET errors" -echo " 4. Try: export ELECTRON_NO_ASAR=1 (before running)" -echo "" diff --git a/4-Nine/Assets/nine.desktop b/4-Nine/Assets/nine.desktop index 19a7b30..81f07d1 100644 --- a/4-Nine/Assets/nine.desktop +++ b/4-Nine/Assets/nine.desktop @@ -6,13 +6,13 @@ [Desktop Entry] Name=Nine Comment=Property management desktop application. -Exec=Nine-1.0.0-x86_64.AppImage +Exec=Nine-1.2.0-x86_64.AppImage Icon=Nine Type=Application Categories=Office;Finance; Terminal=false StartupWMClass=Nine -X-AppImage-Version=1.0.0 +X-AppImage-Version=1.2.0 X-AppImage-Name=Nine X-AppImage-Arch=x86_64 X-AppImage-Payload-License=MIT diff --git a/4-Nine/Extensions/ElectronServiceExtensions.cs b/4-Nine/Extensions/ElectronServiceExtensions.cs index 7c48f56..25b764a 100644 --- a/4-Nine/Extensions/ElectronServiceExtensions.cs +++ b/4-Nine/Extensions/ElectronServiceExtensions.cs @@ -144,6 +144,15 @@ public static IServiceCollection AddElectronServices( // Ensure cookie is persisted (not session-only) options.Cookie.MaxAge = TimeSpan.FromDays(30); options.Cookie.IsEssential = true; + + // Cookies are not separated by port, so versions run side by side share one + // localhost cookie jar. Naming the cookie after the schema version keeps each + // version's sign-in from overwriting the other's. + var schemaVersion = configuration["ApplicationSettings:SchemaVersion"]; + if (!string.IsNullOrWhiteSpace(schemaVersion)) + { + options.Cookie.Name = $".Nine.Auth.{schemaVersion}"; + } // For localhost Electron app, allow non-HTTPS cookies options.Cookie.SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.SameAsRequest; diff --git a/4-Nine/Extensions/NetworkLockdown.cs b/4-Nine/Extensions/NetworkLockdown.cs new file mode 100644 index 0000000..78b0e63 --- /dev/null +++ b/4-Nine/Extensions/NetworkLockdown.cs @@ -0,0 +1,110 @@ +using ElectronNET.API; +using ElectronNET.API.Entities; + +namespace Nine.Extensions; + +/// +/// Restricts the desktop (Electron) build to talking only to its own local Kestrel instance. +/// The port is chosen at startup, so everything here is derived from the URL Kestrel actually bound to. +/// +public static class NetworkLockdown +{ + private static readonly string[] LoopbackHosts = { "localhost", "127.0.0.1", "[::1]" }; + + // Port 9 (discard) on loopback is not served, so any request routed through it fails immediately. + private const string BlackholeProxy = "127.0.0.1:9"; + + /// + /// Kestrel rejects requests whose Host header is not a loopback name (blocks DNS-rebinding style access). + /// The host filter ignores the port, so the dynamic port needs no special handling. + /// Must be called before the host is built. + /// + public static void RestrictHostsToLoopback(IConfigurationManager configuration) + { + configuration["AllowedHosts"] = string.Join(';', LoopbackHosts); + } + + /// + /// Sends every Electron network request that is not to a loopback address into a dead proxy. + /// When the main window, or a window it opens, tries to go to another origin, the http(s) URL is + /// handed to the system browser (a user-initiated action outside the app) and the app stays put. + /// + public static async Task ApplyAsync(BrowserWindow window, string backendUrl, ILogger logger) + { + var session = window.WebContents.Session; + await session.SetProxyAsync(new ProxyConfig( + pacScript: null, + proxyRules: BlackholeProxy, + proxyBypassRules: string.Join(';', LoopbackHosts))); + + window.WebContents.OnDidStartNavigation += url => + { + if (!IsExternalWebUrl(url, backendUrl)) + { + return; + } + + logger.LogInformation("Opening external URL in the system browser: {Url}", url); + _ = Electron.Shell.OpenExternalAsync(url); + _ = window.WebContents.LoadURLAsync(backendUrl); + }; + + logger.LogInformation("Network lockdown applied; only {Url} is reachable from the app", backendUrl); + } + + /// + /// Endpoint used by externalLinks.js to hand a clicked http(s) link to the system browser. + /// Links with target="_blank" would otherwise open a new Electron window that cannot reach the network. + /// Only active in the Electron build; elsewhere it returns 404 and the script falls back to normal behaviour. + /// + public static void MapExternalLinkEndpoint(WebApplication app) + { + app.MapPost("/api/external/open", async (HttpContext context, OpenExternalRequest request) => + { + if (!HybridSupport.IsElectronActive) + { + return Results.NotFound(); + } + + // Only requests made by the app's own pages (not other sites or local tools). + if (context.Request.Headers["Sec-Fetch-Site"] != "same-origin") + { + return Results.StatusCode(StatusCodes.Status403Forbidden); + } + + if (!Uri.TryCreate(request.Url, UriKind.Absolute, out var target) || + (target.Scheme != Uri.UriSchemeHttp && target.Scheme != Uri.UriSchemeHttps)) + { + return Results.BadRequest(); + } + + app.Logger.LogInformation("Opening external URL in the system browser: {Url}", target); + var error = await Electron.Shell.OpenExternalAsync(target.AbsoluteUri); + return string.IsNullOrEmpty(error) ? Results.NoContent() : Results.Problem(error); + }); + } + + /// + /// True for http(s) URLs whose scheme, host and port differ from the application URL. + /// Non-web schemes (about:, blob:, data:, chrome-error:) are not treated as external here. + /// + public static bool IsExternalWebUrl(string? url, string backendUrl) + { + if (!Uri.TryCreate(url, UriKind.Absolute, out var target) || + !Uri.TryCreate(backendUrl, UriKind.Absolute, out var app)) + { + return false; + } + + if (target.Scheme != Uri.UriSchemeHttp && target.Scheme != Uri.UriSchemeHttps) + { + return false; + } + + return !(target.Scheme == app.Scheme && + string.Equals(target.Host, app.Host, StringComparison.OrdinalIgnoreCase) && + target.Port == app.Port); + } +} + +public sealed record OpenExternalRequest(string? Url); diff --git a/4-Nine/Extensions/SecurityHeadersMiddleware.cs b/4-Nine/Extensions/SecurityHeadersMiddleware.cs index 81ec04a..3f4b93e 100644 --- a/4-Nine/Extensions/SecurityHeadersMiddleware.cs +++ b/4-Nine/Extensions/SecurityHeadersMiddleware.cs @@ -45,11 +45,11 @@ private void AddSecurityHeaders(HttpContext context) // Scripts: Allow self, inline scripts (Blazor requirement), and eval (Blazor SignalR requirement) "script-src 'self' 'unsafe-inline' 'unsafe-eval'", - // Styles: Allow self, inline styles (Bootstrap/Blazor requirement), and Bootstrap CDN - "style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net", + // Styles: Allow self and inline styles (Bootstrap/Blazor requirement) + "style-src 'self' 'unsafe-inline'", - // Fonts: Allow self, Bootstrap Icons CDN, and data URIs - "font-src 'self' https://cdn.jsdelivr.net data:", + // Fonts: Allow self and data URIs (Bootstrap Icons are served locally) + "font-src 'self' data:", // Images: Allow self, data URIs (for inline images), and blob URIs (for PDF viewer) "img-src 'self' data: blob:", diff --git a/4-Nine/Features/Administration/Organizations/Pages/ManageUsers.razor b/4-Nine/Features/Administration/Organizations/Pages/ManageUsers.razor index 6e877d8..249e4eb 100644 --- a/4-Nine/Features/Administration/Organizations/Pages/ManageUsers.razor +++ b/4-Nine/Features/Administration/Organizations/Pages/ManageUsers.razor @@ -67,7 +67,7 @@
    User Limit Reached
    - Nine allows up to 3 user accounts (1 system + 2 login users).
    + Nine allows up to 4 user accounts (1 system + 3 login users).
    Upgrade to Nine Professional for unlimited users and advanced features.
    } diff --git a/4-Nine/Features/Administration/Settings/Pages/ApplicationSettings.razor b/4-Nine/Features/Administration/Settings/Pages/ApplicationSettings.razor index 2d63774..50ecf93 100644 --- a/4-Nine/Features/Administration/Settings/Pages/ApplicationSettings.razor +++ b/4-Nine/Features/Administration/Settings/Pages/ApplicationSettings.razor @@ -321,13 +321,30 @@
    License
    MIT License - View
    +
    Third-Party Licenses
    +
    + + View third-party licenses + + + About Nine + +
    + +
    Privacy
    +
    + + View privacy statement + +
    +
    Website
    @@ -370,19 +387,19 @@
    @code { + // Documentation links are pinned to the tag for the installed version (vX.Y.Z), so users read the + // guides that match the version they are running. They open in the default browser. + private string RepositoryUrl => string.IsNullOrWhiteSpace(ApplicationService.ApplicationSettings.Repository) + ? "https://github.com/xnodeoncode/Nine" + : ApplicationService.ApplicationSettings.Repository.TrimEnd('/'); + private string VersionTag => $"v{ApplicationService.ApplicationSettings.Version}"; + private string DocsBlobBase => $"{RepositoryUrl}/blob/{VersionTag}/Documentation"; + private string DocsTreeUrl => $"{RepositoryUrl}/tree/{VersionTag}/Documentation"; + private OrganizationSettingsEntity? settings; private OrganizationSettingsModel settingsModel = new(); private bool isLoading = true; @@ -471,7 +497,7 @@ OrganizationId = organizationId, LateFeeEnabled = true, LateFeeAutoApply = true, - LateFeeGracePeriodDays = 3, + LateFeeGracePeriodDays = 5, LateFeePercentage = 0.05m, MaxLateFeeAmount = 50.00m, CreatedOn = DateTime.UtcNow, @@ -666,7 +692,7 @@ [Required] [Range(0, 30, ErrorMessage = "Grace period must be between 0 and 30 days")] - public int LateFeeGracePeriodDays { get; set; } = 3; + public int LateFeeGracePeriodDays { get; set; } = 5; [Required] [Range(0, 1, ErrorMessage = "Late fee percentage must be between 0% and 100%")] diff --git a/4-Nine/Features/Administration/Settings/Pages/DatabaseSettings.razor b/4-Nine/Features/Administration/Settings/Pages/DatabaseSettings.razor index c4c949c..2b994c6 100644 --- a/4-Nine/Features/Administration/Settings/Pages/DatabaseSettings.razor +++ b/4-Nine/Features/Administration/Settings/Pages/DatabaseSettings.razor @@ -10,6 +10,7 @@ @using Microsoft.Extensions.Options @using ElectronNET.API @inject DatabaseBackupService BackupService +@inject DatabaseHealthService HealthService @inject IPathService PathService @inject NavigationManager Navigation @inject SchemaValidationService SchemaService @@ -153,26 +154,69 @@

    Checking database health...

    } - else if (healthCheckResult != null) + else if (healthReport != null) {
    - @if (healthCheckResult.Value.IsHealthy) + @if (!healthReport.IsHealthy) { - -
    -
    Healthy
    -

    @healthCheckResult.Value.Message

    -
    + +
    Database Health Check: FAILED
    + } + else if (healthReport.Warnings.Any()) + { + +
    Database Health Check: PASSED with warnings
    } else { - -
    -
    Unhealthy
    -

    @healthCheckResult.Value.Message

    -
    + +
    Database Health Check: PASSED
    }
    + + @foreach (var error in healthReport.Errors) + { +
    @error
    + } + @foreach (var warning in healthReport.Warnings) + { +
    @warning
    + } + +
    +
    Database file
    +
    @healthReport.DatabaseFileName
    +
    Location
    +
    @healthReport.DatabasePath
    +
    File size
    +
    @FormatFileSize(healthReport.FileSizeBytes)
    +
    Schema version
    +
    @(healthReport.SchemaVersion ?? "Unknown")
    +
    Connection status
    +
    @(healthReport.IsConnected ? "Connected" : "Failed")
    +
    Integrity check
    +
    @(healthReport.IntegrityPassed ? "PASSED" : "FAILED")
    +
    Last backup
    +
    @(healthReport.LastBackupDate?.ToString("f") ?? "Never")
    +
    + + @if (healthReport.RecordCounts != null) + { +
    Record counts
    +
    +
    Properties
    +
    @healthReport.RecordCounts.Properties
    +
    Tenants
    +
    @healthReport.RecordCounts.Tenants
    +
    Leases
    +
    @healthReport.RecordCounts.Leases
    +
    Invoices
    +
    @healthReport.RecordCounts.Invoices
    +
    Payments
    +
    @healthReport.RecordCounts.Payments
    +
    + } + Last checked: @lastHealthCheck?.ToString("g") } else @@ -309,7 +353,7 @@
    -
    - } - - - - - -
    -
    Applicant Information
    -
    -
    - Name: @prospect.FullName -
    -
    - Email: @prospect.Email -
    -
    - Phone: @prospect.Phone -
    -
    - Date of Birth: @prospect.DateOfBirth?.ToString("MMM dd, yyyy") -
    -
    -
    - -
    -
    Property Selection
    -
    - - - - @foreach (var property in availableProperties) - { - - } - - -
    - - @if (selectedProperty != null) - { -
    -
    -
    - Property: @selectedProperty.Address
    - Type: @selectedProperty.PropertyType
    - Beds/Baths: @selectedProperty.Bedrooms / @selectedProperty.Bathrooms -
    -
    - Monthly Rent: @selectedProperty.MonthlyRent.ToString("C")
    - Sq Ft: @selectedProperty.SquareFeet
    - Status: @selectedProperty.Status -
    -
    -
    - } -
    - -
    -
    Current Address
    -
    -
    - - - -
    -
    - - - -
    -
    - - - - @foreach (var state in ApplicationConstants.USStateAbbreviations) - { - - } - - -
    -
    - - - -
    -
    - -
    - $ - -
    - -
    -
    -
    - -
    -
    Current Landlord
    -
    -
    - - - -
    -
    - - - -
    -
    -
    - -
    -
    Employment Information
    -
    -
    - - - -
    -
    - - - -
    -
    - -
    - $ - -
    - - @if (selectedProperty != null && applicationModel.MonthlyIncome > 0) - { - var ratio = selectedProperty.MonthlyRent / applicationModel.MonthlyIncome; - var percentOfIncome = ratio * 100; - - Rent would be @percentOfIncome.ToString("F1")% of income - @if (ratio <= 0.30m) - { - (Good) - } - else if (ratio <= 0.35m) - { - (Acceptable) - } - else - { - (High) - } - - } -
    -
    - - - -
    -
    -
    - -
    -
    References
    -
    -
    Reference 1 (Required)
    -
    - - - -
    -
    - - - -
    -
    - - - -
    - -
    Reference 2 (Optional)
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    - - @if (applicationFeeRequired) - { -
    -
    Application Fee
    -

    Amount Due: @applicationFee.ToString("C")

    -

    Application fee is non-refundable and must be paid to process your application.

    -
    - } - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    Application Checklist
    -
    -
    -
      -
    • - - Personal information -
    • -
    • - - Current address -
    • -
    • - - Employment details -
    • -
    • - - References -
    • - @if (applicationFeeRequired) - { -
    • - - Application fee payment -
    • - } -
    -
    -
    - -
    -
    -
    What Happens Next?
    -
    -
    -
      -
    1. Application submitted for review
    2. -
    3. Background check initiated
    4. -
    5. Credit check performed
    6. -
    7. Application reviewed (1-3 business days)
    8. -
    9. You'll be notified of decision
    10. -
    11. If approved, lease offer sent
    12. -
    -
    -
    -
    -
    - } -
    - -@code { - [Parameter] - public Guid ProspectId { get; set; } - - private ProspectiveTenant? prospect; - private RentalApplication? existingApplication; - private List availableProperties = new(); - private Property? selectedProperty; - private ApplicationSubmissionModel applicationModel = new(); - private bool isLoading = true; - private bool isSubmitting = false; - private bool applicationFeeRequired = false; - private decimal applicationFee = 50.00m; - private string errorMessage = string.Empty; - private string userId = string.Empty; - private Guid organizationId = Guid.Empty; - - protected override async Task OnInitializedAsync() - { - try - { - var authState = await AuthStateProvider.GetAuthenticationStateAsync(); - userId = authState.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier)?.Value ?? string.Empty; - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - - await LoadData(); - } - catch (Exception ex) - { - errorMessage = $"Error loading data: {ex.Message}"; - } - finally - { - isLoading = false; - } - } - - private async Task LoadData() - { - // Load prospect - prospect = await ProspectiveTenantService.GetByIdAsync(ProspectId); - - if (prospect == null) return; - - // Check if application already exists - existingApplication = await RentalApplicationService.GetApplicationByProspectiveIdAsync(ProspectId); - - // Load available properties - var allProperties = await PropertyService.GetAllAsync(); - availableProperties = allProperties.Where(p => - p.Status == ApplicationConstants.PropertyStatuses.Available || - p.Status == ApplicationConstants.PropertyStatuses.ApplicationPending).ToList(); - - // Pre-select interested property if set - if (prospect.InterestedPropertyId.HasValue) - { - applicationModel.PropertyId = prospect.InterestedPropertyId.Value; - selectedProperty = availableProperties.FirstOrDefault(p => p.Id == prospect.InterestedPropertyId.Value); - } - - // Load organization settings for application fee - var orgSettings = await OrganizationService.GetOrganizationSettingsByOrgIdAsync(prospect.OrganizationId); - if (orgSettings != null) - { - applicationFeeRequired = orgSettings.ApplicationFeeEnabled; - applicationFee = orgSettings.DefaultApplicationFee; - } - } - - private void UpdateSelectedProperty() - { - if (applicationModel.PropertyId != Guid.Empty) - { - selectedProperty = availableProperties.FirstOrDefault(p => p.Id == applicationModel.PropertyId); - } - else - { - selectedProperty = null; - } - } - - private async Task OnPropertyChanged(ChangeEventArgs e) - { - if (Guid.TryParse(e.Value?.ToString(), out Guid propertyId) && propertyId != Guid.Empty) - { - applicationModel.PropertyId = propertyId; - selectedProperty = availableProperties.FirstOrDefault(p => p.Id == propertyId); - } - else - { - applicationModel.PropertyId = Guid.Empty; - selectedProperty = null; - } - StateHasChanged(); - await Task.CompletedTask; - } - - private async Task HandleSubmitApplication() - { - Console.WriteLine("HandleSubmitApplication called"); - - if (prospect == null || selectedProperty == null) - { - errorMessage = prospect == null ? "Prospect not found" : "Please select a property"; - Console.WriteLine($"Validation failed: {errorMessage}"); - return; - } - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - Console.WriteLine($"Submitting application for prospect {ProspectId}, property {applicationModel.PropertyId}"); - - // Use ApplicationWorkflowService to submit application - var submissionModel = new Nine.Application.Services.Workflows.ApplicationSubmissionModel - { - // Current Address - CurrentAddress = applicationModel.CurrentAddress, - CurrentCity = applicationModel.CurrentCity, - CurrentState = applicationModel.CurrentState, - CurrentZipCode = applicationModel.CurrentZipCode, - CurrentRent = applicationModel.CurrentRent, - LandlordName = applicationModel.LandlordName, - LandlordPhone = applicationModel.LandlordPhone, - - // Employment - EmployerName = applicationModel.EmployerName, - JobTitle = applicationModel.JobTitle, - MonthlyIncome = applicationModel.MonthlyIncome, - EmploymentLengthMonths = applicationModel.EmploymentLengthMonths, - - // References - Reference1Name = applicationModel.Reference1Name, - Reference1Phone = applicationModel.Reference1Phone, - Reference1Relationship = applicationModel.Reference1Relationship, - Reference2Name = applicationModel.Reference2Name, - Reference2Phone = applicationModel.Reference2Phone, - Reference2Relationship = applicationModel.Reference2Relationship, - - // Fees - ApplicationFee = applicationFee, - ApplicationFeePaid = false // Will be paid separately - }; - - var result = await WorkflowService.SubmitApplicationAsync( - ProspectId, - applicationModel.PropertyId, - submissionModel); - - Console.WriteLine($"Workflow result: Success={result.Success}, Errors={string.Join(", ", result.Errors)}"); - - if (result.Success) - { - ToastService.ShowSuccess("Application submitted successfully! You will be notified once reviewed."); - Navigation.NavigateTo($"/PropertyManagement/ProspectiveTenants/{ProspectId}"); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error submitting application: {ex.Message}"; - Console.WriteLine($"Exception in HandleSubmitApplication: {ex}"); - } - finally - { - isSubmitting = false; - } - } - - private void Cancel() - { - Navigation.NavigateTo($"/PropertyManagement/ProspectiveTenants/{ProspectId}"); - } - - public class ApplicationSubmissionModel - { - [RequiredGuid(ErrorMessage = "Please select a property")] - public Guid PropertyId { get; set; } - - [Required] - [StringLength(200)] - public string CurrentAddress { get; set; } = string.Empty; - - [Required] - [StringLength(100)] - public string CurrentCity { get; set; } = string.Empty; - - [Required] - [StringLength(2)] - public string CurrentState { get; set; } = string.Empty; - - [Required] - [StringLength(10)] - public string CurrentZipCode { get; set; } = string.Empty; - - [Required] - [Range(0.01, double.MaxValue, ErrorMessage = "Current rent must be greater than 0")] - public decimal CurrentRent { get; set; } - - [Required] - [StringLength(200)] - public string LandlordName { get; set; } = string.Empty; - - [Required] - [StringLength(20)] - public string LandlordPhone { get; set; } = string.Empty; - - [Required] - [StringLength(200)] - public string EmployerName { get; set; } = string.Empty; - - [Required] - [StringLength(100)] - public string JobTitle { get; set; } = string.Empty; - - [Required] - [Range(0.01, double.MaxValue, ErrorMessage = "Monthly income must be greater than 0")] - public decimal MonthlyIncome { get; set; } - - [Required] - [Range(0, int.MaxValue, ErrorMessage = "Employment length cannot be negative")] - public int EmploymentLengthMonths { get; set; } - - [Required] - [StringLength(200)] - public string Reference1Name { get; set; } = string.Empty; - - [Required] - [StringLength(20)] - public string Reference1Phone { get; set; } = string.Empty; - - [Required] - [StringLength(100)] - public string Reference1Relationship { get; set; } = string.Empty; - - [StringLength(200)] - public string? Reference2Name { get; set; } - - [StringLength(20)] - public string? Reference2Phone { get; set; } - - [StringLength(100)] - public string? Reference2Relationship { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/Applications/Pages/Index.razor b/4-Nine/Features/PropertyManagement/Applications/Pages/Index.razor deleted file mode 100644 index b545848..0000000 --- a/4-Nine/Features/PropertyManagement/Applications/Pages/Index.razor +++ /dev/null @@ -1,250 +0,0 @@ -@page "/propertymanagement/applications" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization - -@inject NavigationManager Navigation -@inject UserContextService UserContext -@inject RentalApplicationService RentalApplicationService - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Rental Applications - -
    -
    -
    -
    -

    Rental Applications

    -
    -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else - { - - - - @if (!filteredApplications.Any()) - { -
    - - No applications found. -
    - } - else - { -
    - - - - - - - - - - - - - - - - @foreach (var app in filteredApplications.OrderByDescending(a => a.AppliedOn)) - { - var rentRatio = app.Property != null ? (app.Property.MonthlyRent / app.MonthlyIncome * 100) : 0; - var daysUntilExpiration = (app.ExpiresOn - DateTime.UtcNow)?.TotalDays ?? 0; - - - - - - - - - - - - - } - -
    ApplicantPropertyApplied OnMonthly IncomeRent RatioStatusFee PaidExpiresActions
    - @app.ProspectiveTenant?.FullName
    - @app.ProspectiveTenant?.Email -
    - @app.Property?.Address
    - @app.Property?.MonthlyRent.ToString("C")/mo -
    - @app.AppliedOn.ToString("MMM dd, yyyy") - - @app.MonthlyIncome.ToString("C") - - - @rentRatio.ToString("F1")% - - - @if (app.Status == ApplicationConstants.ApplicationStatuses.Submitted) - { - @app.Status - } - else if (app.Status == ApplicationConstants.ApplicationStatuses.UnderReview || app.Status == ApplicationConstants.ApplicationStatuses.Screening) - { - @app.Status - } - else if (app.Status == ApplicationConstants.ApplicationStatuses.Approved) - { - @app.Status - } - else if (app.Status == ApplicationConstants.ApplicationStatuses.Denied) - { - @app.Status - } - else if (app.Status == ApplicationConstants.ApplicationStatuses.Expired) - { - @app.Status - } - else - { - @app.Status - } - - @if (app.ApplicationFeePaid) - { - - } - else - { - - } - - @if (app.ExpiresOn < DateTime.UtcNow) - { - Expired - } - else if (daysUntilExpiration < 7) - { - @((int)daysUntilExpiration)d - } - else - { - @app.ExpiresOn?.ToString("MMM dd") - } - - -
    -
    - } - } -
    - -@code { - private List applications = new(); - private List filteredApplications = new(); - private List pendingApplications = new(); - private List screeningApplications = new(); - private List approvedApplications = new(); - private List deniedApplications = new(); - private string currentFilter = "Pending"; - private bool isLoading = true; - private Guid organizationId = Guid.Empty; - - protected override async Task OnInitializedAsync() - { - try - { - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - await LoadApplications(); - } - catch (Exception ex) - { - Console.WriteLine($"Error loading applications: {ex.Message}"); - } - finally - { - isLoading = false; - } - } - - private async Task LoadApplications() - { - applications = await RentalApplicationService.GetAllAsync(); - - pendingApplications = applications.Where(a => - a.Status == ApplicationConstants.ApplicationStatuses.Submitted || - a.Status == ApplicationConstants.ApplicationStatuses.UnderReview).ToList(); - - screeningApplications = applications.Where(a => - a.Status == ApplicationConstants.ApplicationStatuses.Screening).ToList(); - - approvedApplications = applications.Where(a => - a.Status == ApplicationConstants.ApplicationStatuses.Approved || - a.Status == ApplicationConstants.ApplicationStatuses.LeaseOffered || - a.Status == ApplicationConstants.ApplicationStatuses.LeaseAccepted).ToList(); - - deniedApplications = applications.Where(a => - a.Status == ApplicationConstants.ApplicationStatuses.Denied || - a.Status == ApplicationConstants.ApplicationStatuses.Withdrawn).ToList(); - - SetFilter(currentFilter); - } - - private void SetFilter(string filter) - { - currentFilter = filter; - - filteredApplications = filter switch - { - "Pending" => pendingApplications, - "Screening" => screeningApplications, - "Approved" => approvedApplications, - "Denied" => deniedApplications, - _ => applications - }; - } - - private void ViewApplication(Guid applicationId) - { - Navigation.NavigateTo($"/propertymanagement/applications/{applicationId}/review"); - } -} diff --git a/4-Nine/Features/PropertyManagement/Applications/Pages/View.razor b/4-Nine/Features/PropertyManagement/Applications/Pages/View.razor deleted file mode 100644 index e010d33..0000000 --- a/4-Nine/Features/PropertyManagement/Applications/Pages/View.razor +++ /dev/null @@ -1,1177 +0,0 @@ -@page "/propertymanagement/applications/{ApplicationId:guid}/view" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Application.Services.Workflows -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@using System.ComponentModel.DataAnnotations - -@inject RentalApplicationService RentalApplicationService -@inject ScreeningService ScreeningService -@inject LeaseOfferService LeaseOfferService -@inject ApplicationWorkflowService WorkflowService -@inject NavigationManager Navigation -@inject AuthenticationStateProvider AuthStateProvider -@inject UserContextService UserContext -@inject ToastService ToastService - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Review Application - -
    -
    -
    - -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (application == null) - { -
    -

    Application Not Found

    -

    The application you are trying to view does not exist or you do not have permission to access it.

    -
    - Return to Applications -
    - } - else - { -
    -
    -
    -
    -
    -

    Application Review

    - @application.Status -
    -
    -
    - @if (!string.IsNullOrEmpty(errorMessage)) - { - - } - - @if (!string.IsNullOrEmpty(successMessage)) - { - - } - - -
    -
    Applicant Information
    -
    -
    - Name: @application.ProspectiveTenant?.FullName -
    -
    - Email: @application.ProspectiveTenant?.Email -
    -
    - Phone: @application.ProspectiveTenant?.Phone -
    -
    - Date of Birth: @application.ProspectiveTenant?.DateOfBirth?.ToString("MMM dd, yyyy") -
    -
    - Applied On: @application.AppliedOn.ToString("MMM dd, yyyy") -
    -
    - Expires On: @application.ExpiresOn?.ToString("MMM dd, yyyy") - @if (application.ExpiresOn < DateTime.UtcNow) - { - Expired - } - else if ((application.ExpiresOn - DateTime.UtcNow)?.TotalDays < 7) - { - Expires Soon - } -
    -
    -
    - - -
    -
    Property
    -
    -
    - Address: @application.Property?.Address -
    -
    - Monthly Rent: @application.Property?.MonthlyRent.ToString("C") -
    -
    - Type: @application.Property?.PropertyType -
    -
    - Beds/Baths: @application.Property?.Bedrooms / @application.Property?.Bathrooms -
    -
    -
    - - -
    -
    Current Address
    -
    -
    - @application.CurrentAddress
    - @application.CurrentCity, @application.CurrentState @application.CurrentZipCode -
    -
    - Current Rent: @application.CurrentRent.ToString("C") -
    -
    - Landlord: @application.LandlordName -
    -
    - Landlord Phone: @application.LandlordPhone -
    -
    -
    - - -
    -
    Employment Information
    -
    -
    - Employer: @application.EmployerName -
    -
    - Job Title: @application.JobTitle -
    -
    - Monthly Income: @application.MonthlyIncome.ToString("C") -
    -
    - Employment Length: @application.EmploymentLengthMonths months -
    - @if (application.Property != null) - { - var incomeRatio = application.Property.MonthlyRent / application.MonthlyIncome; - var percentOfIncome = incomeRatio * 100; -
    -
    - Rent-to-Income Ratio: @percentOfIncome.ToString("F1")% - @if (incomeRatio <= 0.30m) - { - (Excellent - meets 30% guideline) - } - else if (incomeRatio <= 0.35m) - { - (Acceptable - slightly above guideline) - } - else - { - (High risk - significantly above 30% guideline) - } -
    -
    - } -
    -
    - - -
    -
    References
    -
    -
    Reference 1
    -
    - Name: @application.Reference1Name -
    -
    - Phone: @application.Reference1Phone -
    -
    - Relationship: @application.Reference1Relationship -
    - - @if (!string.IsNullOrEmpty(application.Reference2Name)) - { -
    Reference 2
    -
    - Name: @application.Reference2Name -
    -
    - Phone: @application.Reference2Phone -
    -
    - Relationship: @application.Reference2Relationship -
    - } -
    -
    - - -
    -
    Application Fee
    -
    -
    - Fee Amount: @application.ApplicationFee.ToString("C") -
    -
    - Status: - @if (application.ApplicationFeePaid) - { - Paid - } - else - { - Unpaid - } -
    - @if (application.ApplicationFeePaid && application.ApplicationFeePaidOn.HasValue) - { -
    - Paid On: @application.ApplicationFeePaidOn?.ToString("MMM dd, yyyy") -
    - @if (!string.IsNullOrEmpty(application.ApplicationFeePaymentMethod)) - { -
    - Payment Method: @application.ApplicationFeePaymentMethod -
    - } - } -
    - @if (!application.ApplicationFeePaid) - { -
    - -
    - } -
    - - - @if (screening != null) - { -
    -
    Screening Results
    -
    -
    -
    -
    - Background Check -
    -
    - @if (screening.BackgroundCheckRequested) - { -

    - Status: - @if (screening.BackgroundCheckPassed == true) - { - Passed - } - else if (screening.BackgroundCheckPassed == false) - { - Failed - } - else - { - Pending - } -

    - @if (screening.BackgroundCheckRequestedOn.HasValue) - { -

    Requested: @screening.BackgroundCheckRequestedOn?.ToString("MMM dd, yyyy")

    - } - @if (screening.BackgroundCheckCompletedOn.HasValue) - { -

    Completed: @screening.BackgroundCheckCompletedOn?.ToString("MMM dd, yyyy")

    - } - @if (!string.IsNullOrEmpty(screening.BackgroundCheckNotes)) - { -

    Notes: @screening.BackgroundCheckNotes

    - } - @if (!screening.BackgroundCheckPassed.HasValue) - { -
    - - -
    - } - } - else - { -

    Not requested

    - } -
    -
    -
    -
    -
    -
    - Credit Check -
    -
    - @if (screening.CreditCheckRequested) - { -

    - Status: - @if (screening.CreditCheckPassed == true) - { - Passed - } - else if (screening.CreditCheckPassed == false) - { - Failed - } - else - { - Pending - } -

    - @if (screening.CreditScore.HasValue) - { -

    Credit Score: @screening.CreditScore

    - } - @if (screening.CreditCheckRequestedOn.HasValue) - { -

    Requested: @screening.CreditCheckRequestedOn?.ToString("MMM dd, yyyy")

    - } - @if (screening.CreditCheckCompletedOn.HasValue) - { -

    Completed: @screening.CreditCheckCompletedOn?.ToString("MMM dd, yyyy")

    - } - @if (!string.IsNullOrEmpty(screening.CreditCheckNotes)) - { -

    Notes: @screening.CreditCheckNotes

    - } - @if (!screening.CreditCheckPassed.HasValue) - { -
    - - -
    - } - } - else - { -

    Not requested

    - } -
    -
    -
    -
    -
    - Overall Result: @screening.OverallResult - @if (!string.IsNullOrEmpty(screening.ResultNotes)) - { -
    @screening.ResultNotes - } -
    -
    -
    -
    - } - - -
    - -
    - @if ((application.Status == ApplicationConstants.ApplicationStatuses.Submitted || - application.Status == ApplicationConstants.ApplicationStatuses.UnderReview) && - screening == null && application.ApplicationFeePaid) - { - - } - @if (screening != null && screening.OverallResult == ApplicationConstants.ScreeningResults.Passed && - application.Status != ApplicationConstants.ApplicationStatuses.Approved && - application.Status != ApplicationConstants.ApplicationStatuses.LeaseAccepted && - application.Status != ApplicationConstants.ApplicationStatuses.LeaseOffered && - application.Status != ApplicationConstants.ApplicationStatuses.Denied) - { - - } - @if (application.Status == ApplicationConstants.ApplicationStatuses.Approved && !hasLeaseOffer) - { - - } - @if (application.Status == ApplicationConstants.ApplicationStatuses.LeaseOffered && leaseOffer != null) - { - - } - @if (application.Status == ApplicationConstants.ApplicationStatuses.Approved || - application.Status == ApplicationConstants.ApplicationStatuses.LeaseOffered) - { - - } - else if (application.Status != ApplicationConstants.ApplicationStatuses.Denied && - application.Status != ApplicationConstants.ApplicationStatuses.Withdrawn && - application.Status != ApplicationConstants.ApplicationStatuses.LeaseAccepted) - { - - } -
    -
    -
    -
    -
    - -
    -
    -
    -
    Workflow Status
    -
    -
    -
    -
    - - Application Submitted -
    -
    - - Fee Paid -
    -
    - - Screening Initiated -
    -
    - - Background Check -
    -
    - - Credit Check -
    -
    - - Approved -
    - @if (application.Status == ApplicationConstants.ApplicationStatuses.Withdrawn) - { -
    - - Withdrawn -
    - } -
    -
    -
    -
    -
    - } -
    - - -@if (showDenyModal) -{ - -} - - -@if (showWithdrawModal) -{ - -} - - -@if (showCollectFeeModal) -{ - -} - - -@if (showBackgroundCheckModal) -{ - -} - - -@if (showCreditCheckModal) -{ - -} - - - -@code { - [Parameter] - public Guid ApplicationId { get; set; } - - private RentalApplication? application; - private ApplicationScreening? screening; - private LeaseOffer? leaseOffer; - private bool hasLeaseOffer = false; - private bool isLoading = true; - private bool isSubmitting = false; - private bool showDenyModal = false; - private bool showWithdrawModal = false; - private bool showCollectFeeModal = false; - private bool showBackgroundCheckModal = false; - private bool showCreditCheckModal = false; - private bool backgroundCheckDisposition = false; - private bool creditCheckDisposition = false; - private string errorMessage = string.Empty; - private string successMessage = string.Empty; - private string denyReason = string.Empty; - private string withdrawReason = string.Empty; - private string userId = string.Empty; - private Guid organizationId = Guid.Empty; - private FeePaymentModel feePaymentModel = new(); - private ScreeningDispositionModel backgroundCheckModel = new(); - private ScreeningDispositionModel creditCheckModel = new(); - - protected override async Task OnInitializedAsync() - { - try - { - var authState = await AuthStateProvider.GetAuthenticationStateAsync(); - userId = authState.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier)?.Value ?? string.Empty; - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - - await LoadApplication(); - } - catch (Exception ex) - { - errorMessage = $"Error loading application: {ex.Message}"; - } - finally - { - isLoading = false; - } - } - - private async Task LoadApplication() - { - application = await RentalApplicationService.GetRentalApplicationWithRelationsAsync(ApplicationId); - - if (application != null) - { - screening = await ScreeningService.GetScreeningByApplicationIdAsync(ApplicationId); - - // Check if a lease offer already exists for this application - leaseOffer = await LeaseOfferService.GetLeaseOfferByApplicationIdAsync(application.Id); - hasLeaseOffer = leaseOffer != null && !leaseOffer.IsDeleted; - } - } - - private async Task InitiateScreening() - { - if (application == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - // Request both background and credit checks by default - var result = await WorkflowService.InitiateScreeningAsync(ApplicationId, true, true); - - if (result.Success) - { - screening = result.Data; - successMessage = "Screening initiated successfully! Background and credit checks have been requested."; - await LoadApplication(); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error initiating screening: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private async Task ApproveApplication() - { - if (application == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - var result = await WorkflowService.ApproveApplicationAsync(ApplicationId); - - if (result.Success) - { - ToastService.ShowSuccess("Application approved! You can now generate a lease offer."); - Navigation.NavigateTo($"/propertymanagement/applications/{ApplicationId}/generate-lease-offer"); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error approving application: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private async Task DenyApplication() - { - if (application == null || string.IsNullOrWhiteSpace(denyReason)) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - var result = await WorkflowService.DenyApplicationAsync(ApplicationId, denyReason); - - if (result.Success) - { - ToastService.ShowInfo("Application denied."); - showDenyModal = false; - await LoadApplication(); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error denying application: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private async Task WithdrawApplication() - { - if (application == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - var result = await WorkflowService.WithdrawApplicationAsync(ApplicationId, withdrawReason ?? "Withdrawn by applicant"); - - if (result.Success) - { - ToastService.ShowInfo("Application withdrawn."); - showWithdrawModal = false; - await LoadApplication(); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error withdrawing application: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private async Task HandleCollectFee() - { - if (application == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - // Update application with fee payment details - application.ApplicationFeePaid = true; - application.ApplicationFeePaidOn = feePaymentModel.PaymentDate; - application.ApplicationFeePaymentMethod = feePaymentModel.PaymentMethod; - - // Transition to UnderReview status once fee is paid - if (application.Status == ApplicationConstants.ApplicationStatuses.Submitted) - { - application.Status = ApplicationConstants.ApplicationStatuses.UnderReview; - } - - await RentalApplicationService.UpdateAsync(application); - - var successMsg = $"Application fee of {application.ApplicationFee:C} collected via {feePaymentModel.PaymentMethod}"; - if (!string.IsNullOrEmpty(feePaymentModel.ReferenceNumber)) - { - successMsg += $" (Ref: {feePaymentModel.ReferenceNumber})"; - } - - ToastService.ShowSuccess(successMsg); - showCollectFeeModal = false; - feePaymentModel = new(); - await LoadApplication(); - } - catch (Exception ex) - { - errorMessage = $"Error recording fee payment: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private void ShowBackgroundCheckDisposition(bool passed) - { - backgroundCheckDisposition = passed; - backgroundCheckModel = new(); - showBackgroundCheckModal = true; - } - - private void ShowCreditCheckDisposition(bool passed) - { - creditCheckDisposition = passed; - creditCheckModel = new(); - showCreditCheckModal = true; - } - - private async Task HandleBackgroundCheckDisposition() - { - if (screening == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - screening.BackgroundCheckPassed = backgroundCheckDisposition; - screening.BackgroundCheckCompletedOn = DateTime.UtcNow; - screening.BackgroundCheckNotes = backgroundCheckModel.Notes; - - // Update overall result - await UpdateOverallScreeningResult(screening); - - await ScreeningService.UpdateAsync(screening); - - ToastService.ShowSuccess($"Background check marked as {(backgroundCheckDisposition ? "PASSED" : "FAILED")}"); - showBackgroundCheckModal = false; - await LoadApplication(); - } - catch (Exception ex) - { - errorMessage = $"Error updating background check: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private async Task HandleCreditCheckDisposition() - { - if (screening == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - screening.CreditCheckPassed = creditCheckDisposition; - screening.CreditCheckCompletedOn = DateTime.UtcNow; - screening.CreditScore = creditCheckModel.CreditScore; - screening.CreditCheckNotes = creditCheckModel.Notes; - - // Update overall result - await UpdateOverallScreeningResult(screening); - - await ScreeningService.UpdateAsync(screening); - - ToastService.ShowSuccess($"Credit check marked as {(creditCheckDisposition ? "PASSED" : "FAILED")}"); - showCreditCheckModal = false; - await LoadApplication(); - } - catch (Exception ex) - { - errorMessage = $"Error updating credit check: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private Task UpdateOverallScreeningResult(ApplicationScreening screening) - { - // If both checks are requested - if (screening.BackgroundCheckRequested && screening.CreditCheckRequested) - { - // If both have results - if (screening.BackgroundCheckPassed.HasValue && screening.CreditCheckPassed.HasValue) - { - // Both must pass - if (screening.BackgroundCheckPassed.Value && screening.CreditCheckPassed.Value) - { - screening.OverallResult = ApplicationConstants.ScreeningResults.Passed; - screening.ResultNotes = "All screening checks passed successfully."; - } - else - { - screening.OverallResult = ApplicationConstants.ScreeningResults.Failed; - var failedChecks = new List(); - if (!screening.BackgroundCheckPassed.Value) failedChecks.Add("Background Check"); - if (!screening.CreditCheckPassed.Value) failedChecks.Add("Credit Check"); - screening.ResultNotes = $"Failed: {string.Join(", ", failedChecks)}"; - } - } - else - { - screening.OverallResult = ApplicationConstants.ScreeningResults.Pending; - screening.ResultNotes = "Awaiting completion of all screening checks."; - } - } - // If only background check requested - else if (screening.BackgroundCheckRequested) - { - if (screening.BackgroundCheckPassed.HasValue) - { - screening.OverallResult = screening.BackgroundCheckPassed.Value - ? ApplicationConstants.ScreeningResults.Passed - : ApplicationConstants.ScreeningResults.Failed; - screening.ResultNotes = screening.BackgroundCheckPassed.Value - ? "Background check passed." - : "Background check failed."; - } - } - // If only credit check requested - else if (screening.CreditCheckRequested) - { - if (screening.CreditCheckPassed.HasValue) - { - screening.OverallResult = screening.CreditCheckPassed.Value - ? ApplicationConstants.ScreeningResults.Passed - : ApplicationConstants.ScreeningResults.Failed; - screening.ResultNotes = screening.CreditCheckPassed.Value - ? "Credit check passed." - : "Credit check failed."; - } - } - - return Task.CompletedTask; - } - - private void NavigateToGenerateLeaseOffer() - { - Navigation.NavigateTo($"/propertymanagement/applications/{ApplicationId}/generate-lease-offer"); - } - - private void NavigateToViewLeaseOffer() - { - if (leaseOffer != null) - { - Navigation.NavigateTo($"/propertymanagement/leaseoffers/view/{leaseOffer.Id}"); - } - } - - private void Cancel() - { - Navigation.NavigateTo("/propertymanagement/applications"); - } - - public class FeePaymentModel - { - [Required(ErrorMessage = "Payment method is required")] - public string PaymentMethod { get; set; } = string.Empty; - - public string? ReferenceNumber { get; set; } - - public DateTime PaymentDate { get; set; } = DateTime.Today; - - public string? Notes { get; set; } - } - - public class ScreeningDispositionModel - { - public int? CreditScore { get; set; } - - public string? Notes { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/Documents/Pages/Documents.razor b/4-Nine/Features/PropertyManagement/Documents/Pages/Documents.razor index 542dfe0..4b353c5 100644 --- a/4-Nine/Features/PropertyManagement/Documents/Pages/Documents.razor +++ b/4-Nine/Features/PropertyManagement/Documents/Pages/Documents.razor @@ -2,6 +2,7 @@ @using Nine.Features.PropertyManagement @using Nine.Core.Entities +@using Nine.Application.Models @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.Authorization @@ -19,68 +20,11 @@

    Documents

    -

    Documents uploaded in the last 30 days

    + @*

    @(showArchivedDocuments ? "Archived documents" : "Documents uploaded in the last 30 days")

    *@
    - -@if (isLoading) -{ -
    -
    - Loading... -
    -
    -} -else if (!allDocuments.Any()) -{ -
    -

    No Recent Documents

    -

    No documents have been uploaded in the last 30 days.

    -
    -} -else -{ - -
    -
    -
    - - -
    -
    -
    - -
    -
    -
    - - -
    -
    -
    - -
    -
    - - +
    +
    @@ -115,6 +59,82 @@ else
    +
    +@if (isLoading) +{ +
    +
    + Loading... +
    +
    +} + +
    +
    +
    + + +
    +
    +
    + +
    +
    +
    + + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + +@if (!allDocuments.Any()) +{ + @if (showArchivedDocuments) + { +
    +

    No Archived Documents

    +

    No archived documents found.

    +
    + } + else + { +
    +

    No Recent Documents

    +

    No documents have been uploaded in the last 30 days.

    +
    + } +} +else +{
    @@ -190,13 +210,22 @@ else - @if (lease != null) + + @if (!doc.IsArchived) + { + + } + else { - } -
    @@ -234,7 +263,15 @@ else } - Property + + + Lease Size @@ -258,6 +295,10 @@ else @doc.FileName + @if (showArchivedDocuments) + { + Archived + } @if (!string.IsNullOrEmpty(doc.Description)) {
    @doc.Description @@ -291,15 +332,24 @@ else - @if (lease != null) + + @if (!doc.IsArchived) { - } - + else + { + + } +
    @@ -334,8 +384,19 @@ else
    } + + @code { + private Guid _pendingDocId; + private CascadeSummary? _cascade; + private bool _showDeleteModal; + private bool _isProcessing; + private bool isLoading = true; + private bool showArchivedDocuments = false; private List allDocuments = new(); private List filteredDocuments = new(); private List pagedDocuments = new(); @@ -383,20 +444,37 @@ else return; } - // Get all documents from last 30 days for the user - var allUserDocs = await DocumentService.GetAllAsync(); - var thirtyDaysAgo = DateTime.UtcNow.AddDays(-30); - allDocuments = allUserDocs - .Where(d => d.CreatedOn >= thirtyDaysAgo && !d.IsDeleted) - .OrderByDescending(d => d.CreatedOn) + // Load documents with navigation properties included. Using GetDocumentsWithRelationsAsync + // ensures property/lease info is available even for archived properties — documents + // associated with an archived property should still be visible and grouped correctly. + var allUserDocs = await DocumentService.GetDocumentsWithRelationsAsync(showArchivedDocuments); + if (showArchivedDocuments) + { + allDocuments = allUserDocs + .Where(d => d.IsArchived) + .OrderByDescending(d => d.ArchivedOn) + .ToList(); + } + else + { + allDocuments = allUserDocs + .OrderByDescending(d => d.CreatedOn) + .ToList(); + } + + // Derive properties and leases from the loaded documents so that archived + // properties are included for grouping and display purposes. + properties = allDocuments + .Where(d => d.Property != null) + .Select(d => d.Property!) + .DistinctBy(p => p.Id) .ToList(); - // Load all leases and properties - var allLeases = await LeaseService.GetAllAsync(); - leases = allLeases.Where(l => !l.IsDeleted).ToList(); - - var allProperties = await PropertyService.GetAllAsync(); - properties = allProperties.Where(p => !p.IsDeleted).ToList(); + leases = allDocuments + .Where(d => d.Lease != null) + .Select(d => d.Lease!) + .DistinctBy(l => l.Id) + .ToList(); ApplyFilters(); } @@ -468,6 +546,9 @@ else nameof(Document.CreatedOn) => sortAscending ? filteredDocuments.OrderBy(d => d.CreatedOn).ToList() : filteredDocuments.OrderByDescending(d => d.CreatedOn).ToList(), + "PropertyAddress" => sortAscending + ? filteredDocuments.OrderBy(d => properties.FirstOrDefault(p => p.Id == d.PropertyId)?.Address ?? string.Empty).ToList() + : filteredDocuments.OrderByDescending(d => properties.FirstOrDefault(p => p.Id == d.PropertyId)?.Address ?? string.Empty).ToList(), _ => filteredDocuments.OrderByDescending(d => d.CreatedOn).ToList() }; } @@ -536,27 +617,62 @@ else await JSRuntime.InvokeVoidAsync("downloadFile", fileName, Convert.ToBase64String(fileData), mimeType); } - private void GoToLease(Guid leaseId) + private void GoToRelatedRecord(Document doc) { - Navigation.NavigateTo($"/propertymanagement/leases/{leaseId}"); + if (doc.LeaseId.HasValue) + Navigation.NavigateTo($"/propertymanagement/leases/{doc.LeaseId.Value}"); + else if (doc.TenantId.HasValue) + Navigation.NavigateTo($"/propertymanagement/tenants/{doc.TenantId.Value}"); + else if (doc.InvoiceId.HasValue) + Navigation.NavigateTo($"/propertymanagement/invoices/{doc.InvoiceId.Value}"); + else if (doc.PaymentId.HasValue) + Navigation.NavigateTo($"/propertymanagement/payments/{doc.PaymentId.Value}"); + else if (doc.RepairId.HasValue) + Navigation.NavigateTo($"/propertymanagement/repairs/{doc.RepairId.Value}"); + else if (doc.PropertyId.HasValue) + Navigation.NavigateTo($"/propertymanagement/properties/{doc.PropertyId.Value}"); } - private async Task DeleteDocument(Document doc) + private string GetRelatedRecordLabel(Document doc) { - var confirmed = await JSRuntime.InvokeAsync("confirm", $"Are you sure you want to delete '{doc.FileName}'? This action cannot be undone."); - - if (confirmed) - { - try - { - await DocumentService.DeleteAsync(doc.Id); - await LoadDocuments(); - } - catch (Exception ex) - { - await JSRuntime.InvokeVoidAsync("alert", $"Error deleting document: {ex.Message}"); - } - } + if (doc.LeaseId.HasValue) return "View Lease"; + if (doc.TenantId.HasValue) return "View Tenant"; + if (doc.InvoiceId.HasValue) return "View Invoice"; + if (doc.PaymentId.HasValue) return "View Payment"; + if (doc.RepairId.HasValue) return "View Repair"; + return "View Property"; + } + + private string GetRelatedRecordIcon(Document doc) + { + if (doc.LeaseId.HasValue) return "bi-file-text"; + if (doc.TenantId.HasValue) return "bi-person"; + if (doc.InvoiceId.HasValue) return "bi-receipt"; + if (doc.PaymentId.HasValue) return "bi-cash"; + if (doc.RepairId.HasValue) return "bi-tools"; + return "bi-house"; + } + + private async Task ShowDeleteModal(Guid id) + { + _pendingDocId = id; + _cascade = await DocumentService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await DocumentService.DeleteAsync(_pendingDocId); + _isProcessing = false; + CloseDeleteModal(); + await LoadDocuments(); + } + + private void CloseDeleteModal() + { + _showDeleteModal = false; + _cascade = null; } private string GetFileIcon(string extension) @@ -583,4 +699,30 @@ else _ => "bg-secondary" }; } + + private async Task ArchiveDocument(Document doc) + { + try + { + await DocumentService.ArchiveAsync(doc.Id); + await LoadDocuments(); + } + catch (Exception ex) + { + await JSRuntime.InvokeVoidAsync("alert", $"Error archiving document: {ex.Message}"); + } + } + + private async Task UnarchiveDocument(Document doc) + { + try + { + await DocumentService.RestoreAsync(doc.Id); + await LoadDocuments(); + } + catch (Exception ex) + { + await JSRuntime.InvokeVoidAsync("alert", $"Error unarchiving document: {ex.Message}"); + } + } } \ No newline at end of file diff --git a/4-Nine/Features/PropertyManagement/Inspections/Pages/Edit.razor b/4-Nine/Features/PropertyManagement/Inspections/Pages/Edit.razor index 9711419..f2dcf0e 100644 --- a/4-Nine/Features/PropertyManagement/Inspections/Pages/Edit.razor +++ b/4-Nine/Features/PropertyManagement/Inspections/Pages/Edit.razor @@ -1 +1,567 @@ -@page "/propertymanagement/inspections/{InspectionId:guid}/edit" \ No newline at end of file +@page "/propertymanagement/inspections/edit/{InspectionId:guid}" + +@using Nine.Core.Entities +@using Nine.Core.Validation +@using Nine.Features.PropertyManagement +@using Nine.Application.Services +@using Nine.Shared.Services +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components.Forms +@using System.ComponentModel.DataAnnotations + +@inject InspectionService InspectionService +@inject PropertyService PropertyService +@inject UserContextService UserContext +@inject NavigationManager NavigationManager +@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] +@rendermode InteractiveServer + +Edit Inspection + +
    +

    Edit Inspection

    + +
    + +@if (!string.IsNullOrEmpty(errorMessage)) +{ + +} + +@if (property == null || model == null) +{ +
    +
    + Loading... +
    +
    +} +else +{ + @if (!string.IsNullOrEmpty(successMessage)) + { + + } + +
    +
    + + + + + +
    +
    +
    Property Information
    +
    +
    +

    @property.Address

    +

    @property.City, @property.State @property.ZipCode

    +
    +
    + + +
    +
    +
    Inspection Details
    +
    +
    +
    +
    + + + +
    +
    + + + + + + + +
    +
    +
    + + +
    +
    +
    + + +
    +
    +
    Exterior Inspection
    + +
    +
    + + + + + + + +
    +
    + + +
    +
    +
    Interior Inspection
    + +
    +
    + + + + + +
    +
    + + +
    +
    +
    Kitchen
    + +
    +
    + + + + +
    +
    + + +
    +
    +
    Bathroom
    + +
    +
    + + + + +
    +
    + + +
    +
    +
    Systems & Safety
    + +
    +
    + + + + + +
    +
    + + +
    +
    +
    Overall Assessment
    +
    +
    +
    + + + + + + + +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    + + +
    +
    +
    + + +
    +
    +
    +
    Inspection Tips
    +
    +
    +
      +
    • Take photos of any issues found
    • +
    • Check all appliances for proper operation
    • +
    • Test all outlets and switches
    • +
    • Run water in all sinks/tubs
    • +
    • Check for signs of moisture/leaks
    • +
    • Note any safety concerns immediately
    • +
    • Document any tenant-caused damage
    • +
    +
    +
    +
    +
    +} + +@code { + [Parameter] + public Guid InspectionId { get; set; } + + private Inspection? inspection; + private Property? property; + private InspectionModel? model; + private string? errorMessage; + private string? successMessage; + private bool isSaving = false; + + protected override async Task OnInitializedAsync() + { + inspection = await InspectionService.GetByIdAsync(InspectionId); + + if (inspection == null) + { + errorMessage = "Inspection not found."; + return; + } + + property = await PropertyService.GetByIdAsync(inspection.PropertyId); + + if (property == null) + { + errorMessage = "Property not found."; + return; + } + + model = new InspectionModel + { + PropertyId = inspection.PropertyId, + LeaseId = inspection.LeaseId, + CompletedOn = inspection.CompletedOn, + InspectionType = inspection.InspectionType, + InspectedBy = inspection.InspectedBy, + ExteriorRoofGood = inspection.ExteriorRoofGood, + ExteriorRoofNotes = inspection.ExteriorRoofNotes, + ExteriorGuttersGood = inspection.ExteriorGuttersGood, + ExteriorGuttersNotes = inspection.ExteriorGuttersNotes, + ExteriorSidingGood = inspection.ExteriorSidingGood, + ExteriorSidingNotes = inspection.ExteriorSidingNotes, + ExteriorWindowsGood = inspection.ExteriorWindowsGood, + ExteriorWindowsNotes = inspection.ExteriorWindowsNotes, + ExteriorDoorsGood = inspection.ExteriorDoorsGood, + ExteriorDoorsNotes = inspection.ExteriorDoorsNotes, + ExteriorFoundationGood = inspection.ExteriorFoundationGood, + ExteriorFoundationNotes = inspection.ExteriorFoundationNotes, + LandscapingGood = inspection.LandscapingGood, + LandscapingNotes = inspection.LandscapingNotes, + InteriorWallsGood = inspection.InteriorWallsGood, + InteriorWallsNotes = inspection.InteriorWallsNotes, + InteriorCeilingsGood = inspection.InteriorCeilingsGood, + InteriorCeilingsNotes = inspection.InteriorCeilingsNotes, + InteriorFloorsGood = inspection.InteriorFloorsGood, + InteriorFloorsNotes = inspection.InteriorFloorsNotes, + InteriorDoorsGood = inspection.InteriorDoorsGood, + InteriorDoorsNotes = inspection.InteriorDoorsNotes, + InteriorWindowsGood = inspection.InteriorWindowsGood, + InteriorWindowsNotes = inspection.InteriorWindowsNotes, + KitchenAppliancesGood = inspection.KitchenAppliancesGood, + KitchenAppliancesNotes = inspection.KitchenAppliancesNotes, + KitchenCabinetsGood = inspection.KitchenCabinetsGood, + KitchenCabinetsNotes = inspection.KitchenCabinetsNotes, + KitchenCountersGood = inspection.KitchenCountersGood, + KitchenCountersNotes = inspection.KitchenCountersNotes, + KitchenSinkPlumbingGood = inspection.KitchenSinkPlumbingGood, + KitchenSinkPlumbingNotes = inspection.KitchenSinkPlumbingNotes, + BathroomToiletGood = inspection.BathroomToiletGood, + BathroomToiletNotes = inspection.BathroomToiletNotes, + BathroomSinkGood = inspection.BathroomSinkGood, + BathroomSinkNotes = inspection.BathroomSinkNotes, + BathroomTubShowerGood = inspection.BathroomTubShowerGood, + BathroomTubShowerNotes = inspection.BathroomTubShowerNotes, + BathroomVentilationGood = inspection.BathroomVentilationGood, + BathroomVentilationNotes = inspection.BathroomVentilationNotes, + HvacSystemGood = inspection.HvacSystemGood, + HvacSystemNotes = inspection.HvacSystemNotes, + ElectricalSystemGood = inspection.ElectricalSystemGood, + ElectricalSystemNotes = inspection.ElectricalSystemNotes, + PlumbingSystemGood = inspection.PlumbingSystemGood, + PlumbingSystemNotes = inspection.PlumbingSystemNotes, + SmokeDetectorsGood = inspection.SmokeDetectorsGood, + SmokeDetectorsNotes = inspection.SmokeDetectorsNotes, + CarbonMonoxideDetectorsGood = inspection.CarbonMonoxideDetectorsGood, + CarbonMonoxideDetectorsNotes = inspection.CarbonMonoxideDetectorsNotes, + OverallCondition = inspection.OverallCondition, + GeneralNotes = inspection.GeneralNotes, + ActionItemsRequired = inspection.ActionItemsRequired, + }; + } + + private async Task SaveInspection() + { + if (inspection == null || model == null) return; + + try + { + isSaving = true; + errorMessage = null; + successMessage = null; + + // Apply model changes onto the tracked entity; service sets tracking fields. + inspection.CompletedOn = model.CompletedOn; + inspection.InspectionType = model.InspectionType; + inspection.InspectedBy = model.InspectedBy; + inspection.ExteriorRoofGood = model.ExteriorRoofGood; + inspection.ExteriorRoofNotes = model.ExteriorRoofNotes; + inspection.ExteriorGuttersGood = model.ExteriorGuttersGood; + inspection.ExteriorGuttersNotes = model.ExteriorGuttersNotes; + inspection.ExteriorSidingGood = model.ExteriorSidingGood; + inspection.ExteriorSidingNotes = model.ExteriorSidingNotes; + inspection.ExteriorWindowsGood = model.ExteriorWindowsGood; + inspection.ExteriorWindowsNotes = model.ExteriorWindowsNotes; + inspection.ExteriorDoorsGood = model.ExteriorDoorsGood; + inspection.ExteriorDoorsNotes = model.ExteriorDoorsNotes; + inspection.ExteriorFoundationGood = model.ExteriorFoundationGood; + inspection.ExteriorFoundationNotes = model.ExteriorFoundationNotes; + inspection.LandscapingGood = model.LandscapingGood; + inspection.LandscapingNotes = model.LandscapingNotes; + inspection.InteriorWallsGood = model.InteriorWallsGood; + inspection.InteriorWallsNotes = model.InteriorWallsNotes; + inspection.InteriorCeilingsGood = model.InteriorCeilingsGood; + inspection.InteriorCeilingsNotes = model.InteriorCeilingsNotes; + inspection.InteriorFloorsGood = model.InteriorFloorsGood; + inspection.InteriorFloorsNotes = model.InteriorFloorsNotes; + inspection.InteriorDoorsGood = model.InteriorDoorsGood; + inspection.InteriorDoorsNotes = model.InteriorDoorsNotes; + inspection.InteriorWindowsGood = model.InteriorWindowsGood; + inspection.InteriorWindowsNotes = model.InteriorWindowsNotes; + inspection.KitchenAppliancesGood = model.KitchenAppliancesGood; + inspection.KitchenAppliancesNotes = model.KitchenAppliancesNotes; + inspection.KitchenCabinetsGood = model.KitchenCabinetsGood; + inspection.KitchenCabinetsNotes = model.KitchenCabinetsNotes; + inspection.KitchenCountersGood = model.KitchenCountersGood; + inspection.KitchenCountersNotes = model.KitchenCountersNotes; + inspection.KitchenSinkPlumbingGood = model.KitchenSinkPlumbingGood; + inspection.KitchenSinkPlumbingNotes = model.KitchenSinkPlumbingNotes; + inspection.BathroomToiletGood = model.BathroomToiletGood; + inspection.BathroomToiletNotes = model.BathroomToiletNotes; + inspection.BathroomSinkGood = model.BathroomSinkGood; + inspection.BathroomSinkNotes = model.BathroomSinkNotes; + inspection.BathroomTubShowerGood = model.BathroomTubShowerGood; + inspection.BathroomTubShowerNotes = model.BathroomTubShowerNotes; + inspection.BathroomVentilationGood = model.BathroomVentilationGood; + inspection.BathroomVentilationNotes = model.BathroomVentilationNotes; + inspection.HvacSystemGood = model.HvacSystemGood; + inspection.HvacSystemNotes = model.HvacSystemNotes; + inspection.ElectricalSystemGood = model.ElectricalSystemGood; + inspection.ElectricalSystemNotes = model.ElectricalSystemNotes; + inspection.PlumbingSystemGood = model.PlumbingSystemGood; + inspection.PlumbingSystemNotes = model.PlumbingSystemNotes; + inspection.SmokeDetectorsGood = model.SmokeDetectorsGood; + inspection.SmokeDetectorsNotes = model.SmokeDetectorsNotes; + inspection.CarbonMonoxideDetectorsGood = model.CarbonMonoxideDetectorsGood; + inspection.CarbonMonoxideDetectorsNotes = model.CarbonMonoxideDetectorsNotes; + inspection.OverallCondition = model.OverallCondition; + inspection.GeneralNotes = model.GeneralNotes; + inspection.ActionItemsRequired = model.ActionItemsRequired; + + await InspectionService.UpdateAsync(inspection); + + successMessage = "Inspection updated successfully!"; + + // Navigate to view inspection page after short delay + await Task.Delay(500); + NavigationManager.NavigateTo($"/propertymanagement/inspections/{inspection.Id}"); + } + catch (Exception ex) + { + errorMessage = $"Error saving inspection: {ex.Message}"; + } + finally + { + isSaving = false; + } + } + + private void Cancel() + { + NavigationManager.NavigateTo($"/propertymanagement/inspections/{InspectionId}"); + } + + private void MarkAllExteriorGood() + { + if (model == null) return; + model.ExteriorRoofGood = true; + model.ExteriorGuttersGood = true; + model.ExteriorSidingGood = true; + model.ExteriorWindowsGood = true; + model.ExteriorDoorsGood = true; + model.ExteriorFoundationGood = true; + model.LandscapingGood = true; + } + + private void MarkAllInteriorGood() + { + if (model == null) return; + model.InteriorWallsGood = true; + model.InteriorCeilingsGood = true; + model.InteriorFloorsGood = true; + model.InteriorDoorsGood = true; + model.InteriorWindowsGood = true; + } + + private void MarkAllKitchenGood() + { + if (model == null) return; + model.KitchenAppliancesGood = true; + model.KitchenCabinetsGood = true; + model.KitchenCountersGood = true; + model.KitchenSinkPlumbingGood = true; + } + + private void MarkAllBathroomGood() + { + if (model == null) return; + model.BathroomToiletGood = true; + model.BathroomSinkGood = true; + model.BathroomTubShowerGood = true; + model.BathroomVentilationGood = true; + } + + private void MarkAllSystemsGood() + { + if (model == null) return; + model.HvacSystemGood = true; + model.ElectricalSystemGood = true; + model.PlumbingSystemGood = true; + model.SmokeDetectorsGood = true; + model.CarbonMonoxideDetectorsGood = true; + } + + public class InspectionModel + { + [RequiredGuid] + public Guid PropertyId { get; set; } + + [OptionalGuid] + public Guid? LeaseId { get; set; } + + [Required] + public DateTime CompletedOn { get; set; } = DateTime.Today; + + [Required] + [StringLength(50)] + public string InspectionType { get; set; } = "Routine"; + + [StringLength(100)] + public string? InspectedBy { get; set; } + + // Exterior + public bool ExteriorRoofGood { get; set; } + public string? ExteriorRoofNotes { get; set; } + public bool ExteriorGuttersGood { get; set; } + public string? ExteriorGuttersNotes { get; set; } + public bool ExteriorSidingGood { get; set; } + public string? ExteriorSidingNotes { get; set; } + public bool ExteriorWindowsGood { get; set; } + public string? ExteriorWindowsNotes { get; set; } + public bool ExteriorDoorsGood { get; set; } + public string? ExteriorDoorsNotes { get; set; } + public bool ExteriorFoundationGood { get; set; } + public string? ExteriorFoundationNotes { get; set; } + public bool LandscapingGood { get; set; } + public string? LandscapingNotes { get; set; } + + // Interior + public bool InteriorWallsGood { get; set; } + public string? InteriorWallsNotes { get; set; } + public bool InteriorCeilingsGood { get; set; } + public string? InteriorCeilingsNotes { get; set; } + public bool InteriorFloorsGood { get; set; } + public string? InteriorFloorsNotes { get; set; } + public bool InteriorDoorsGood { get; set; } + public string? InteriorDoorsNotes { get; set; } + public bool InteriorWindowsGood { get; set; } + public string? InteriorWindowsNotes { get; set; } + + // Kitchen + public bool KitchenAppliancesGood { get; set; } + public string? KitchenAppliancesNotes { get; set; } + public bool KitchenCabinetsGood { get; set; } + public string? KitchenCabinetsNotes { get; set; } + public bool KitchenCountersGood { get; set; } + public string? KitchenCountersNotes { get; set; } + public bool KitchenSinkPlumbingGood { get; set; } + public string? KitchenSinkPlumbingNotes { get; set; } + + // Bathroom + public bool BathroomToiletGood { get; set; } + public string? BathroomToiletNotes { get; set; } + public bool BathroomSinkGood { get; set; } + public string? BathroomSinkNotes { get; set; } + public bool BathroomTubShowerGood { get; set; } + public string? BathroomTubShowerNotes { get; set; } + public bool BathroomVentilationGood { get; set; } + public string? BathroomVentilationNotes { get; set; } + + // Systems + public bool HvacSystemGood { get; set; } + public string? HvacSystemNotes { get; set; } + public bool ElectricalSystemGood { get; set; } + public string? ElectricalSystemNotes { get; set; } + public bool PlumbingSystemGood { get; set; } + public string? PlumbingSystemNotes { get; set; } + public bool SmokeDetectorsGood { get; set; } + public string? SmokeDetectorsNotes { get; set; } + public bool CarbonMonoxideDetectorsGood { get; set; } + public string? CarbonMonoxideDetectorsNotes { get; set; } + + // Overall + [Required] + [StringLength(50)] + public string OverallCondition { get; set; } = "Good"; + public string? GeneralNotes { get; set; } + public string? ActionItemsRequired { get; set; } + } +} diff --git a/4-Nine/Features/PropertyManagement/Inspections/Pages/Index.razor b/4-Nine/Features/PropertyManagement/Inspections/Pages/Index.razor index bb7b6c7..7e7ed32 100644 --- a/4-Nine/Features/PropertyManagement/Inspections/Pages/Index.razor +++ b/4-Nine/Features/PropertyManagement/Inspections/Pages/Index.razor @@ -5,7 +5,14 @@ @using Microsoft.AspNetCore.Authorization @inject PropertyService PropertyService +@inject InspectionService InspectionService @inject NavigationManager NavigationManager + +@inject DocumentService DocumentService +@inject ToastService ToastService + +@inject IJSRuntime JSRuntime + @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] @rendermode InteractiveServer @@ -17,7 +24,7 @@ Refresh
    - +
    @if (isLoading) {
    @@ -31,11 +38,11 @@ else
    -
    +
    -
    Overdue
    -

    @overdueProperties.Count

    - Inspections overdue +
    Scheduled
    +

    @scheduledProperties.Count

    + Future inspections
    @@ -49,11 +56,11 @@ else
    -
    +
    -
    Scheduled
    -

    @scheduledProperties.Count

    - Future inspections +
    Overdue
    +

    @overdueProperties.Count

    + Inspections overdue
    @@ -67,226 +74,545 @@ else
    - - - @if (overdueProperties.Any()) - { -
    -
    -
    Overdue Inspections
    -
    -
    -
    - - - - - - - - - - - - @foreach (var property in overdueProperties) - { - - - - - - - - } - -
    PropertyLast InspectionDue DateDays OverdueActions
    - @property.Address -
    @property.City, @property.State -
    - @if (property.LastRoutineInspectionDate.HasValue) - { - @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") - } - else - { - Never - } - @property.NextRoutineInspectionDueDate!.Value.ToString("MMM dd, yyyy") - @property.DaysOverdue days - -
    - - -
    -
    -
    +
    + +
    +
    +
    + +
    - } - - - @if (dueSoonProperties.Any()) - { -
    -
    -
    Due Within 30 Days
    +
    +
    +
    + +
    -
    -
    - - - - - - - - - - - - @foreach (var property in dueSoonProperties) - { - - - - - - - - } - -
    PropertyLast InspectionDue DateDays Until DueActions
    - @property.Address -
    @property.City, @property.State -
    - @if (property.LastRoutineInspectionDate.HasValue) - { - @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") - } - else - { - Never - } - @property.NextRoutineInspectionDueDate!.Value.ToString("MMM dd, yyyy") - @property.DaysUntilInspectionDue days - -
    - - -
    -
    -
    +
    + +
    - } +
    +
    + + - -
    -
    -
    All Properties
    -
    +
    -
    - - - - - - - - - - - - @foreach (var property in allProperties.OrderBy(p => p.NextRoutineInspectionDueDate ?? DateTime.MaxValue)) - { - - - - - - - - } - -
    PropertyLast InspectionNext DueStatusActions
    - @property.Address -
    @property.City, @property.State -
    - @if (property.LastRoutineInspectionDate.HasValue) + @if (activeTab == "upcoming") + { + @if (!upcomingProperties.Any()) + { +
    + +

    No upcoming inspections.

    +
    + } + else + { +
    + + + + + + + + + + + + @if (_groupByProperty) + { + @foreach (var group in _groupedUpcoming) { - @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") + + + + @foreach (var property in group) + { + + + + + + + + } } - else + } + else + { + @foreach (var property in PagedUpcoming) + { + + + + + + + + } + } + +
    Actions
    @group.Key @group.Count()
    + @property.Address +
    @property.City, @property.State +
    + @if (property.LastRoutineInspectionDate.HasValue) + { + @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") + } + else + { + Never + } + + @if (property.NextRoutineInspectionDueDate.HasValue) + { + @property.NextRoutineInspectionDueDate.Value.ToString("MMM dd, yyyy") + } + else + { + Not scheduled + } + + + @property.InspectionStatus + + +
    + + +
    +
    + @property.Address +
    @property.City, @property.State +
    + @if (property.LastRoutineInspectionDate.HasValue) + { + @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") + } + else + { + Never + } + + @if (property.NextRoutineInspectionDueDate.HasValue) + { + @property.NextRoutineInspectionDueDate.Value.ToString("MMM dd, yyyy") + } + else + { + Not scheduled + } + + + @property.InspectionStatus + + +
    + + +
    +
    +
    + @if (!_groupByProperty && UpcomingPageCount > 1) + { +
    + Showing @(((upcomingPage - 1) * pageSize) + 1)–@(Math.Min(upcomingPage * pageSize, upcomingProperties.Count)) of @upcomingProperties.Count +
    - @if (property.NextRoutineInspectionDueDate.HasValue) +
  • + +
  • + + + + } + } + } + else if (activeTab == "overdue") + { + @if (!overdueProperties.Any()) + { +
    + +

    No overdue inspections.

    +
    + } + else + { +
    + + + + + + + + + + + + @if (_groupByProperty) + { + @foreach (var group in _groupedOverdue) { - @property.NextRoutineInspectionDueDate.Value.ToString("MMM dd, yyyy") + + + + @foreach (var property in group) + { + + + + + + + + } } - else + } + else + { + @foreach (var property in PagedOverdue) + { + + + + + + + + } + } + +
    Actions
    @group.Key @group.Count()
    + @property.Address +
    @property.City, @property.State +
    + @if (property.LastRoutineInspectionDate.HasValue) + { + @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") + } + else + { + Never + } + @property.NextRoutineInspectionDueDate!.Value.ToString("MMM dd, yyyy") + @property.DaysOverdue days + +
    + + +
    +
    + @property.Address +
    @property.City, @property.State +
    + @if (property.LastRoutineInspectionDate.HasValue) + { + @property.LastRoutineInspectionDate.Value.ToString("MMM dd, yyyy") + } + else + { + Never + } + @property.NextRoutineInspectionDueDate!.Value.ToString("MMM dd, yyyy") + @property.DaysOverdue days + +
    + + +
    +
    +
    + @if (!_groupByProperty && OverduePageCount > 1) + { +
    + Showing @(((overduePage - 1) * pageSize) + 1)–@(Math.Min(overduePage * pageSize, overdueProperties.Count)) of @overdueProperties.Count +
    - - @property.InspectionStatus - - -
    - - -
    -
    -
    +
  • + +
  • + + +
    + } + } + } + else + { + @if (!_filteredInspections.Any()) + { +
    + +

    + @if (_showArchived) + { + No archived inspection records found. + } + else + { + No inspection records found. + } +

    +
    + } + else + { +
    + + + + + + + + + + + + @foreach (var insp in PagedRecords) + { + + + + + + + + } + +
    Actions
    + @insp.Property?.Address + @if (insp.IsArchived) + { +
    Archived + } +
    @insp.CompletedOn.ToString("MMM dd, yyyy")@insp.InspectionType@insp.OverallCondition +
    + + @if(insp.DocumentId.HasValue && insp.DocumentId != Guid.Empty){ + + } else { + + } + @if (!insp.IsArchived) + { + + } + else + { + + } +
    +
    +
    + @if (RecordsPageCount > 1) + { +
    + Showing @((_recordsPage - 1) * pageSize + 1)–@(Math.Min(_recordsPage * pageSize, _filteredInspections.Count)) of @_filteredInspections.Count + +
    + } + } + }
    } @code { private bool isLoading = true; + private string activeTab = "upcoming"; + private int pageSize = 10; + private int upcomingPage = 1; + private int overduePage = 1; + + private bool _showArchived; + private bool _groupByProperty; + private string _searchTerm = string.Empty; + + // Sort state per tab + private string _upcomingSortColumn = "NextDue"; + private bool _upcomingSortAscending = true; + private string _overdueSortColumn = "DaysOverdue"; + private bool _overdueSortAscending = false; + private string _recordsSortColumn = "CompletedOn"; + private bool _recordsSortAscending = false; + + // Records tab + private List _allInspectionsRaw = new(); + private List _filteredInspections = new(); + private int _recordsPage = 1; + private int RecordsPageCount => (int)Math.Ceiling(_filteredInspections.Count / (double)pageSize); + private IEnumerable PagedRecords => + _filteredInspections.Skip((_recordsPage - 1) * pageSize).Take(pageSize); + + // Raw lists (loaded from DB) + private List _allPropertiesRaw = new(); + private List _overdueRaw = new(); + + // Filtered/computed lists (used by UI) private List allProperties = new(); private List overdueProperties = new(); private List dueSoonProperties = new(); private List scheduledProperties = new(); private List notScheduledProperties = new(); + private List upcomingProperties = new(); + + private IEnumerable> _groupedUpcoming = Enumerable.Empty>(); + private IEnumerable> _groupedOverdue = Enumerable.Empty>(); + + private IEnumerable PagedUpcoming => + upcomingProperties.Skip((upcomingPage - 1) * pageSize).Take(pageSize); + + private IEnumerable PagedOverdue => + overdueProperties.Skip((overduePage - 1) * pageSize).Take(pageSize); + + private int UpcomingPageCount => (int)Math.Ceiling(upcomingProperties.Count / (double)pageSize); + private int OverduePageCount => (int)Math.Ceiling(overdueProperties.Count / (double)pageSize); protected override async Task OnInitializedAsync() { await LoadData(); } + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + var savedTab = await JSRuntime.InvokeAsync("localStorage.getItem", "inspectionListActiveTab"); + var savedGroup = await JSRuntime.InvokeAsync("localStorage.getItem", "inspectionListGroupByProperty"); + + bool needsRefresh = false; + + if (!string.IsNullOrEmpty(savedTab) && savedTab != activeTab) + { + activeTab = savedTab; + needsRefresh = true; + } + + if (savedGroup == "true" && !_groupByProperty) + { + _groupByProperty = true; + ApplyFilters(); + needsRefresh = true; + } + + if (needsRefresh) + StateHasChanged(); + } + } + private async Task LoadData() { isLoading = true; try { - allProperties = await PropertyService.GetAllAsync(); - overdueProperties = await PropertyService.GetPropertiesWithOverdueInspectionsAsync(); - dueSoonProperties = await PropertyService.GetPropertiesWithInspectionsDueSoonAsync(30); - - scheduledProperties = allProperties - .Where(p => p.NextRoutineInspectionDueDate.HasValue && - p.InspectionStatus == "Scheduled") - .ToList(); - - notScheduledProperties = allProperties - .Where(p => !p.NextRoutineInspectionDueDate.HasValue) - .ToList(); + _allPropertiesRaw = _showArchived + ? await PropertyService.GetArchivedAsync() + : await PropertyService.GetAllAsync(); + + _overdueRaw = _showArchived + ? new List() + : await PropertyService.GetPropertiesWithOverdueInspectionsAsync(); + + dueSoonProperties = _showArchived + ? new List() + : await PropertyService.GetPropertiesWithInspectionsDueSoonAsync(30); + + _allInspectionsRaw = await InspectionService.GetAllAsync(); + + ApplyFilters(); } finally { @@ -294,11 +620,167 @@ else } } + private void ApplyFilters() + { + var search = _searchTerm?.Trim() ?? string.Empty; + + allProperties = string.IsNullOrEmpty(search) + ? _allPropertiesRaw + : _allPropertiesRaw + .Where(p => p.Address.Contains(search, StringComparison.OrdinalIgnoreCase) || + (p.City != null && p.City.Contains(search, StringComparison.OrdinalIgnoreCase)) || + (p.State != null && p.State.Contains(search, StringComparison.OrdinalIgnoreCase))) + .ToList(); + + overdueProperties = string.IsNullOrEmpty(search) + ? _overdueRaw + : _overdueRaw + .Where(p => p.Address.Contains(search, StringComparison.OrdinalIgnoreCase) || + (p.City != null && p.City.Contains(search, StringComparison.OrdinalIgnoreCase)) || + (p.State != null && p.State.Contains(search, StringComparison.OrdinalIgnoreCase))) + .ToList(); + + scheduledProperties = allProperties + .Where(p => p.NextRoutineInspectionDueDate.HasValue && p.InspectionStatus == "Scheduled") + .ToList(); + + notScheduledProperties = allProperties + .Where(p => !p.NextRoutineInspectionDueDate.HasValue) + .ToList(); + + var overdueIds = overdueProperties.Select(p => p.Id).ToHashSet(); + upcomingProperties = allProperties + .Where(p => !overdueIds.Contains(p.Id)) + .ToList(); + + upcomingPage = 1; + overduePage = 1; + + // Filter inspection records + var baseRecords = _showArchived + ? _allInspectionsRaw.Where(i => i.IsArchived) + : _allInspectionsRaw.Where(i => !i.IsArchived); + + _filteredInspections = string.IsNullOrEmpty(search) + ? baseRecords.ToList() + : baseRecords + .Where(i => (i.Property?.Address?.Contains(search, StringComparison.OrdinalIgnoreCase) ?? false) || + i.InspectionType.Contains(search, StringComparison.OrdinalIgnoreCase) || + i.OverallCondition.Contains(search, StringComparison.OrdinalIgnoreCase)) + .ToList(); + + _recordsPage = 1; + ApplySort(); + } + + private void ApplySort() + { + upcomingProperties = _upcomingSortColumn switch + { + "Address" => _upcomingSortAscending + ? upcomingProperties.OrderBy(p => p.Address).ToList() + : upcomingProperties.OrderByDescending(p => p.Address).ToList(), + "LastInspection" => _upcomingSortAscending + ? upcomingProperties.OrderBy(p => p.LastRoutineInspectionDate ?? DateTime.MinValue).ToList() + : upcomingProperties.OrderByDescending(p => p.LastRoutineInspectionDate ?? DateTime.MinValue).ToList(), + "NextDue" => _upcomingSortAscending + ? upcomingProperties.OrderBy(p => p.NextRoutineInspectionDueDate ?? DateTime.MaxValue).ToList() + : upcomingProperties.OrderByDescending(p => p.NextRoutineInspectionDueDate ?? DateTime.MaxValue).ToList(), + "InspectionStatus" => _upcomingSortAscending + ? upcomingProperties.OrderBy(p => p.InspectionStatus).ToList() + : upcomingProperties.OrderByDescending(p => p.InspectionStatus).ToList(), + _ => upcomingProperties.OrderBy(p => p.NextRoutineInspectionDueDate ?? DateTime.MaxValue).ToList() + }; + + overdueProperties = _overdueSortColumn switch + { + "Address" => _overdueSortAscending + ? overdueProperties.OrderBy(p => p.Address).ToList() + : overdueProperties.OrderByDescending(p => p.Address).ToList(), + "LastInspection" => _overdueSortAscending + ? overdueProperties.OrderBy(p => p.LastRoutineInspectionDate ?? DateTime.MinValue).ToList() + : overdueProperties.OrderByDescending(p => p.LastRoutineInspectionDate ?? DateTime.MinValue).ToList(), + "DueDate" => _overdueSortAscending + ? overdueProperties.OrderBy(p => p.NextRoutineInspectionDueDate ?? DateTime.MaxValue).ToList() + : overdueProperties.OrderByDescending(p => p.NextRoutineInspectionDueDate ?? DateTime.MaxValue).ToList(), + "DaysOverdue" => _overdueSortAscending + ? overdueProperties.OrderBy(p => p.DaysOverdue).ToList() + : overdueProperties.OrderByDescending(p => p.DaysOverdue).ToList(), + _ => overdueProperties.OrderByDescending(p => p.DaysOverdue).ToList() + }; + + _filteredInspections = _recordsSortColumn switch + { + "Property" => _recordsSortAscending + ? _filteredInspections.OrderBy(i => i.Property?.Address).ToList() + : _filteredInspections.OrderByDescending(i => i.Property?.Address).ToList(), + "CompletedOn" => _recordsSortAscending + ? _filteredInspections.OrderBy(i => i.CompletedOn).ToList() + : _filteredInspections.OrderByDescending(i => i.CompletedOn).ToList(), + "InspectionType" => _recordsSortAscending + ? _filteredInspections.OrderBy(i => i.InspectionType).ToList() + : _filteredInspections.OrderByDescending(i => i.InspectionType).ToList(), + "OverallCondition" => _recordsSortAscending + ? _filteredInspections.OrderBy(i => i.OverallCondition).ToList() + : _filteredInspections.OrderByDescending(i => i.OverallCondition).ToList(), + _ => _filteredInspections.OrderByDescending(i => i.CompletedOn).ToList() + }; + + if (_groupByProperty) + { + _groupedUpcoming = upcomingProperties.GroupBy(p => p.Address ?? "No Address"); + _groupedOverdue = overdueProperties.GroupBy(p => p.Address ?? "No Address"); + } + else + { + _groupedUpcoming = Enumerable.Empty>(); + _groupedOverdue = Enumerable.Empty>(); + } + } + + private void SortUpcoming(string column) + { + if (_upcomingSortColumn == column) + _upcomingSortAscending = !_upcomingSortAscending; + else { _upcomingSortColumn = column; _upcomingSortAscending = true; } + ApplySort(); + } + + private void SortOverdue(string column) + { + if (_overdueSortColumn == column) + _overdueSortAscending = !_overdueSortAscending; + else { _overdueSortColumn = column; _overdueSortAscending = true; } + ApplySort(); + } + + private void SortRecords(string column) + { + if (_recordsSortColumn == column) + _recordsSortAscending = !_recordsSortAscending; + else { _recordsSortColumn = column; _recordsSortAscending = true; } + ApplySort(); + } + private async Task RefreshData() { await LoadData(); } + private async Task SetTab(string tab) + { + activeTab = tab; + upcomingPage = 1; + overduePage = 1; + await JSRuntime.InvokeVoidAsync("localStorage.setItem", "inspectionListActiveTab", tab); + } + + private async Task SaveGroupByAndApply() + { + ApplyFilters(); + await JSRuntime.InvokeVoidAsync("localStorage.setItem", "inspectionListGroupByProperty", _groupByProperty ? "true" : "false"); + } + private void ViewProperty(Guid propertyId) { NavigationManager.NavigateTo($"/propertymanagement/properties/{propertyId}"); @@ -309,6 +791,16 @@ else NavigationManager.NavigateTo($"/propertymanagement/inspections/create/{propertyId}"); } + private async Task ViewDocument(Guid documentId) + { + var document = await DocumentService.GetByIdAsync(documentId); + if (document != null) + { + var base64Data = Convert.ToBase64String(document.FileData); + await JSRuntime.InvokeVoidAsync("viewFile", base64Data, document.FileType); + } + } + private string GetInspectionStatusBadge(string status) { return status switch @@ -320,4 +812,48 @@ else _ => "bg-secondary" }; } + + private void ViewInspection(Guid id) + { + NavigationManager.NavigateTo($"/propertymanagement/inspections/{id}"); + } + + private async Task ArchiveInspectionRecord(Guid id) + { + try + { + await InspectionService.ArchiveAsync(id); + ToastService.ShowSuccess("Inspection archived."); + _allInspectionsRaw = await InspectionService.GetAllAsync(); + ApplyFilters(); + } + catch (Exception ex) + { + ToastService.ShowError($"Error archiving inspection: {ex.Message}"); + } + } + + private async Task RestoreInspectionRecord(Guid id) + { + try + { + await InspectionService.RestoreAsync(id); + ToastService.ShowSuccess("Inspection restored."); + _allInspectionsRaw = await InspectionService.GetAllAsync(); + ApplyFilters(); + } + catch (Exception ex) + { + ToastService.ShowError($"Error restoring inspection: {ex.Message}"); + } + } + + private string GetConditionBadge(string condition) => condition switch + { + "Excellent" => "bg-success", + "Good" => "bg-info", + "Fair" => "bg-warning", + "Poor" => "bg-danger", + _ => "bg-secondary" + }; } diff --git a/4-Nine/Features/PropertyManagement/Inspections/Pages/View.razor b/4-Nine/Features/PropertyManagement/Inspections/Pages/View.razor index 7062248..2a9b055 100644 --- a/4-Nine/Features/PropertyManagement/Inspections/Pages/View.razor +++ b/4-Nine/Features/PropertyManagement/Inspections/Pages/View.razor @@ -7,12 +7,14 @@ @using Nine.Application.Services.PdfGenerators @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components +@using Nine.Application.Models @inject InspectionService InspectionService @inject Application.Services.DocumentService DocumentService @inject UserContextService UserContext @inject NavigationManager NavigationManager @inject IJSRuntime JSRuntime +@inject ToastService ToastService @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] @rendermode InteractiveServer @@ -50,6 +52,21 @@ else Download PDF } + @if (!inspection.IsArchived) + { + + } + else + { + + } + @@ -221,6 +238,11 @@ else
    } + + @code { [Parameter] public Guid InspectionId { get; set; } @@ -230,6 +252,9 @@ else private string? errorMessage; private bool isGenerating = false; private Document? document = null; + private bool _showDeleteModal = false; + private CascadeSummary? _cascade; + private bool _isProcessing = false; protected override async Task OnInitializedAsync() { @@ -423,4 +448,53 @@ else NavigationManager.NavigateTo("/propertymanagement/properties"); } } + + private async Task ShowDeleteModal(Guid id) + { + _cascade = await InspectionService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await InspectionService.DeleteAsync(InspectionId); + _isProcessing = false; + CloseDeleteModal(); + BackToProperty(); + } + + private void CloseDeleteModal() + { + _showDeleteModal = false; + _cascade = null; + } + + private async Task ArchiveInspection() + { + try + { + await InspectionService.ArchiveAsync(InspectionId); + ToastService.ShowSuccess("Inspection archived successfully."); + inspection = await InspectionService.GetByIdAsync(InspectionId); + } + catch (Exception ex) + { + errorMessage = $"Error archiving inspection: {ex.Message}"; + } + } + + private async Task RestoreInspection() + { + try + { + await InspectionService.RestoreAsync(InspectionId); + ToastService.ShowSuccess("Inspection restored successfully."); + inspection = await InspectionService.GetByIdAsync(InspectionId); + } + catch (Exception ex) + { + errorMessage = $"Error restoring inspection: {ex.Message}"; + } + } } diff --git a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Accept.razor b/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Accept.razor deleted file mode 100644 index b7fba08..0000000 --- a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Accept.razor +++ /dev/null @@ -1,637 +0,0 @@ -@page "/propertymanagement/leases/{LeaseId:guid}/accept" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@using System.Net -@using System.ComponentModel.DataAnnotations - -@inject LeaseService LeaseService -@inject PropertyService PropertyService -@inject RentalApplicationService RentalApplicationService -@inject ProspectiveTenantService ProspectiveTenantService -@inject TenantConversionService TenantConversionService -@inject NavigationManager Navigation -@inject AuthenticationStateProvider AuthStateProvider -@inject UserContextService UserContext -@inject ToastService ToastService -@inject SecurityDepositService SecurityDepositService -@inject IHttpContextAccessor HttpContextAccessor - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Accept Lease Offer - -
    -
    -
    - -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (lease == null) - { -
    -

    Lease Not Found

    -

    The lease you are trying to access does not exist or you do not have permission to view it.

    -
    - Return to Leases -
    - } - else if (lease.Status != "Offered") - { -
    -

    Invalid Lease Status

    -

    This lease cannot be accepted. Current status: @lease.Status

    -
    - View Lease -
    - } - else if (isExpired) - { -
    -

    Lease Offer Expired

    -

    This lease offer expired on @lease.ExpiresOn?.ToString("MMM dd, yyyy"). A new offer must be generated.

    -
    - Return to Leases -
    - } - else - { -
    -
    -
    -
    -

    Accept Lease Offer

    -
    -
    - @if (!string.IsNullOrEmpty(errorMessage)) - { - - } - - @if (!string.IsNullOrEmpty(successMessage)) - { - - } - -
    - - Offer Expires: @lease.ExpiresOn?.ToString("MMM dd, yyyy h:mm tt") - (@GetTimeRemaining()) -
    - -
    -
    Lease Summary
    -
    -
    - Property:
    - @lease.Property?.Address -
    -
    - Lease Term:
    - @lease.StartDate.ToString("MMM dd, yyyy") - @lease.EndDate.ToString("MMM dd, yyyy") -
    -
    - Monthly Rent:
    - @lease.MonthlyRent.ToString("C") -
    -
    - Security Deposit:
    - @lease.SecurityDeposit.ToString("C") -
    -
    -
    - -
    -
    Lease Terms & Conditions
    -
    -
    -
    @lease.Terms
    -
    -
    -
    - - - - -
    -
    Prospective Tenant Information
    - @if (prospectiveTenant != null) - { -
    -
    - Name: @prospectiveTenant.FullName -
    -
    - Email: @prospectiveTenant.Email -
    -
    - Phone: @prospectiveTenant.Phone -
    -
    - Date of Birth: @prospectiveTenant.DateOfBirth?.ToString("MMM dd, yyyy") -
    -
    - } - else - { -
    - Unable to load prospective tenant information. -
    - } -
    - -
    -
    Signature & Acceptance
    - -
    - - - -
    - -
    - - - -
    - -
    - - - - @foreach (var method in ApplicationConstants.PaymentMethods.AllPaymentMethods) - { - - } - - -
    - -
    - - - Check number, bank transfer confirmation, etc. -
    - -
    - - -
    -
    - -
    - - Audit Trail: This acceptance will be recorded with the following information: -
      -
    • Acceptance timestamp: @DateTime.UtcNow.ToString("MMM dd, yyyy h:mm:ss tt UTC")
    • -
    • IP Address: @GetClientIpAddress()
    • -
    • Processed by: @userId
    • -
    -
    - -
    - -
    - - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    Next Steps
    -
    -
    -
      -
    1. Tenant record will be created automatically
    2. -
    3. Security deposit will be recorded and tracked
    4. -
    5. Deposit added to investment pool when lease starts
    6. -
    7. Property status will update to "Occupied"
    8. -
    9. All competing applications will be denied
    10. -
    11. Move-in inspection will be scheduled
    12. -
    -
    -
    - - @if (lease.Property != null) - { -
    -
    -
    Property Details
    -
    -
    -

    Type: @lease.Property.PropertyType

    -

    Bedrooms: @lease.Property.Bedrooms

    -

    Bathrooms: @lease.Property.Bathrooms

    -

    Sq Ft: @lease.Property.SquareFeet

    -
    -
    - } -
    -
    - } -
    - - -@if (showDeclineModal) -{ - -} - -@code { - [Parameter] - public Guid LeaseId { get; set; } - - private Lease? lease; - private ProspectiveTenant? prospectiveTenant; - private RentalApplication? application; - private LeaseAcceptanceModel acceptanceModel = new(); - private bool isLoading = true; - private bool isSubmitting = false; - private bool isExpired = false; - private bool showDeclineModal = false; - private string errorMessage = string.Empty; - private string successMessage = string.Empty; - private string declineReason = string.Empty; - private string userId = string.Empty; - private Guid organizationId = Guid.Empty; - - protected override async Task OnInitializedAsync() - { - try - { - var authState = await AuthStateProvider.GetAuthenticationStateAsync(); - userId = authState.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier)?.Value ?? string.Empty; - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - - await LoadLease(); - } - catch (Exception ex) - { - errorMessage = $"Error loading lease: {ex.Message}"; - } - finally - { - isLoading = false; - } - } - - private async Task LoadLease() - { - lease = await LeaseService.GetByIdAsync(LeaseId); - - if (lease != null) - { - // Check if expired - if (lease.ExpiresOn.HasValue && lease.ExpiresOn.Value < DateTime.UtcNow) - { - isExpired = true; - } - - // Find the application and prospective tenant - if (lease.Property != null) - { - var allApplications = await RentalApplicationService.GetAllAsync(); - application = allApplications.FirstOrDefault(a => - a.PropertyId == lease.PropertyId && - a.Status == ApplicationConstants.ApplicationStatuses.Approved); - - if (application != null) - { - prospectiveTenant = await ProspectiveTenantService.GetByIdAsync( - application.ProspectiveTenantId); - } - } - } - } - - private async Task HandleAcceptLease() - { - if (lease == null || prospectiveTenant == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - // Convert prospect to tenant - var tenant = await TenantConversionService.ConvertProspectToTenantAsync( - prospectiveTenant.Id); - - if (tenant == null) - { - errorMessage = "Failed to create tenant record."; - isSubmitting = false; - ToastService.ShowError(errorMessage); - Console.WriteLine(errorMessage); - return; - } - - // CRITICAL: Collect security deposit - this MUST succeed before proceeding - SecurityDeposit securityDeposit; - try - { - securityDeposit = await SecurityDepositService.CollectSecurityDepositAsync( - lease.Id, - lease.SecurityDeposit, - acceptanceModel.PaymentMethod, - acceptanceModel.TransactionReference, - tenant.Id); // Pass the newly created tenant ID - } - catch (Exception depositEx) - { - var message = depositEx.Message + (depositEx.InnerException != null ? $" Inner: {depositEx.InnerException.Message}" : string.Empty); - errorMessage = $"CRITICAL ERROR: Failed to collect security deposit. Lease acceptance aborted. Error: {message}"; - isSubmitting = false; - ToastService.ShowError(errorMessage); - return; - } - - if(securityDeposit == null || securityDeposit.Id == Guid.Empty) - { - errorMessage = "CRITICAL ERROR: Security deposit record not created. Lease acceptance aborted."; - isSubmitting = false; - ToastService.ShowError(errorMessage); - return; - } - - // Add deposit to investment pool (will start earning dividends) - try - { - await SecurityDepositService.AddToInvestmentPoolAsync(securityDeposit.Id); - } - catch (Exception poolEx) - { - // Non-critical: deposit collected but not added to pool yet - // Can be added manually later from Security Deposits page - var message = poolEx.Message + (poolEx.InnerException != null ? $" - {poolEx.InnerException}" : string.Empty); - ToastService.ShowWarning($"Security deposit collected but not added to investment pool: {message}"); - } - // Update lease with tenant ID and signed status - lease.TenantId = tenant.Id; - lease.Status = ApplicationConstants.LeaseStatuses.Active; - lease.SignedOn = DateTime.UtcNow; - lease.Notes += $"\n\nAccepted on: {DateTime.UtcNow:MMM dd, yyyy h:mm tt UTC}\n" + - $"IP Address: {GetClientIpAddress()}\n" + - $"Security Deposit: {lease.SecurityDeposit:C} ({acceptanceModel.PaymentMethod})\n" + - $"Transaction Ref: {acceptanceModel.TransactionReference ?? "N/A"}\n" + - $"Processed by: {userId}"; - - if (!string.IsNullOrWhiteSpace(acceptanceModel.Notes)) - { - lease.Notes += $"\nAcceptance Notes: {acceptanceModel.Notes}"; - } - - - await LeaseService.UpdateAsync(lease); - - // Update property status to Occupied - if (lease.Property != null) - { - lease.Property.Status = ApplicationConstants.PropertyStatuses.Occupied; - lease.Property.IsActive = false; - - await PropertyService.UpdateAsync(lease.Property); - } - - // Update application status - if (application != null) - { - application.Status = "LeaseAccepted"; // We'll add this status - - await RentalApplicationService.UpdateAsync(application); - } - - // Update prospect status to ConvertedToTenant - prospectiveTenant.Status = ApplicationConstants.ProspectiveStatuses.ConvertedToTenant; - - await ProspectiveTenantService.UpdateAsync(prospectiveTenant); - - ToastService.ShowSuccess($"Lease accepted! Tenant {tenant.FullName} created successfully."); - - // Navigate to the tenant view - Navigation.NavigateTo($"/propertymanagement/tenants/{tenant.Id}"); - } - catch (Exception ex) - { - var message = ex.Message + (ex.InnerException != null ? $" - {ex.InnerException}" : string.Empty); - errorMessage = $"Error accepting lease: {message}"; - ToastService.ShowError(errorMessage); - Console.WriteLine(errorMessage); - } - finally - { - isSubmitting = false; - } - } - - private async Task HandleDeclineLease() - { - if (lease == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - // Update lease status to declined - lease.Status = "Declined"; - lease.DeclinedOn = DateTime.UtcNow; - lease.Notes += $"\n\nDeclined on: {DateTime.UtcNow:MMM dd, yyyy h:mm tt UTC}\n" + - $"Declined by: {userId}\n" + - $"Reason: {(string.IsNullOrWhiteSpace(declineReason) ? "Not specified" : declineReason)}"; - await LeaseService.UpdateAsync(lease); - - // Check if there are other pending applications - var allApplications = await RentalApplicationService.GetAllAsync(); - var otherPendingApps = allApplications.Any(a => - a.PropertyId == lease.PropertyId && - (a.Status == ApplicationConstants.ApplicationStatuses.Submitted || - a.Status == ApplicationConstants.ApplicationStatuses.UnderReview || - a.Status == ApplicationConstants.ApplicationStatuses.Screening)); - - // Update property status - if (lease.Property != null) - { - lease.Property.Status = otherPendingApps - ? ApplicationConstants.PropertyStatuses.ApplicationPending - : ApplicationConstants.PropertyStatuses.Available; - lease.Property.IsActive = !otherPendingApps; - - await PropertyService.UpdateAsync(lease.Property); - } - - // Update application and prospect status - if (application != null) - { - application.Status = "LeaseDeclined"; - - await RentalApplicationService.UpdateAsync(application); - } - - if (prospectiveTenant != null) - { - prospectiveTenant.Status = "LeaseDeclined"; - - await ProspectiveTenantService.UpdateAsync(prospectiveTenant); - } - - showDeclineModal = false; - ToastService.ShowInfo("Lease offer declined."); - Navigation.NavigateTo("/propertymanagement/leases"); - } - catch (Exception ex) - { - errorMessage = $"Error declining lease: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private string GetTimeRemaining() - { - if (lease?.ExpiresOn == null) return "N/A"; - - var timeSpan = lease.ExpiresOn.Value - DateTime.UtcNow; - - if (timeSpan.TotalDays > 1) - return $"{(int)timeSpan.TotalDays} days remaining"; - else if (timeSpan.TotalHours > 1) - return $"{(int)timeSpan.TotalHours} hours remaining"; - else if (timeSpan.TotalMinutes > 0) - return $"{(int)timeSpan.TotalMinutes} minutes remaining"; - else - return "Expired"; - } - - private string GetClientIpAddress() - { - try - { - var context = HttpContextAccessor.HttpContext; - if (context != null) - { - var forwardedFor = context.Request.Headers["X-Forwarded-For"].FirstOrDefault(); - if (!string.IsNullOrEmpty(forwardedFor)) - { - return forwardedFor.Split(',')[0].Trim(); - } - return context.Connection.RemoteIpAddress?.ToString() ?? "Unknown"; - } - } - catch { } - - return "Unknown"; - } - - private void Cancel() - { - Navigation.NavigateTo($"/propertymanagement/leases/{LeaseId}"); - } - - public class LeaseAcceptanceModel - { - [Required(ErrorMessage = "You must confirm that the tenant agrees to the terms")] - public bool AgreesToTerms { get; set; } - - [Required(ErrorMessage = "You must confirm that the security deposit has been paid")] - public bool SecurityDepositPaid { get; set; } - - [Required(ErrorMessage = "Payment method is required")] - public string PaymentMethod { get; set; } = string.Empty; - - [StringLength(100)] - public string? TransactionReference { get; set; } - - [StringLength(1000)] - public string? Notes { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Create.razor b/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Create.razor deleted file mode 100644 index 7e731d9..0000000 --- a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Create.razor +++ /dev/null @@ -1,449 +0,0 @@ -@page "/propertymanagement/applications/{ApplicationId:guid}/generate-lease-offer" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Application.Services.Workflows -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@using System.ComponentModel.DataAnnotations - -@inject RentalApplicationService RentalApplicationService -@inject ApplicationWorkflowService WorkflowService -@inject NavigationManager Navigation -@inject AuthenticationStateProvider AuthStateProvider -@inject UserContextService UserContext -@inject ToastService ToastService - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Generate Lease Offer - -
    -
    -
    - -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (application == null) - { -
    -

    Application Not Found

    -

    The application you are trying to view does not exist or you do not have permission to access it.

    -
    - Return to Applications -
    - } - else - { -
    -
    -
    -
    -

    Generate Lease Offer

    -
    -
    - @if (!string.IsNullOrEmpty(errorMessage)) - { - - } - - - - -
    -
    Application Details
    -
    -
    - Applicant: @application.ProspectiveTenant?.FullName -
    -
    - Property: @application.Property?.Address -
    -
    - Applied On: @application.AppliedOn.ToString("MMM dd, yyyy") -
    -
    - Status: - @application.Status -
    -
    -
    - -
    -
    Lease Terms
    - -
    -
    - - - -
    -
    - - - - Duration: @CalculateDuration() months -
    -
    - -
    -
    - -
    - $ - -
    - -
    -
    - -
    - $ - -
    - -
    -
    - -
    -
    - - - -
    -
    - -
    -
    - - -
    -
    -
    - -
    - - Note: This lease offer will expire in 30 days. The prospective tenant must accept before @DateTime.UtcNow.AddDays(30).ToString("MMM dd, yyyy"). -
    - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    Workflow Status
    -
    -
    -
    -
    - - Application Submitted -
    -
    - - Application Approved -
    -
    - - Generating Lease Offer -
    -
    - - Awaiting Acceptance -
    -
    - - Lease Signed -
    -
    -
    -
    - - @if (application.Property != null) - { -
    -
    -
    Property Info
    -
    -
    -

    Address:
    @application.Property.Address

    -

    Type: @application.Property.PropertyType

    -

    Beds/Baths: @application.Property.Bedrooms / @application.Property.Bathrooms

    -

    Current Rent: @application.Property.MonthlyRent.ToString("C")

    -
    -
    - } -
    -
    - } -
    - - - -@code { - [Parameter] - public Guid ApplicationId { get; set; } - - private RentalApplication? application; - private LeaseOfferModel leaseModel = new(); - private bool isLoading = true; - private bool isSubmitting = false; - private string errorMessage = string.Empty; - private string userId = string.Empty; - private Guid organizationId = Guid.Empty; - - protected override async Task OnInitializedAsync() - { - try - { - userId = await UserContext.GetUserIdAsync() ?? string.Empty; - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - - await LoadApplication(); - } - catch (Exception ex) - { - errorMessage = $"Error loading application: {ex.Message}"; - } - finally - { - isLoading = false; - } - } - - private async Task LoadApplication() - { - application = await RentalApplicationService.GetRentalApplicationWithRelationsAsync(ApplicationId); - - if (application != null) - { - // Verify application is approved - if (application.Status != ApplicationConstants.ApplicationStatuses.Approved) - { - errorMessage = "Only approved applications can generate lease offers."; - return; - } - - // Pre-fill lease data from property and application - leaseModel.StartDate = DateTime.Today.AddDays(14); // Default 2 weeks from now - leaseModel.EndDate = leaseModel.StartDate.AddYears(1); // Default 1 year lease - leaseModel.MonthlyRent = application.Property?.MonthlyRent ?? 0; - leaseModel.SecurityDeposit = application.Property?.MonthlyRent ?? 0; // Default to 1 month rent - leaseModel.Terms = GetDefaultLeaseTerms(); - } - } - - private async Task HandleGenerateLeaseOffer() - { - if (application == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - // Validate dates - if (leaseModel.EndDate <= leaseModel.StartDate) - { - errorMessage = "End date must be after start date."; - return; - } - - // Use workflow service to generate lease offer - var offerModel = new Nine.Application.Services.Workflows.LeaseOfferModel - { - StartDate = leaseModel.StartDate, - EndDate = leaseModel.EndDate, - MonthlyRent = leaseModel.MonthlyRent, - SecurityDeposit = leaseModel.SecurityDeposit, - Terms = leaseModel.Terms, - Notes = leaseModel.Notes - }; - - var result = await WorkflowService.GenerateLeaseOfferAsync(application.Id, offerModel); - - if (result.Success) - { - ToastService.ShowSuccess("Lease offer generated successfully!"); - Navigation.NavigateTo($"/propertymanagement/leaseoffers/view/{result.Data!.Id}"); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error generating lease offer: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private async Task DenyCompetingApplications(int propertyId, int currentApplicationId) - { - // This method is no longer needed - workflow service handles it automatically - await Task.CompletedTask; - } - - private string GetDefaultLeaseTerms() - { - return @"STANDARD LEASE TERMS AND CONDITIONS - -1. RENT PAYMENT -- Rent is due on the 1st of each month -- Late fee of $50 applies after the 5th of the month -- Payment methods: Check, ACH, Online Portal - -2. SECURITY DEPOSIT -- Refundable upon lease termination -- Subject to deductions for damages beyond normal wear and tear -- Will be returned within 30 days of move-out - -3. UTILITIES -- Tenant responsible for: Electric, Gas, Water, Internet -- Landlord responsible for: Trash collection - -4. MAINTENANCE -- Tenant must report maintenance issues within 24 hours -- Emergency repairs available 24/7 -- Routine maintenance requests processed within 48 hours - -5. OCCUPANCY -- Only approved occupants may reside in the property -- No subletting without written permission - -6. PETS -- Pet policy as agreed upon separately -- Pet deposit may apply - -7. TERMINATION -- 60-day notice required for non-renewal -- Early termination subject to fees - -8. OTHER -- No smoking inside the property -- Tenant must maintain renter's insurance -- Property inspections conducted quarterly"; - } - - private int CalculateDuration() - { - if (leaseModel.EndDate <= leaseModel.StartDate) - return 0; - - var months = ((leaseModel.EndDate.Year - leaseModel.StartDate.Year) * 12) + - leaseModel.EndDate.Month - leaseModel.StartDate.Month; - return months; - } - - private void Cancel() - { - Navigation.NavigateTo($"/propertymanagement/applications/{ApplicationId}"); - } - - public class LeaseOfferModel - { - [Required] - public DateTime StartDate { get; set; } = DateTime.Today.AddDays(14); - - [Required] - public DateTime EndDate { get; set; } = DateTime.Today.AddYears(1).AddDays(14); - - [Required] - [Range(0.01, double.MaxValue, ErrorMessage = "Monthly rent must be greater than 0")] - public decimal MonthlyRent { get; set; } - - [Required] - [Range(0, double.MaxValue, ErrorMessage = "Security deposit cannot be negative")] - public decimal SecurityDeposit { get; set; } - - [Required] - [StringLength(5000)] - public string Terms { get; set; } = string.Empty; - - [StringLength(1000)] - public string? Notes { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Index.razor b/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Index.razor deleted file mode 100644 index 1e410ce..0000000 --- a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/Index.razor +++ /dev/null @@ -1,165 +0,0 @@ -@page "/propertymanagement/leaseoffers" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization - -@inject NavigationManager Navigation -@inject UserContextService UserContext -@inject RentalApplicationService RentalApplicationService -@inject LeaseOfferService LeaseOfferService - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Lease Offers - Property Management - -
    -

    Lease Offers

    -
    - -@if (isLoading) -{ -
    -
    - Loading... -
    -
    -} -else if (!leaseOffers.Any()) -{ -
    -

    No Lease Offers

    -

    There are currently no lease offers in the system.

    -
    -} -else -{ -
    -
    -
    - - - - - - - - - - - - - - @foreach (var offer in leaseOffers) - { - - - - - - - - - - } - -
    PropertyProspective TenantOffered OnExpires OnMonthly RentStatusActions
    - @offer.Property?.Address
    - @offer.Property?.City, @offer.Property?.State -
    - @offer.ProspectiveTenant?.FullName
    - @offer.ProspectiveTenant?.Email -
    @offer.OfferedOn.ToString("MMM dd, yyyy") - @offer.ExpiresOn.ToString("MMM dd, yyyy") - @if (offer.ExpiresOn < DateTime.UtcNow && offer.Status == "Pending") - { -
    Expired - } - else if (offer.Status == "Pending" && (offer.ExpiresOn - DateTime.UtcNow).TotalDays <= 7) - { -
    Expires Soon - } -
    @offer.MonthlyRent.ToString("C") - @offer.Status - - - @if (offer.Status == "Accepted" && offer.ConvertedLeaseId.HasValue) - { - - } -
    -
    -
    -
    -} - -@code { - private List leaseOffers = new(); - private bool isLoading = true; - private Guid organizationId = Guid.Empty; - - protected override async Task OnInitializedAsync() - { - try - { - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - await LoadLeaseOffers(); - } - catch (Exception ex) - { - Console.WriteLine($"Error loading lease offers: {ex.Message}"); - } - finally - { - isLoading = false; - } - } - - private async Task LoadLeaseOffers() - { - // Get all lease offers for the organization - var allOffers = new List(); - - // We'll need to get offers from all applications - var applications = await RentalApplicationService.GetAllAsync(); - - foreach (var app in applications) - { - var offer = await LeaseOfferService.GetLeaseOfferByApplicationIdAsync(app.Id); - if (offer != null && !offer.IsDeleted) - { - allOffers.Add(offer); - } - } - - leaseOffers = allOffers.OrderByDescending(o => o.OfferedOn).ToList(); - } - - private void ViewOffer(Guid offerId) - { - Navigation.NavigateTo($"/propertymanagement/leaseoffers/view/{offerId}"); - } - - private void ViewLease(Guid leaseId) - { - Navigation.NavigateTo($"/propertymanagement/leases/{leaseId}"); - } - - private string GetStatusBadgeClass(string status) => status switch - { - "Pending" => "bg-warning", - "Accepted" => "bg-success", - "Declined" => "bg-danger", - "Expired" => "bg-secondary", - "Withdrawn" => "bg-dark", - _ => "bg-secondary" - }; -} diff --git a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/View.razor b/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/View.razor deleted file mode 100644 index d6916b2..0000000 --- a/4-Nine/Features/PropertyManagement/LeaseOffers/Pages/View.razor +++ /dev/null @@ -1,574 +0,0 @@ -@page "/propertymanagement/leaseoffers/view/{Id:guid}" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Application.Services.Workflows -@using Nine.Infrastructure.Data -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@using Microsoft.AspNetCore.Components.Authorization -@using Microsoft.EntityFrameworkCore -@using System.ComponentModel.DataAnnotations - -@inject LeaseOfferService LeaseOfferService -@inject ApplicationWorkflowService WorkflowService -@inject ApplicationDbContext DbContext -@inject NavigationManager Navigation -@inject AuthenticationStateProvider AuthStateProvider -@inject UserContextService UserContext -@inject ToastService ToastService -@inject SecurityDepositService SecurityDepositService - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Lease Offer Details - -
    -
    -
    - -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (leaseOffer == null) - { -
    -

    Lease Offer Not Found

    -

    The lease offer you are trying to view does not exist or you do not have permission to access it.

    -
    - Return to Applications -
    - } - else - { -
    -
    -
    -
    -
    -

    Lease Offer Details

    - @leaseOffer.Status -
    -
    -
    - @if (!string.IsNullOrEmpty(errorMessage)) - { - - } - - -
    -
    Property & Prospective Tenant
    -
    -
    - Property: -

    @leaseOffer.Property?.Address

    - @leaseOffer.Property?.City, @leaseOffer.Property?.State -
    -
    - Prospective Tenant: -

    @leaseOffer.ProspectiveTenant?.FullName

    - @leaseOffer.ProspectiveTenant?.Email -
    -
    -
    - - -
    -
    Lease Terms
    -
    -
    - Start Date: -

    @leaseOffer.StartDate.ToString("MMMM dd, yyyy")

    -
    -
    - End Date: -

    @leaseOffer.EndDate.ToString("MMMM dd, yyyy")

    - Duration: @CalculateDuration() months -
    -
    - Monthly Rent: -

    @leaseOffer.MonthlyRent.ToString("C")

    -
    -
    - Security Deposit: -

    @leaseOffer.SecurityDeposit.ToString("C")

    -
    -
    -
    - - -
    -
    Offer Status
    -
    -
    - Offered On: -

    @leaseOffer.OfferedOn.ToString("MMMM dd, yyyy")

    -
    -
    - Expires On: -

    @leaseOffer.ExpiresOn.ToString("MMMM dd, yyyy")

    - @if (leaseOffer.ExpiresOn < DateTime.UtcNow && leaseOffer.Status == "Pending") - { - Expired - } - else if ((leaseOffer.ExpiresOn - DateTime.UtcNow).TotalDays < 7 && leaseOffer.Status == "Pending") - { - Expires Soon - } -
    - @if (leaseOffer.RespondedOn.HasValue) - { -
    - Responded On: -

    @leaseOffer.RespondedOn?.ToString("MMMM dd, yyyy")

    -
    - } - @if (!string.IsNullOrEmpty(leaseOffer.ResponseNotes)) - { -
    - Response Notes: -

    @leaseOffer.ResponseNotes

    -
    - } -
    -
    - - - @if (!string.IsNullOrEmpty(leaseOffer.Terms)) - { -
    -
    Terms & Conditions
    -
    @leaseOffer.Terms
    -
    - } - - - @if (!string.IsNullOrEmpty(leaseOffer.Notes)) - { -
    -
    Internal Notes
    -
    - - (Not visible to tenant) -

    @leaseOffer.Notes

    -
    -
    - } - - -
    - -
    - @if (leaseOffer.Status == "Pending" && leaseOffer.ExpiresOn > DateTime.UtcNow) - { - - - } - @if (leaseOffer.ConvertedLeaseId.HasValue) - { - - } -
    -
    -
    -
    -
    - -
    -
    -
    -
    Workflow Status
    -
    -
    -
    -
    - - Application Approved -
    -
    - - Lease Offer Generated -
    -
    - - Awaiting Response -
    -
    - - Converted to Lease -
    -
    -
    -
    - - @if (leaseOffer.RentalApplication != null) - { -
    -
    -
    Application Info
    -
    -
    -

    Applied On:
    @leaseOffer.RentalApplication.AppliedOn.ToString("MMM dd, yyyy")

    -

    Application Fee:
    @leaseOffer.RentalApplication.ApplicationFee.ToString("C")

    -

    Monthly Income:
    @leaseOffer.RentalApplication.MonthlyIncome.ToString("C")

    -
    -
    - } -
    -
    - } -
    - - -@if (showAcceptModal) -{ - -} - - -@if (showDeclineModal) -{ - -} - - - -@code { - [Parameter] - public Guid Id { get; set; } - - private LeaseOffer? leaseOffer; - private bool isLoading = true; - private bool isSubmitting = false; - private bool showAcceptModal = false; - private bool showDeclineModal = false; - private string errorMessage = string.Empty; - private string declineReason = string.Empty; - private string userId = string.Empty; - private Guid organizationId = Guid.Empty; - private DepositPaymentModel depositPaymentModel = new(); - - protected override async Task OnInitializedAsync() - { - try - { - var authState = await AuthStateProvider.GetAuthenticationStateAsync(); - userId = authState.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier)?.Value ?? string.Empty; - organizationId = await UserContext.GetActiveOrganizationIdAsync() ?? Guid.Empty; - - await LoadLeaseOffer(); - } - catch (Exception ex) - { - errorMessage = $"Error loading lease offer: {ex.Message}"; - } - finally - { - isLoading = false; - } - } - - private async Task LoadLeaseOffer() - { - leaseOffer = await LeaseOfferService.GetLeaseOfferWithRelationsAsync(Id); - } - - private int CalculateDuration() - { - if (leaseOffer == null) return 0; - - var months = ((leaseOffer.EndDate.Year - leaseOffer.StartDate.Year) * 12) + - leaseOffer.EndDate.Month - leaseOffer.StartDate.Month; - return months; - } - - private string GetStatusBadgeClass(string status) - { - return status switch - { - "Pending" => "bg-warning", - "Accepted" => "bg-success", - "Declined" => "bg-danger", - "Expired" => "bg-secondary", - "Withdrawn" => "bg-dark", - _ => "bg-secondary" - }; - } - - private async Task AcceptOffer() - { - if (leaseOffer == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - var result = await WorkflowService.AcceptLeaseOfferAsync( - leaseOffer.Id, - depositPaymentModel.PaymentMethod, - depositPaymentModel.PaymentDate, - depositPaymentModel.ReferenceNumber, - depositPaymentModel.Notes); - - if (result.Success) - { - ToastService.ShowSuccess($"Lease offer accepted! Security deposit of {leaseOffer.SecurityDeposit:C} collected via {depositPaymentModel.PaymentMethod}."); - showAcceptModal = false; - depositPaymentModel = new(); - - // Navigate to the newly created lease - if (result.Data != null) - { - Navigation.NavigateTo($"/propertymanagement/leases/{result.Data.Id}/view"); - } - } - else - { - errorMessage = string.Join(", ", result.Errors); - ToastService.ShowError($"Failed to accept lease offer: {errorMessage}"); - } - } - catch (Exception ex) - { - var innerMessage = ex.InnerException?.Message ?? ex.Message; - var fullMessage = ex.InnerException != null - ? $"{ex.Message} | Inner: {innerMessage}" - : ex.Message; - errorMessage = $"Error accepting lease offer: {fullMessage}"; - ToastService.ShowError($"Failed to accept lease offer: {fullMessage}"); - } - finally - { - isSubmitting = false; - } - } - - private async Task DeclineOffer() - { - if (leaseOffer == null) return; - - isSubmitting = true; - errorMessage = string.Empty; - - try - { - var result = await WorkflowService.DeclineLeaseOfferAsync(leaseOffer.Id, declineReason ?? "Declined by applicant"); - - if (result.Success) - { - ToastService.ShowSuccess("Lease offer declined."); - showDeclineModal = false; - await LoadLeaseOffer(); - } - else - { - errorMessage = string.Join(", ", result.Errors); - } - } - catch (Exception ex) - { - errorMessage = $"Error declining offer: {ex.Message}"; - } - finally - { - isSubmitting = false; - } - } - - private void ViewConvertedLease() - { - if (leaseOffer?.ConvertedLeaseId.HasValue == true) - { - Navigation.NavigateTo($"/propertymanagement/leases/{leaseOffer.ConvertedLeaseId.Value}/view"); - } - } - - private void BackToApplication() - { - if (leaseOffer?.RentalApplicationId != null) - { - Navigation.NavigateTo($"/propertymanagement/applications/{leaseOffer.RentalApplicationId}/view"); - } - else - { - Navigation.NavigateTo("/propertymanagement/applications"); - } - } - - public class DepositPaymentModel - { - [Required(ErrorMessage = "Payment method is required")] - public string PaymentMethod { get; set; } = string.Empty; - - public string? ReferenceNumber { get; set; } - - public DateTime PaymentDate { get; set; } = DateTime.Today; - - public string? Notes { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/Leases/Pages/Create.razor b/4-Nine/Features/PropertyManagement/Leases/Pages/Create.razor index e813d48..009010c 100644 --- a/4-Nine/Features/PropertyManagement/Leases/Pages/Create.razor +++ b/4-Nine/Features/PropertyManagement/Leases/Pages/Create.razor @@ -2,4 +2,9 @@ @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] @rendermode InteractiveServer - + + +@code { + [SupplyParameterFromQuery] + public Guid? PropertyId { get; set; } +} diff --git a/4-Nine/Features/PropertyManagement/Leases/Pages/Index.razor b/4-Nine/Features/PropertyManagement/Leases/Pages/Index.razor index 8a63da4..e0e25a7 100644 --- a/4-Nine/Features/PropertyManagement/Leases/Pages/Index.razor +++ b/4-Nine/Features/PropertyManagement/Leases/Pages/Index.razor @@ -1,9 +1,11 @@ @page "/propertymanagement/leases" @using Microsoft.AspNetCore.Components.Authorization -@using Nine.Core.Entities @using Nine.Application.Services +@using Nine.Core.Constants +@using Nine.Core.Entities @using Nine.Shared.UI.Components.Entities.Leases +@using static Nine.Core.Constants.ApplicationConstants @inject NavigationManager NavigationManager @inject LeaseService LeaseService @inject TenantService TenantService @@ -58,6 +60,7 @@
    +
    @if (leases == null) {
    @@ -66,7 +69,7 @@
    } -else if (!leases.Any()) +else if (!leases.Any() && !_showArchived) {
    @if (filterTenant != null) @@ -93,7 +96,7 @@ else if (!leases.Any()) } else { - + OnDelete="@HandleDelete" + OnArchive="@HandleArchive" + OnRestore="@HandleRestore" + ShowArchived="@_showArchived" /> @if (totalPages > 1 && !groupByProperty) { @@ -164,6 +171,28 @@ else } } + + + + @code { [Parameter] [SupplyParameterFromQuery] @@ -186,7 +215,7 @@ else private IEnumerable> groupedLeases = Enumerable.Empty>(); private HashSet expandedProperties = new(); private string searchTerm = string.Empty; - private string selectedLeaseStatus = string.Empty; + private string selectedLeaseStatus = LeaseStatuses.Active; private Guid? selectedTenantId; private List? availableTenants; private int activeCount = 0; @@ -198,6 +227,14 @@ else // Paging variables private int currentPage = 1; + + // Archive/Delete modal state + private Guid _pendingId; + private CascadeSummary? _cascade; + private bool _showArchiveModal; + private bool _showDeleteModal; + private bool _isProcessing; + private bool _showArchived; private int pageSize = 10; private int totalPages = 1; private int totalRecords = 0; @@ -262,7 +299,9 @@ else return; } - var allLeases = await LeaseService.GetLeasesWithRelationsAsync(); + var allLeases = _showArchived + ? await LeaseService.GetArchivedLeasesWithRelationsAsync() + : await LeaseService.GetLeasesWithRelationsAsync(); leases = allLeases .Where(l => (!TenantId.HasValue || l.TenantId == TenantId.Value) && @@ -360,6 +399,13 @@ else FilterLeases(); await Task.CompletedTask; } + + private async Task HandleShowArchivedChanged(bool value) + { + _showArchived = value; + await LoadLeases(); + FilterLeases(); + } private async Task HandleSort((string Column, bool Ascending) sort) { @@ -390,7 +436,19 @@ else private async Task HandleDelete(Guid leaseId) { - await DeleteLease(leaseId); + await ShowDeleteModal(leaseId); + } + + private async Task HandleArchive(Guid leaseId) + { + await ShowArchiveModal(leaseId); + } + + private async Task HandleRestore(Guid leaseId) + { + await LeaseService.RestoreAsync(leaseId); + await LoadLeases(); + FilterLeases(); } private void TogglePropertyGroup(Guid propertyId) @@ -444,15 +502,15 @@ else { if (filteredLeases != null && filteredLeases.Any()) { - activeCount = filteredLeases.Count(l => l.Status == "Active"); + activeCount = filteredLeases.Count(l => ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(l.Status)); // Expiring within 90 days var ninetyDaysFromNow = DateTime.Now.AddDays(90); expiringSoonCount = filteredLeases.Count(l => - l.Status == "Active" && l.EndDate <= ninetyDaysFromNow); + ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(l.Status) && l.EndDate <= ninetyDaysFromNow); totalMonthlyRent = filteredLeases - .Where(l => l.Status == "Active") + .Where(l => ApplicationConstants.LeaseStatuses.ActiveStatuses.Contains(l.Status)) .Sum(l => l.MonthlyRent); } else @@ -463,24 +521,33 @@ else } } - private void ViewLeaseOffers() - { - NavigationManager.NavigateTo("/propertymanagement/leaseoffers"); - } - private void CreateLease() { - NavigationManager.NavigateTo("/propertymanagement/leaseoffers"); + NavigationManager.NavigateTo("/propertymanagement/leases/create"); } private void CreateLeaseForTenant() { - NavigationManager.NavigateTo("/propertymanagement/leaseoffers"); + if (TenantId.HasValue) + { + NavigationManager.NavigateTo($"/propertymanagement/leases/create?tenantId={TenantId.Value}"); + } + else + { + NavigationManager.NavigateTo("/propertymanagement/leases/create"); + } } private void CreateLeaseForProperty() { - NavigationManager.NavigateTo("/propertymanagement/leaseoffers"); + if (PropertyId.HasValue) + { + NavigationManager.NavigateTo($"/propertymanagement/leases/create?propertyId={PropertyId.Value}"); + } + else + { + NavigationManager.NavigateTo("/propertymanagement/leases/create"); + } } private void ClearFilter() @@ -507,17 +574,47 @@ else private async Task DeleteLease(Guid id) { - var authState = await AuthenticationStateTask; - var userId = authState.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier)?.Value; - - if (string.IsNullOrEmpty(userId)) - return; + await ShowDeleteModal(id); + } - var confirmed = await JSRuntime.InvokeAsync("confirm", $"Are you sure you want to delete lease {id}?"); - if (!confirmed) - return; + private async Task ShowArchiveModal(Guid id) + { + _pendingId = id; + _cascade = await LeaseService.GetArchiveCascadeSummaryAsync(id); + _showArchiveModal = true; + } - await LeaseService.DeleteAsync(id); + private async Task ShowDeleteModal(Guid id) + { + _pendingId = id; + _cascade = await LeaseService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmArchive() + { + _isProcessing = true; + await LeaseService.ArchiveAsync(_pendingId); + _isProcessing = false; + CloseModals(); await LoadLeases(); + FilterLeases(); + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await LeaseService.DeleteAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadLeases(); + FilterLeases(); + } + + private void CloseModals() + { + _showArchiveModal = false; + _showDeleteModal = false; + _cascade = null; } } diff --git a/4-Nine/Features/PropertyManagement/Leases/Pages/View.razor b/4-Nine/Features/PropertyManagement/Leases/Pages/View.razor index 6b136ea..a83c882 100644 --- a/4-Nine/Features/PropertyManagement/Leases/Pages/View.razor +++ b/4-Nine/Features/PropertyManagement/Leases/Pages/View.razor @@ -7,6 +7,7 @@ @inject InvoiceService InvoiceService @inject IJSRuntime JSRuntime @inject LeasePdfGenerator LeasePdfGenerator +@inject LeaseWorkflowService LeaseWorkflowService @inject NavigationManager Navigation @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] @@ -18,8 +19,14 @@ - + } +
    @@ -36,6 +43,7 @@
    - +
    @@ -58,11 +71,207 @@ -
    -
    -
    +@* ── Termination Notice Modal ─────────────────────────────────────────── *@ +@if (showTerminationNoticeModal) +{ + +} + +@* ── Early Termination Modal ──────────────────────────────────────────── *@ +@if (showEarlyTerminationModal) +{ + +} + +@* ── Complete Move-Out Modal ──────────────────────────────────────────── *@ +@if (showMoveOutModal) +{ + +} + +@* ── Convert to Month-to-Month Modal ─────────────────────────────────── *@ +@if (showConvertMTMModal) +{ + +} + +@* ── Renew Lease Modal ────────────────────────────────────────────────── *@ +@if (showRenewLeaseModal) +{ + +} @code { [Parameter] @@ -79,6 +288,38 @@ private List payments = new List(); private bool isGenerating = false; // flag to indicate if pdf document generation is in progress + private bool isSubmitting = false; + + // Termination Notice modal state + private bool showTerminationNoticeModal = false; + private string terminationNoticeType = ""; + private DateTime terminationNoticeDate = DateTime.Today; + private DateTime terminationExpectedMoveOutDate = DateTime.Today.AddDays(30); + private string terminationReason = ""; + + // Early Termination modal state + private bool showEarlyTerminationModal = false; + private string earlyTerminationType = ""; + private DateTime earlyTerminationDate = DateTime.Today; + private string earlyTerminationReason = ""; + + // Move-Out modal state + private bool showMoveOutModal = false; + private DateTime actualMoveOutDate = DateTime.Today; + private bool moveOutFinalInspection = false; + private bool moveOutKeysReturned = false; + private string moveOutNotes = ""; + + // Convert to Month-to-Month modal state + private bool showConvertMTMModal = false; + private decimal? mtmNewRent = null; + + // Renew Lease modal state + private bool showRenewLeaseModal = false; + private DateTime renewalNewStartDate = DateTime.Today; + private DateTime renewalNewEndDate = DateTime.Today.AddYears(1); + private decimal renewalNewRent = 0; + private string renewalNewTerms = ""; protected override async Task OnInitializedAsync() { @@ -95,11 +336,8 @@ .OrderBy(p => p.PaidOn) .ToList(); - // Load the document if it exists - if (lease.DocumentId != null) - { - document = await DocumentService.GetByIdAsync(lease.DocumentId.Value); - } + // Load the lease agreement document if one has been generated + document = lease.Documents.FirstOrDefault(d => d.DocumentType == ApplicationConstants.DocumentTypes.LeaseAgreement); } private async Task LoadLease() @@ -118,11 +356,9 @@ .Take(5) .ToList(); - // Load the document if it exists - if (lease.DocumentId != null) - { - document = await DocumentService.GetByIdAsync(lease.DocumentId.Value); - } + // Load the lease agreement document if one has been generated + var leaseDocuments = await DocumentService.GetDocumentsByLeaseIdAsync(lease.Id); + document = leaseDocuments.FirstOrDefault(d => d.DocumentType == ApplicationConstants.DocumentTypes.LeaseAgreement); } private void BackToProperty() @@ -130,6 +366,11 @@ Navigation.NavigateTo($"/propertymanagement/properties/{lease?.PropertyId}"); } + private void BackToList() + { + Navigation.NavigateTo($"/propertymanagement/leases"); + } + private void EditLease() { Navigation.NavigateTo($"/propertymanagement/leases/{lease?.Id}/edit"); @@ -187,11 +428,6 @@ // Save to database await DocumentService.CreateAsync(document); - // Update lease with DocumentId - lease.DocumentId = document.Id; - - await LeaseService.UpdateAsync(lease); - // Reload lease and document await LoadLease(); StateHasChanged(); @@ -235,4 +471,147 @@ { Navigation.NavigateTo($"/propertymanagement/payments/create?InvoiceId={invoiceId}"); } + + // ────────────────────────────────────────────────────────────────────── + // Lease Workflow Handlers + // ────────────────────────────────────────────────────────────────────── + + private void ShowRenewLeaseModal() + { + renewalNewStartDate = lease.EndDate.AddDays(1); + renewalNewEndDate = lease.EndDate.AddYears(1); + renewalNewRent = lease.MonthlyRent; + renewalNewTerms = lease.Terms ?? ""; + showRenewLeaseModal = true; + } + + private async Task RecordTerminationNotice() + { + if (string.IsNullOrWhiteSpace(terminationNoticeType)) return; + isSubmitting = true; + try + { + WorkflowResult result = await LeaseWorkflowService.RecordTerminationNoticeAsync( + lease.Id, terminationNoticeDate, terminationExpectedMoveOutDate, + terminationNoticeType, terminationReason); + if (result.Success) + { + showTerminationNoticeModal = false; + ResetTerminationNoticeForm(); + await LoadLease(); + StateHasChanged(); + } + } + finally { isSubmitting = false; } + } + + private async Task EarlyTerminateLease() + { + if (string.IsNullOrWhiteSpace(earlyTerminationType) || string.IsNullOrWhiteSpace(earlyTerminationReason)) return; + isSubmitting = true; + try + { + WorkflowResult result = await LeaseWorkflowService.EarlyTerminateAsync( + lease.Id, earlyTerminationType, earlyTerminationReason, earlyTerminationDate); + if (result.Success) + { + showEarlyTerminationModal = false; + ResetEarlyTerminationForm(); + await LoadLease(); + StateHasChanged(); + } + } + finally { isSubmitting = false; } + } + + private async Task CompleteMoveOut() + { + isSubmitting = true; + try + { + MoveOutModel model = new MoveOutModel + { + FinalInspectionCompleted = moveOutFinalInspection, + KeysReturned = moveOutKeysReturned, + Notes = moveOutNotes + }; + WorkflowResult result = await LeaseWorkflowService.CompleteMoveOutAsync( + lease.Id, actualMoveOutDate, model); + if (result.Success) + { + showMoveOutModal = false; + ResetMoveOutForm(); + await LoadLease(); + StateHasChanged(); + } + } + finally { isSubmitting = false; } + } + + private async Task ConvertToMonthToMonth() + { + isSubmitting = true; + try + { + WorkflowResult result = await LeaseWorkflowService.ConvertToMonthToMonthAsync( + lease.Id, mtmNewRent); + if (result.Success) + { + showConvertMTMModal = false; + mtmNewRent = null; + await LoadLease(); + StateHasChanged(); + } + } + finally { isSubmitting = false; } + } + + private async Task RenewLease() + { + if (renewalNewRent <= 0 || renewalNewEndDate <= lease.EndDate) return; + isSubmitting = true; + try + { + LeaseRenewalModel model = new LeaseRenewalModel + { + NewStartDate = renewalNewStartDate, + NewEndDate = renewalNewEndDate, + NewMonthlyRent = renewalNewRent, + NewTerms = string.IsNullOrWhiteSpace(renewalNewTerms) ? null : renewalNewTerms + }; + WorkflowResult result = await LeaseWorkflowService.RenewLeaseAsync(lease.Id, model); + if (result.Success && result.Data != null) + { + showRenewLeaseModal = false; + Navigation.NavigateTo($"/propertymanagement/leases/{result.Data.Id}"); + } else + { + await JSRuntime.InvokeVoidAsync("alert", $"Error renewing lease: {result.Message}"); + } + } + finally { isSubmitting = false; } + } + + private void ResetTerminationNoticeForm() + { + terminationNoticeType = ""; + terminationNoticeDate = DateTime.Today; + terminationExpectedMoveOutDate = DateTime.Today.AddDays(30); + terminationReason = ""; + } + + private void ResetEarlyTerminationForm() + { + earlyTerminationType = ""; + earlyTerminationDate = DateTime.Today; + earlyTerminationReason = ""; + } + + private void ResetMoveOutForm() + { + actualMoveOutDate = DateTime.Today; + moveOutFinalInspection = false; + moveOutKeysReturned = false; + moveOutNotes = ""; + } } \ No newline at end of file diff --git a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Create.razor b/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Create.razor deleted file mode 100644 index 4b01c7d..0000000 --- a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Create.razor +++ /dev/null @@ -1,329 +0,0 @@ -@page "/propertymanagement/maintenance/create/{PropertyId:guid?}" - -@using System.ComponentModel.DataAnnotations -@inject MaintenanceService MaintenanceService -@inject PropertyService PropertyService -@inject LeaseService LeaseService - -@inject UserContextService UserContextService -@inject NavigationManager NavigationManager - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -
    -
    -

    Record Repair

    - -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else - { -
    -
    -
    -
    - - - - -
    -
    - - - - @foreach (var property in properties) - { - - } - - -
    -
    - -
    - @if (currentLease != null) - { - @currentLease.Tenant?.FullName - @currentLease.Status - } - else - { - No active leases - } -
    -
    -
    - -
    - -
    - - - -
    -
    - - - - @foreach (var type in ApplicationConstants.MaintenanceRequestTypes.AllMaintenanceRequestTypes) - { - - } - - -
    -
    - -
    -
    - - - -
    -
    - -
    -
    - - -
    -
    - - - -
    -
    - -
    -
    - - -
    -
    - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    Information
    -
    -
    -
    Priority Levels
    -
      -
    • - Urgent - Immediate attention required -
    • -
    • - High - Should be addressed soon -
    • -
    • - Medium - Normal priority -
    • -
    • - Low - Can wait -
    • -
    - -
    - -
    Request Types
    -
      -
    • Plumbing
    • -
    • Electrical
    • -
    • Heating/Cooling
    • -
    • Appliance
    • -
    • Structural
    • -
    • Landscaping
    • -
    • Pest Control
    • -
    • Other
    • -
    -
    -
    -
    -
    - } -
    - -@code { - [Parameter] - [SupplyParameterFromQuery] - public Guid? PropertyId { get; set; } - - - [Parameter] - [SupplyParameterFromQuery] - public Guid? LeaseId { get; set; } - private MaintenanceRequestModel maintenanceRequest = new(); - private List properties = new(); - private Lease? currentLease = null; - private bool isLoading = true; - private bool isSaving = false; - - private ApplicationUser currentUser = default!; - - protected override async Task OnInitializedAsync() - { - await LoadData(); - currentUser = await UserContextService.GetCurrentUserAsync() ?? throw new InvalidOperationException("User context is required"); - } - - protected override async Task OnParametersSetAsync() - { - if (PropertyId.HasValue && PropertyId.Value != Guid.Empty && maintenanceRequest.PropertyId != PropertyId.Value) - { - maintenanceRequest.PropertyId = PropertyId.Value; - if (properties.Any()) - { - await LoadLeaseForProperty(PropertyId.Value); - } - } - if (LeaseId.HasValue && LeaseId.Value != Guid.Empty && maintenanceRequest.LeaseId != LeaseId.Value) - { - maintenanceRequest.LeaseId = LeaseId.Value; - } - } - - private async Task LoadData() - { - isLoading = true; - try - { - properties = await PropertyService.GetAllAsync(); - - if (PropertyId.HasValue && PropertyId.Value != Guid.Empty) - { - maintenanceRequest.PropertyId = PropertyId.Value; - await LoadLeaseForProperty(PropertyId.Value); - } - if (LeaseId.HasValue && LeaseId.Value != Guid.Empty) - { - maintenanceRequest.LeaseId = LeaseId.Value; - } - } - finally - { - isLoading = false; - } - } - - private async Task OnPropertyChangedAsync() - { - if (maintenanceRequest.PropertyId != Guid.Empty) - { - await LoadLeaseForProperty(maintenanceRequest.PropertyId); - } - else - { - currentLease = null; - maintenanceRequest.LeaseId = null; - } - } - - private async Task LoadLeaseForProperty(Guid propertyId) - { - var leases = await LeaseService.GetCurrentAndUpcomingLeasesByPropertyIdAsync(propertyId); - currentLease = leases.FirstOrDefault(); - maintenanceRequest.LeaseId = currentLease?.Id; - } - - private async Task HandleValidSubmit() - { - isSaving = true; - try - { - var request = new MaintenanceRequest - { - PropertyId = maintenanceRequest.PropertyId, - LeaseId = maintenanceRequest.LeaseId, - Title = maintenanceRequest.Title, - Description = maintenanceRequest.Description, - RequestType = maintenanceRequest.RequestType, - Priority = maintenanceRequest.Priority, - RequestedBy = currentUser.Id, - RequestedByEmail = currentUser.Email!, - RequestedByPhone = currentUser.PhoneNumber!, - RequestedOn = maintenanceRequest.CompletedOn, - ScheduledOn = maintenanceRequest.CompletedOn, - CompletedOn = maintenanceRequest.CompletedOn, - ActualCost = maintenanceRequest.ActualCost, - AssignedTo = maintenanceRequest.AssignedTo - }; - - await MaintenanceService.CreateAsync(request); - NavigationManager.NavigateTo("/propertymanagement/maintenance"); - } - finally - { - isSaving = false; - } - } - - private void Cancel() - { - NavigationManager.NavigateTo("/propertymanagement/maintenance"); - } - - public class MaintenanceRequestModel - { - [Required(ErrorMessage = "Property is required")] - public Guid PropertyId { get; set; } - - public Guid? LeaseId { get; set; } - - [Required(ErrorMessage = "Title is required")] - [StringLength(100, ErrorMessage = "Title cannot exceed 100 characters")] - public string Title { get; set; } = string.Empty; - - [Required(ErrorMessage = "Description is required")] - [StringLength(2000, ErrorMessage = "Description cannot exceed 2000 characters")] - public string Description { get; set; } = string.Empty; - - [Required(ErrorMessage = "Request type is required")] - public string RequestType { get; set; } = string.Empty; - - [Required(ErrorMessage = "Priority is required")] - public string Priority { get; set; } = "Medium"; - - public string RequestedBy { get; set; } = string.Empty; - public string RequestedByEmail { get; set; } = string.Empty; - public string RequestedByPhone { get; set; } = string.Empty; - - [Required] - public DateTime CompletedOn { get; set; } = DateTime.Today; - - public DateTime? ScheduledOn { get; set; } - - public decimal ActualCost { get; set; } - public string AssignedTo { get; set; } = string.Empty; - } -} - diff --git a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Edit.razor b/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Edit.razor deleted file mode 100644 index 4828b08..0000000 --- a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Edit.razor +++ /dev/null @@ -1,13 +0,0 @@ -@page "/propertymanagement/maintenance/{MaintenanceRequestId:guid}/edit" -@using Nine.Shared.UI.Features.PropertyManagement.MaintenanceRequests -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Edit Maintenance Request - - - -@code { - [Parameter] - public Guid MaintenanceRequestId { get; set; } -} diff --git a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Index.razor b/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Index.razor deleted file mode 100644 index e888c89..0000000 --- a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/Index.razor +++ /dev/null @@ -1,6 +0,0 @@ -@page "/propertymanagement/maintenance" -@using Nine.Shared.UI.Features.PropertyManagement.MaintenanceRequests -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - - diff --git a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/View.razor b/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/View.razor deleted file mode 100644 index cb6389d..0000000 --- a/4-Nine/Features/PropertyManagement/MaintenanceRequests/Pages/View.razor +++ /dev/null @@ -1,13 +0,0 @@ -@page "/propertymanagement/maintenance/{MaintenanceRequestId:guid}" -@using Nine.Shared.UI.Features.PropertyManagement.MaintenanceRequests -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Maintenance Request Details - - - -@code { - [Parameter] - public Guid MaintenanceRequestId { get; set; } -} diff --git a/4-Nine/Features/PropertyManagement/Properties/Pages/Delete.razor b/4-Nine/Features/PropertyManagement/Properties/Pages/Delete.razor deleted file mode 100644 index 0c06937..0000000 --- a/4-Nine/Features/PropertyManagement/Properties/Pages/Delete.razor +++ /dev/null @@ -1,327 +0,0 @@ -@page "/propertymanagement/properties/delete/{PropertyId:guid}" - -@inject PropertyService PropertyService -@inject LeaseService LeaseService -@inject InspectionService InspectionService -@inject InvoiceService InvoiceService -@inject NavigationManager Navigation - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@rendermode InteractiveServer - -Delete Property - Nine - -
    - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (property == null) - { -
    - Property not found. -
    - } - else - { -
    -
    -
    - -

    Delete Property

    -
    - -
    -
    -
    @property.Address
    -

    @property.City, @property.State @property.ZipCode

    - - @if (hasBlockers) - { -
    -
    Cannot Delete Property
    -

    The following items must be resolved before this property can be deleted:

    -
    - - @if (activeLeases.Any() || upcomingLeases.Any()) - { -
    -
    -
    Active or Upcoming Leases (@(activeLeases.Count + upcomingLeases.Count))
    -
    -
    -

    Terminate or decline these leases before deleting the property:

    -
      - @foreach (var lease in activeLeases) - { -
    • -
      -
      - @lease.Tenant?.FullName -
      - - Status: @lease.Status | - @lease.StartDate.ToString("MM/dd/yyyy") - @lease.EndDate.ToString("MM/dd/yyyy") - -
      - - View - -
      -
    • - } - @foreach (var lease in upcomingLeases) - { -
    • -
      -
      - @lease.Tenant?.FullName -
      - - Status: @lease.Status | - @lease.StartDate.ToString("MM/dd/yyyy") - @lease.EndDate.ToString("MM/dd/yyyy") - -
      - - View - -
      -
    • - } -
    -
    -
    - } - - @if (outstandingInspections.Any()) - { -
    -
    -
    Inspections with Action Items (@outstandingInspections.Count)
    -
    -
    -

    Complete or resolve these action items:

    -
      - @foreach (var inspection in outstandingInspections) - { -
    • -
      -
      - @inspection.InspectionType Inspection -
      - - Completed: @inspection.CompletedOn.ToString("MM/dd/yyyy") | - Condition: @inspection.OverallCondition - - @if (!string.IsNullOrWhiteSpace(inspection.ActionItemsRequired)) - { -
      - Action Items: -

      @inspection.ActionItemsRequired

      -
      - } -
      - - View - -
      -
    • - } -
    -
    -
    - } - - @if (unpaidInvoices.Any()) - { -
    -
    -
    Unpaid Invoices (@unpaidInvoices.Count)
    -
    -
    -

    Collect payment, void, or cancel these invoices:

    -
      - @foreach (var invoice in unpaidInvoices) - { -
    • -
      -
      - @invoice.InvoiceNumber - @invoice.Description -
      - - Status: @invoice.Status | - Amount: @invoice.Amount.ToString("C") | - Balance: @invoice.BalanceDue.ToString("C") | - Due: @invoice.DueOn.ToString("MM/dd/yyyy") - @if (invoice.IsOverdue) - { - (@invoice.DaysOverdue days overdue) - } - -
      - - View - -
      -
    • - } -
    -
    -
    - } - -
    - -
    - } - else - { -
    -
    Confirm Deletion
    -

    Are you sure you want to delete this property? This action cannot be undone.

    -
      -
    • All property information will be permanently removed
    • -
    • Historical lease and inspection records will be preserved
    • -
    • This action is irreversible
    • -
    -
    - -
    - - -
    - } -
    -
    -
    -
    - } -
    - -@code { - [Parameter] - public Guid PropertyId { get; set; } - - private Property? property; - private List activeLeases = new(); - private List upcomingLeases = new(); - private List outstandingInspections = new(); - private List unpaidInvoices = new(); - - private bool isLoading = true; - private bool isDeleting = false; - private bool hasBlockers = false; - - protected override async Task OnInitializedAsync() - { - await LoadPropertyAndBlockers(); - } - - private async Task LoadPropertyAndBlockers() - { - isLoading = true; - - try - { - property = await PropertyService.GetByIdAsync(PropertyId); - - if (property != null) - { - // Check for active/upcoming leases - var allLeases = await LeaseService.GetAllAsync(); - var propertyLeases = allLeases.Where(l => l.PropertyId == PropertyId).ToList(); - - activeLeases = propertyLeases - .Where(l => l.Status == ApplicationConstants.LeaseStatuses.Active) - .ToList(); - - upcomingLeases = propertyLeases - .Where(l => l.StartDate > DateTime.Today && - l.Status != ApplicationConstants.LeaseStatuses.Terminated && - l.Status != ApplicationConstants.LeaseStatuses.Declined && - l.Status != ApplicationConstants.LeaseStatuses.Expired) - .ToList(); - - // Check for inspections with action items - var allInspections = await InspectionService.GetAllAsync(); - outstandingInspections = allInspections - .Where(i => i.PropertyId == PropertyId && - !string.IsNullOrWhiteSpace(i.ActionItemsRequired)) - .ToList(); - - // Check for unpaid invoices (through leases) - var allInvoices = await InvoiceService.GetAllAsync(); - var propertyLeaseIds = propertyLeases.Select(l => l.Id).ToHashSet(); - unpaidInvoices = allInvoices - .Where(inv => propertyLeaseIds.Contains(inv.LeaseId) && - inv.Status != ApplicationConstants.InvoiceStatuses.Paid && - inv.Status != ApplicationConstants.InvoiceStatuses.Cancelled && - inv.Status != ApplicationConstants.InvoiceStatuses.Voided) - .ToList(); - - hasBlockers = activeLeases.Any() || upcomingLeases.Any() || - outstandingInspections.Any() || unpaidInvoices.Any(); - } - } - finally - { - isLoading = false; - } - } - - private async Task ConfirmDelete() - { - if (hasBlockers) - { - return; // Should not happen due to UI hiding the button - } - - isDeleting = true; - - try - { - await PropertyService.DeleteAsync(PropertyId); - Navigation.NavigateTo("/propertymanagement/properties"); - } - catch (Exception) - { - // Handle error (could add error message display) - isDeleting = false; - } - } - - private void Cancel() - { - Navigation.NavigateTo("/propertymanagement/properties"); - } - - private string GetInvoiceStatusBadgeClass(string status) - { - return status switch - { - ApplicationConstants.InvoiceStatuses.Paid => "bg-success", - ApplicationConstants.InvoiceStatuses.Pending => "bg-warning", - ApplicationConstants.InvoiceStatuses.Overdue => "bg-danger", - ApplicationConstants.InvoiceStatuses.PaidPartial => "bg-info", - ApplicationConstants.InvoiceStatuses.Cancelled => "bg-secondary", - ApplicationConstants.InvoiceStatuses.Voided => "bg-secondary", - _ => "bg-secondary" - }; - } -} diff --git a/4-Nine/Features/PropertyManagement/Properties/Pages/Index.razor b/4-Nine/Features/PropertyManagement/Properties/Pages/Index.razor index 15cec64..d2c7283 100644 --- a/4-Nine/Features/PropertyManagement/Properties/Pages/Index.razor +++ b/4-Nine/Features/PropertyManagement/Properties/Pages/Index.razor @@ -3,6 +3,7 @@ @inject PropertyService PropertyService @inject NavigationManager NavigationManager +@inject IJSRuntime JSRuntime @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager", "User")] @rendermode InteractiveServer @@ -20,7 +21,7 @@
    - @if (Properties.Count < maxProperties) + @if (currentTab == PropertyMarketTab.Available && availableTabCount < maxProperties) { + + + + +
    + + +
    +
    +
    + + + + + + + +@if (_showCannotProceedModal) +{ + +} + @code { + private enum PropertyMarketTab + { + Available, + Occupied, + OffMarket + } + + // Sub-statuses that still fall under the "Available" market tab because the + // property can fall through (application/lease fails, move-in falls through) + // back onto the market at any time before the lease is fully active. + private static readonly IReadOnlyList AvailableTabStatuses = new List + { + ApplicationConstants.PropertyStatuses.Available, + ApplicationConstants.PropertyStatuses.ApplicationPending, + ApplicationConstants.PropertyStatuses.LeasePending, + ApplicationConstants.PropertyStatuses.MoveInPending + }; + + // Sub-statuses under the "Occupied" market tab. + private static readonly IReadOnlyList OccupiedTabStatuses = new List + { + ApplicationConstants.PropertyStatuses.Occupied, + ApplicationConstants.PropertyStatuses.MoveOutPending + }; + + private List allProperties = new List(); private List Properties = new List(); private List filteredProperties = new List(); + private PropertyMarketTab currentTab = PropertyMarketTab.Available; + private int availableTabCount => allProperties.Count(p => AvailableTabStatuses.Contains(p.Status)); + private int occupiedTabCount => allProperties.Count(p => OccupiedTabStatuses.Contains(p.Status)); + private int offMarketTabCount => allProperties.Count(p => ApplicationConstants.PropertyStatuses.InactiveStatuses.Contains(p.Status)); private PropertyListViewMode viewMode = PropertyListViewMode.Table; private string sortColumn = nameof(Property.Address); private bool sortAscending = true; private string statusFilter = string.Empty; - private string searchTerm = string.Empty; - private int availableProperties = 0; - private int maxProperties = 9; - private int occupiedProperties = 0; - private decimal totalMonthlyRent = 0.00m; + // Archive/Delete modal state + private Guid _pendingId; + private CascadeSummary? _cascade; + private bool _showArchiveModal; + private bool _showDeleteModal; + private bool _showUnarchiveModal; + private CascadeSummary? _restoreSummary; + private bool _isProcessing; + private bool _showArchived; + + // Cannot proceed modal + private bool _showCannotProceedModal; + private List _cannotProceedReasons = new(); + protected override async Task OnInitializedAsync() { - Properties = await PropertyService.GetAllAsync(); - Console.WriteLine($"Loaded {Properties.Count} properties from the service."); - - availableProperties = Properties.Where(p => p.IsActive).Count(); - occupiedProperties = Properties.Where(p => !p.IsActive).Count(); - totalMonthlyRent = Properties.Where(p => !p.IsActive).Sum(p => p.MonthlyRent); - - ApplySort(); + await LoadProperties(); + } + + private async Task LoadProperties() + { + allProperties = _showArchived + ? await PropertyService.GetArchivedAsync() + : await PropertyService.GetAllAsync(); + availableProperties = allProperties.Count(p => p.Status == ApplicationConstants.PropertyStatuses.Available); + occupiedProperties = allProperties.Count(p => ApplicationConstants.PropertyStatuses.OccupiedStatuses.Contains(p.Status)); + totalMonthlyRent = allProperties.Where(p => p.IsActive).Sum(p => p.MonthlyRent); + ApplyTab(currentTab); + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + var saved = await JSRuntime.InvokeAsync("localStorage.getItem", "propertyListMarketTab"); + var savedTab = saved switch + { + "occupied" => PropertyMarketTab.Occupied, + "offmarket" => PropertyMarketTab.OffMarket, + _ => PropertyMarketTab.Available + }; + if (savedTab != currentTab) + { + ApplyTab(savedTab); + StateHasChanged(); + } + } } private void HandleSort((string Column, bool Ascending) sortInfo) @@ -90,6 +258,33 @@ ApplySort(); } + private void ApplyTab(PropertyMarketTab tab) + { + currentTab = tab; + statusFilter = string.Empty; + searchTerm = string.Empty; + Properties = tab switch + { + PropertyMarketTab.Available => allProperties.Where(p => AvailableTabStatuses.Contains(p.Status)).ToList(), + PropertyMarketTab.Occupied => allProperties.Where(p => OccupiedTabStatuses.Contains(p.Status)).ToList(), + PropertyMarketTab.OffMarket => allProperties.Where(p => ApplicationConstants.PropertyStatuses.InactiveStatuses.Contains(p.Status)).ToList(), + _ => allProperties.Where(p => AvailableTabStatuses.Contains(p.Status)).ToList() + }; + ApplySort(); + } + + private async Task SwitchTab(PropertyMarketTab tab) + { + ApplyTab(tab); + var value = tab switch + { + PropertyMarketTab.Occupied => "occupied", + PropertyMarketTab.OffMarket => "offmarket", + _ => "available" + }; + await JSRuntime.InvokeVoidAsync("localStorage.setItem", "propertyListMarketTab", value); + } + private void ApplySort() { // Apply status filter first @@ -175,4 +370,102 @@ { NavigationManager.NavigateTo($"/propertymanagement/properties/delete/{propertyId}"); } + + private bool CanArchiveOrDelete(Property property) + { + _cannotProceedReasons = new(); + if (!property.IsActive) + return true; + if (property.Status != ApplicationConstants.PropertyStatuses.Available) + _cannotProceedReasons.Add($"Status is '{property.Status}' — must be 'Available'"); + return !_cannotProceedReasons.Any(); + } + + private async Task ShowArchiveModal(Guid id) + { + var property = allProperties.FirstOrDefault(p => p.Id == id); + if (property != null && !CanArchiveOrDelete(property)) + { + _showCannotProceedModal = true; + return; + } + _pendingId = id; + _cascade = await PropertyService.GetArchiveCascadeSummaryAsync(id); + _showArchiveModal = true; + } + + private async Task ShowDeleteModal(Guid id) + { + var property = allProperties.FirstOrDefault(p => p.Id == id); + if (property != null && !CanArchiveOrDelete(property)) + { + _showCannotProceedModal = true; + return; + } + _pendingId = id; + _cascade = await PropertyService.GetDeleteCascadeSummaryAsync(id); + _showDeleteModal = true; + } + + private async Task ConfirmArchive() + { + _isProcessing = true; + await PropertyService.ArchiveAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadProperties(); + } + + private async Task ConfirmDelete() + { + _isProcessing = true; + await PropertyService.DeleteAsync(_pendingId); + _isProcessing = false; + CloseModals(); + await LoadProperties(); + } + + private async Task RestoreProperty(Guid id) + { + _pendingId = id; + _restoreSummary = await PropertyService.GetRestoreCascadeSummaryAsync(id); + if (_restoreSummary.HasRelatedRecords) + { + _showUnarchiveModal = true; + } + else + { + _isProcessing = true; + await PropertyService.RestorePropertyAsync(id, false); + _isProcessing = false; + await LoadProperties(); + } + } + + private async Task ConfirmUnarchiveAll() + { + _isProcessing = true; + await PropertyService.RestorePropertyAsync(_pendingId, true); + _isProcessing = false; + CloseModals(); + await LoadProperties(); + } + + private async Task ConfirmRestorePropertyOnly() + { + _isProcessing = true; + await PropertyService.RestorePropertyAsync(_pendingId, false); + _isProcessing = false; + CloseModals(); + await LoadProperties(); + } + + private void CloseModals() + { + _showArchiveModal = false; + _showDeleteModal = false; + _showUnarchiveModal = false; + _cascade = null; + _restoreSummary = null; + } } \ No newline at end of file diff --git a/4-Nine/Features/PropertyManagement/Properties/Pages/View.razor b/4-Nine/Features/PropertyManagement/Properties/Pages/View.razor index 551855f..94e82b1 100644 --- a/4-Nine/Features/PropertyManagement/Properties/Pages/View.razor +++ b/4-Nine/Features/PropertyManagement/Properties/Pages/View.razor @@ -6,13 +6,20 @@ @using Nine.Shared.UI.Components.Entities.Documents @using Nine.Shared.UI.Components.Entities.Inspections @using Nine.Shared.UI.Components.Entities.Repairs +@using Nine.Shared.UI.Components.Entities.PropertyExpenses @using Nine.Shared.UI.Features.PropertyManagement.Properties @using Nine.Shared.UI.Features.PropertyManagement.Leases +@using Microsoft.Extensions.Options @inject PropertyService PropertyService @inject InspectionService InspectionService @inject LeaseService LeaseService @inject RepairService RepairService +@inject PropertyExpenseService PropertyExpenseService +@inject ExpenseDueService ExpenseDueService +@inject ExpensePaymentService ExpensePaymentService +@inject ToastService ToastService +@inject IOptions AppSettings @inject NavigationManager Navigation @inject IJSRuntime JSRuntime @@ -59,16 +66,16 @@ - @if (property.IsActive) + @if (hasCurrentLease) { - } else { - } + @if (_hasArchivedRelated) + { + + } @@ -89,9 +102,36 @@ ShowViewButton = "@showInspectionViewButton" NextInspectionDate="@property.NextRoutineInspectionDueDate" /> +
    + +
    + + + + + + + +

    The following records are currently archived for this property:

    + @if (_archivedSummary != null) + { +
      + @foreach (var (label, count) in _archivedSummary.Counts.Where(c => c.Value > 0)) + { +
    • @count @label
    • + } +
    + } +

    Use the Show Archived toggle on each list page to view individual archived records. To restore all records, archive and then restore this property and choose Restore All.

    +
    + + + +
    + @code { [Parameter] public Guid PropertyId { get; set; } private Property property = new Property(); private Inspection lastInspection = new Inspection(); + private List propertyExpenses = new(); // Modal state private bool showLeaseModal = false; private bool showRepairModal = false; private bool showInspectionModal = false; + private bool _showArchivedRecordsModal = false; + private CascadeSummary? _archivedSummary; + private bool _hasArchivedRelated => _archivedSummary is { HasRelatedRecords: true }; private bool showInspectionViewButton => lastInspection != null && lastInspection.Id != Guid.Empty && property.LastRoutineInspectionDate.HasValue; + private bool hasCurrentLease => property.Leases.Any(l => !l.IsDeleted && + l.Status != ApplicationConstants.LeaseStatuses.Expired && + l.Status != ApplicationConstants.LeaseStatuses.Terminated && + l.Status != ApplicationConstants.LeaseStatuses.Declined); + + // Expense modal state + private bool showAddExpenseModal = false; + private bool showEditExpenseModal = false; + private bool isSavingExpense = false; + private string expenseErrorMessage = string.Empty; + private PropertyExpense? selectedExpense; + private ExpenseDue? selectedExpenseCurrentDue; + + private void ShowAddExpenseModal() { expenseErrorMessage = string.Empty; showAddExpenseModal = true; } + private void CloseAddExpenseModal() => showAddExpenseModal = false; + + private async Task ShowEditExpenseModal(PropertyExpense expense) + { + selectedExpense = expense; + selectedExpenseCurrentDue = await ExpenseDueService.GetCurrentCycleForPropertyExpenseAsync(expense.Id); + showEditExpenseModal = true; + } + + private void CloseEditExpenseModal() + { + showEditExpenseModal = false; + selectedExpense = null; + selectedExpenseCurrentDue = null; + } + + private async Task AddExpense(PropertyExpenseFormModel model) + { + try + { + isSavingExpense = true; + expenseErrorMessage = string.Empty; + var result = await PropertyExpenseService.CreateExpenseAsync(new PropertyExpense + { + PropertyId = PropertyId, + ExpenseType = model.ExpenseType, + Description = model.Description ?? string.Empty, + Amount = model.Amount, + EffectiveDate = model.DueDate, + RecurrencePattern = new RecurrencePattern { Frequency = model.Frequency }, + }, model.DueDate); + propertyExpenses = await PropertyExpenseService.GetExpensesByPropertyAsync(PropertyId); + showAddExpenseModal = false; + + if (result.WasBackfillClamped) + { + ToastService.ShowInfo( + $"'{result.Expense.ExpenseType}' was added. Cycles from January 1, {DateTime.Today.Year} forward were generated automatically; " + + "any earlier occurrences must be entered manually.", + "Backdated Expense"); + } + } + catch (Exception ex) { expenseErrorMessage = $"Error adding expense: {ex.Message}"; } + finally { isSavingExpense = false; } + } + + private async Task HandleCancelExpense(string? reason) + { + if (selectedExpense == null) return; + await PropertyExpenseService.CancelExpenseAsync(selectedExpense.Id, reason); + CloseEditExpenseModal(); + propertyExpenses = await PropertyExpenseService.GetExpensesByPropertyAsync(PropertyId); + } + + private async Task HandleVoidExpense() + { + if (selectedExpense == null) return; + await PropertyExpenseService.VoidExpenseAsync(selectedExpense.Id); + CloseEditExpenseModal(); + propertyExpenses = await PropertyExpenseService.GetExpensesByPropertyAsync(PropertyId); + } + + private async Task HandleMarkPaid(ExpensePaymentRequest request) + { + await ExpensePaymentService.RecordPaymentAsync(request.ExpenseDueId, request.AmountPaid, request.PaidOn, request.Notes); + if (selectedExpense != null) + { + selectedExpenseCurrentDue = await ExpenseDueService.GetCurrentCycleForPropertyExpenseAsync(selectedExpense.Id); + } + } + + private async Task HandleWaiveExpenseDue(string reason) + { + if (selectedExpenseCurrentDue == null) return; + await ExpenseDueService.WaiveExpenseDueAsync(selectedExpenseCurrentDue.Id, reason); + if (selectedExpense != null) + { + selectedExpenseCurrentDue = await ExpenseDueService.GetCurrentCycleForPropertyExpenseAsync(selectedExpense.Id); + } + } - // Selected entities for modals private Lease? selectedLease; private Repair? selectedRepair; private Inspection? selectedInspection; @@ -233,6 +391,8 @@ { property = await PropertyService.GetPropertyWithRelationsAsync(PropertyId) ?? new Property(); lastInspection = await InspectionService.GetLastRoutineInspectionAsync(PropertyId) ?? new Inspection(); + _archivedSummary = await PropertyService.GetRestoreCascadeSummaryAsync(PropertyId); + propertyExpenses = await PropertyExpenseService.GetExpensesByPropertyAsync(PropertyId); } private void EditProperty() @@ -280,7 +440,10 @@ private async Task ViewLease() { - var lease = property.Leases.FirstOrDefault(l => l.IsActive); + var lease = property.Leases + .Where(l => !l.IsDeleted) + .OrderByDescending(l => l.StartDate) + .FirstOrDefault(); if (lease != null) { selectedLease = await LeaseService.GetLeaseWithRelationsAsync(lease.Id); @@ -329,6 +492,16 @@ selectedInspection = null; } + private void ShowArchivedRecordsModal() + { + _showArchivedRecordsModal = true; + } + + private void CloseArchivedRecordsModal() + { + _showArchivedRecordsModal = false; + } + // View Full Page methods private void ViewLeaseFullPage(Guid leaseId) { diff --git a/4-Nine/Features/PropertyManagement/Prospects/Index.razor b/4-Nine/Features/PropertyManagement/Prospects/Index.razor deleted file mode 100644 index ee7554c..0000000 --- a/4-Nine/Features/PropertyManagement/Prospects/Index.razor +++ /dev/null @@ -1,475 +0,0 @@ -@page "/PropertyManagement/ProspectiveTenants" -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Nine.Core.Utilities -@using System.ComponentModel.DataAnnotations -@using Microsoft.AspNetCore.Authorization -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@inject UserContextService UserContext -@inject NavigationManager Navigation -@inject ToastService ToastService -@inject ProspectiveTenantService ProspectiveTenantService -@inject PropertyService PropertyService - -@rendermode InteractiveServer - -Prospective Tenants - -
    -
    -
    -

    Prospective Tenants

    -

    Manage leads and track the application pipeline

    -
    -
    - -
    -
    - - @if (showAddForm) - { -
    -
    -
    Add New Prospective Tenant
    -
    -
    - - - - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    - - - - @foreach (var state in States.StatesArray()) - { - - } - -
    -
    - -
    -
    - - - - @foreach (var source in ApplicationConstants.ProspectiveSources.AllProspectiveSources) - { - - } - -
    -
    - - - - @foreach (var property in properties) - { - - } - -
    -
    - -
    -
    - - -
    -
    - -
    - - -
    - -
    - - -
    -
    -
    -
    - } - - @if (loading) - { -
    -
    - Loading... -
    -
    - } - else - { -
    - -
    - @if (!filteredProspects.Any()) - { -
    - -

    No prospective tenants found

    -
    - } - else - { -
    - - - - - - - - - - - - - - @foreach (var prospect in filteredProspects) - { - - - - - - - - - - } - -
    NameContactInterested PropertyStatusSourceFirst ContactActions
    - @prospect.FullName - -
    @prospect.Email
    - @prospect.Phone -
    - @if (prospect.InterestedProperty != null) - { - @prospect.InterestedProperty.Address - } - else - { - Not specified - } - - - @GetStatusDisplay(prospect.Status) - - @(prospect.Source ?? "N/A")@prospect.FirstContactedOn?.ToString("MM/dd/yyyy") -
    - @if (prospect.Status == ApplicationConstants.ProspectiveStatuses.Lead) - { - - } - @if (prospect.Status == ApplicationConstants.ProspectiveStatuses.TourScheduled || - prospect.Status == ApplicationConstants.ProspectiveStatuses.Lead) - { - - } - - -
    -
    -
    - } -
    -
    - } -
    - -@code { - private List prospects = new(); - private List properties = new(); - private bool loading = true; - private bool showAddForm = false; - private ProspectViewModel newProspect = new(); - private string filterStatus = "All"; - - private List filteredProspects => - filterStatus == "All" - ? prospects - : prospects.Where(p => p.Status == filterStatus).ToList(); - - protected override async Task OnInitializedAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - loading = true; - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue && organizationId != Guid.Empty) - { - prospects = await ProspectiveTenantService.GetAllAsync(); - - // Load properties for dropdown - var dbContextFactory = Navigation.ToAbsoluteUri("/").ToString(); // Get service - // For now, we'll need to inject PropertyManagementService - var allProperties = await PropertyService.GetAllAsync(); - properties = allProperties.Where(p => p.IsActive).ToList(); - } - else - { - ToastService.ShowError("Organization context not available"); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error loading prospects: {ex.Message}"); - } - finally - { - loading = false; - } - } - - private void ShowAddProspect() - { - newProspect = new ProspectViewModel(); - showAddForm = true; - } - - private void CancelAdd() - { - showAddForm = false; - newProspect = new(); - } - - private async Task HandleAddProspect() - { - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - var userId = await UserContext.GetUserIdAsync(); - - if (!organizationId.HasValue || organizationId == Guid.Empty || string.IsNullOrEmpty(userId)) - { - ToastService.ShowError("User context not available"); - return; - } - - // Map ViewModel to Entity - var prospect = new ProspectiveTenant - { - FirstName = newProspect.FirstName, - LastName = newProspect.LastName, - Email = newProspect.Email, - Phone = newProspect.Phone, - DateOfBirth = newProspect.DateOfBirth, - IdentificationNumber = newProspect.IdentificationNumber, - IdentificationState = newProspect.IdentificationState, - Source = newProspect.Source, - Notes = newProspect.Notes, - InterestedPropertyId = newProspect.InterestedPropertyId, - DesiredMoveInDate = newProspect.DesiredMoveInDate, - OrganizationId = organizationId.Value, - }; - - await ProspectiveTenantService.CreateAsync(prospect); - - ToastService.ShowSuccess("Prospective tenant added successfully"); - showAddForm = false; - await LoadData(); - } - catch (Exception ex) - { - ToastService.ShowError($"Error adding prospect: {ex.Message}"); - } - } - - private void SetFilter(string status) - { - filterStatus = status; - } - - private void ScheduleTour(Guid prospectId) - { - Navigation.NavigateTo($"/PropertyManagement/Tours/Schedule/{prospectId}"); - } - - private void BeginApplication(Guid prospectId) - { - Navigation.NavigateTo($"/propertymanagement/prospects/{prospectId}/submit-application"); - } - - private void ViewDetails(Guid prospectId) - { - Navigation.NavigateTo($"/PropertyManagement/ProspectiveTenants/{prospectId}"); - } - - private async Task DeleteProspect(Guid prospectId) - { - // TODO: Add confirmation dialog in future sprint - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - var userId = await UserContext.GetUserIdAsync(); - - if (organizationId.HasValue && organizationId != Guid.Empty && !string.IsNullOrEmpty(userId)) - { - await ProspectiveTenantService.DeleteAsync(prospectId); - ToastService.ShowSuccess("Prospect deleted successfully"); - await LoadData(); - } - else - { - ToastService.ShowError("User context not available"); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error deleting prospect: {ex.Message}"); - } - } - - private string GetStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.ProspectiveStatuses.Lead => "bg-secondary", - var s when s == ApplicationConstants.ProspectiveStatuses.TourScheduled => "bg-info", - var s when s == ApplicationConstants.ProspectiveStatuses.Applied => "bg-primary", - var s when s == ApplicationConstants.ProspectiveStatuses.Screening => "bg-warning", - var s when s == ApplicationConstants.ProspectiveStatuses.Approved => "bg-success", - var s when s == ApplicationConstants.ProspectiveStatuses.Denied => "bg-danger", - _ => "bg-secondary" - }; - - private string GetStatusDisplay(string status) => status switch - { - var s when s == ApplicationConstants.ProspectiveStatuses.TourScheduled => "Tour Scheduled", - var s when s == ApplicationConstants.ProspectiveStatuses.ConvertedToTenant => "Converted", - _ => status - }; - - public class ProspectViewModel - { - [Required(ErrorMessage = "First name is required")] - [StringLength(100)] - public string FirstName { get; set; } = string.Empty; - - [Required(ErrorMessage = "Last name is required")] - [StringLength(100)] - public string LastName { get; set; } = string.Empty; - - [Required(ErrorMessage = "Email is required")] - [EmailAddress(ErrorMessage = "Invalid email address")] - [StringLength(200)] - public string Email { get; set; } = string.Empty; - - [Required(ErrorMessage = "Phone is required")] - [Phone(ErrorMessage = "Invalid phone number")] - [StringLength(20)] - public string Phone { get; set; } = string.Empty; - - public DateTime? DateOfBirth { get; set; } - - [StringLength(100)] - public string? IdentificationNumber { get; set; } - - [StringLength(2)] - public string? IdentificationState { get; set; } - - [StringLength(100)] - public string? Source { get; set; } - - [StringLength(2000)] - public string? Notes { get; set; } - - public Guid? InterestedPropertyId { get; set; } - - public DateTime? DesiredMoveInDate { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/Prospects/View.razor b/4-Nine/Features/PropertyManagement/Prospects/View.razor deleted file mode 100644 index 9c128f4..0000000 --- a/4-Nine/Features/PropertyManagement/Prospects/View.razor +++ /dev/null @@ -1,813 +0,0 @@ -@page "/PropertyManagement/ProspectiveTenants/{ProspectId:guid}" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Nine.Core.Utilities -@using System.ComponentModel.DataAnnotations -@using Microsoft.AspNetCore.Authorization - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@inject ProspectiveTenantService ProspectiveTenantService -@inject TourService TourService -@inject RentalApplicationService RentalApplicationService -@inject PropertyService PropertyService -@inject UserContextService UserContext -@inject NavigationManager Navigation -@inject ToastService ToastService - -@rendermode InteractiveServer - -Prospect Details - -
    -
    -
    - -
    -
    - - @if (loading) - { -
    -
    - Loading... -
    -
    - } - else if (prospect == null) - { -
    - Prospective tenant not found. -
    - } - else - { -
    -
    - -
    -
    -
    - Contact Information -
    -
    - - @GetStatusDisplay(prospect.Status) - - @if (!isEditing) - { - - } -
    -
    -
    - @if (isEditing) - { - - - - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    - - - - @foreach (var state in States.StatesArray()) - { - - } - -
    -
    - -
    -
    - - - - @foreach (var source in ApplicationConstants.ProspectiveSources.AllProspectiveSources) - { - - } - -
    -
    - - - - @foreach (var property in availableProperties) - { - - } - -
    -
    - -
    -
    - - -
    -
    - -
    - - -
    - -
    - - -
    -
    - } - else - { -
    -
    -
    -
    Name:
    -
    @prospect.FullName
    - -
    Email:
    -
    - - @prospect.Email - -
    - -
    Phone:
    -
    - - @prospect.Phone - -
    - - @if (prospect.DateOfBirth.HasValue) - { -
    Date of Birth:
    -
    @prospect.DateOfBirth.Value.ToString("MMM dd, yyyy")
    - } - - @if (!string.IsNullOrEmpty(prospect.IdentificationNumber)) - { -
    ID Number:
    -
    @prospect.IdentificationNumber @(!string.IsNullOrEmpty(prospect.IdentificationState) ? $"({prospect.IdentificationState})" : "")
    - } -
    -
    -
    -
    -
    Source:
    -
    @(prospect.Source ?? "N/A")
    - -
    First Contact:
    -
    @prospect.FirstContactedOn?.ToString("MMM dd, yyyy")
    - - @if (prospect.DesiredMoveInDate.HasValue) - { -
    Desired Move-In:
    -
    @prospect.DesiredMoveInDate.Value.ToString("MMM dd, yyyy")
    - } -
    -
    -
    - - @if (!string.IsNullOrEmpty(prospect.Notes)) - { -
    -
    - Notes: -

    @prospect.Notes

    -
    - } - - @if (prospect.InterestedProperty != null) - { -
    -
    - Interested Property: -
    - @prospect.InterestedProperty.Address
    - - @prospect.InterestedProperty.City, @prospect.InterestedProperty.State @prospect.InterestedProperty.ZipCode -
    - $@prospect.InterestedProperty.MonthlyRent.ToString("N0")/month -
    -
    - } - } -
    - -
    - - - @if (tours.Any()) - { -
    -
    -
    Tours History
    -
    -
    -
    - - - - - - - - - - - - - @foreach (var tour in tours.OrderByDescending(s => s.ScheduledOn)) - { - - - - - - - - - } - -
    Date & TimePropertyDurationStatusTour ChecklistInterest Level
    - @tour.ScheduledOn.ToString("MMM dd, yyyy")
    - @tour.ScheduledOn.ToString("h:mm tt") -
    @tour.Property?.Address@tour.DurationMinutes min - - @tour.Status - - - @if (tour.Checklist != null) - { - - - @tour.Checklist.Status - - - } - else - { - N/A - } - - @if (!string.IsNullOrEmpty(tour.InterestLevel)) - { - - @GetInterestDisplay(tour.InterestLevel) - - } -
    -
    -
    -
    - } - - - @if (application != null) - { -
    -
    -
    Application Status
    -
    -
    -
    -
    -
    -
    Application Date:
    -
    @application.AppliedOn.ToString("MMM dd, yyyy")
    - -
    Status:
    -
    - - @GetApplicationStatusDisplay(application.Status) - -
    - -
    Monthly Income:
    -
    $@application.MonthlyIncome.ToString("N2")
    -
    -
    -
    -
    -
    Employer:
    -
    @application.EmployerName
    - -
    Job Title:
    -
    @application.JobTitle
    - -
    Application Fee:
    -
    - $@application.ApplicationFee.ToString("N2") - @if (application.ApplicationFeePaid) - { - Paid - @if (application.ApplicationFeePaidOn.HasValue) - { - @application.ApplicationFeePaidOn.Value.ToString("MMM dd, yyyy") - } - @if (!string.IsNullOrEmpty(application.ApplicationFeePaymentMethod)) - { - via @application.ApplicationFeePaymentMethod - } - } - else - { - Unpaid - } -
    - - @if (application.ExpiresOn.HasValue) - { -
    Expires On:
    -
    - @application.ExpiresOn.Value.ToString("MMM dd, yyyy") - @if (application.ExpiresOn.Value < DateTime.UtcNow && application.Status != ApplicationConstants.ApplicationStatuses.Expired) - { - Expired - } - else if (application.ExpiresOn.Value < DateTime.UtcNow.AddDays(7)) - { - Expires Soon - } -
    - } -
    -
    -
    - - @if (application.Screening != null) - { -
    -
    Screening Results
    -
    -
    - Background Check: - @if (application.Screening.BackgroundCheckPassed.HasValue) - { - - @(application.Screening.BackgroundCheckPassed.Value ? "Passed" : "Failed") - - } - else if (application.Screening.BackgroundCheckRequested) - { - Pending - } - else - { - Not Requested - } -
    -
    - Credit Check: - @if (application.Screening.CreditCheckPassed.HasValue) - { - - @(application.Screening.CreditCheckPassed.Value ? "Passed" : "Failed") - - @if (application.Screening.CreditScore.HasValue) - { - Score: @application.Screening.CreditScore - } - } - else if (application.Screening.CreditCheckRequested) - { - Pending - } - else - { - Not Requested - } -
    -
    - } -
    -
    - } -
    - -
    - -
    -
    -
    Quick Actions
    -
    -
    -
    - @if (prospect.Status == ApplicationConstants.ProspectiveStatuses.Lead) - { - - } - else if (prospect.Status == ApplicationConstants.ProspectiveStatuses.TourScheduled) - { - - } - - @if (application == null && (prospect.Status == ApplicationConstants.ProspectiveStatuses.Lead || - prospect.Status == ApplicationConstants.ProspectiveStatuses.TourScheduled)) - { - - } - else if (application != null) - { - - } - - -
    -
    -
    - - -
    -
    -
    Activity Timeline
    -
    -
    -
    -
    -
    -
    - @prospect.CreatedOn.ToString("MMM dd, yyyy h:mm tt") -

    Lead created

    -
    -
    - - @foreach (var tour in tours.OrderBy(s => s.ScheduledOn)) - { -
    -
    -
    - @tour.ScheduledOn.ToString("MMM dd, yyyy h:mm tt") -

    Property tour - @tour.Property?.Address

    -
    -
    - } - - @if (application != null) - { -
    -
    -
    - @application.AppliedOn.ToString("MMM dd, yyyy h:mm tt") -

    Application submitted

    -
    -
    - } -
    -
    -
    -
    -
    - } -
    - - - -@code { - [Parameter] - public Guid ProspectId { get; set; } - - private ProspectiveTenant? prospect; - private List tours = new(); - private RentalApplication? application; - private List availableProperties = new(); - private bool loading = true; - private bool isEditing = false; - private ProspectEditViewModel editModel = new(); - - protected override async Task OnInitializedAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - loading = true; - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue) - { - prospect = await ProspectiveTenantService.GetByIdAsync(ProspectId); - - if (prospect != null) - { - tours = await TourService.GetByProspectiveIdAsync(ProspectId); - application = await RentalApplicationService.GetApplicationByProspectiveIdAsync(ProspectId); - - // Load properties for edit dropdown - availableProperties = await PropertyService.GetAllAsync(); - } - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error loading prospect details: {ex.Message}"); - } - finally - { - loading = false; - } - } - - private void StartEdit() - { - if (prospect != null) - { - editModel = new ProspectEditViewModel - { - FirstName = prospect.FirstName, - LastName = prospect.LastName, - Email = prospect.Email, - Phone = prospect.Phone, - DateOfBirth = prospect.DateOfBirth, - IdentificationNumber = prospect.IdentificationNumber, - IdentificationState = prospect.IdentificationState, - Source = prospect.Source, - Notes = prospect.Notes, - InterestedPropertyId = prospect.InterestedPropertyId?.ToString(), - DesiredMoveInDate = prospect.DesiredMoveInDate - }; - isEditing = true; - } - } - - private void CancelEdit() - { - isEditing = false; - editModel = new(); - } - - private async Task HandleSaveEdit() - { - if (prospect == null) return; - - try - { - var userId = await UserContext.GetUserIdAsync(); - - // Update prospect with edited values - prospect.FirstName = editModel.FirstName; - prospect.LastName = editModel.LastName; - prospect.Email = editModel.Email; - prospect.Phone = editModel.Phone; - prospect.DateOfBirth = editModel.DateOfBirth; - prospect.IdentificationNumber = editModel.IdentificationNumber; - prospect.IdentificationState = editModel.IdentificationState; - prospect.Source = editModel.Source; - prospect.Notes = editModel.Notes; - prospect.InterestedPropertyId = Guid.TryParse(editModel.InterestedPropertyId, out var propId) && propId != Guid.Empty ? propId : null; - prospect.DesiredMoveInDate = editModel.DesiredMoveInDate; - - await ProspectiveTenantService.UpdateAsync(prospect); - - ToastService.ShowSuccess("Prospect updated successfully"); - isEditing = false; - await LoadData(); // Reload to get updated data with navigation properties - } - catch (Exception ex) - { - ToastService.ShowError($"Error updating prospect: {ex.Message}"); - } - } - - private void ScheduleTour() - { - Navigation.NavigateTo($"/PropertyManagement/Tours/Schedule/{ProspectId}"); - } - - private void BeginApplication() - { - Navigation.NavigateTo($"/propertymanagement/prospects/{ProspectId}/submit-application"); - } - - private void ViewApplication() - { - if (application != null) - { - Navigation.NavigateTo($"/propertymanagement/applications/{application.Id}/view"); - } - } - - private void ViewTours() - { - Navigation.NavigateTo("/PropertyManagement/Tours"); - } - - private void GoBack() - { - Navigation.NavigateTo("/PropertyManagement/ProspectiveTenants"); - } - - private string GetStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.ProspectiveStatuses.Lead => "bg-secondary", - var s when s == ApplicationConstants.ProspectiveStatuses.TourScheduled => "bg-info", - var s when s == ApplicationConstants.ProspectiveStatuses.Applied => "bg-primary", - var s when s == ApplicationConstants.ProspectiveStatuses.Screening => "bg-warning", - var s when s == ApplicationConstants.ProspectiveStatuses.Approved => "bg-success", - var s when s == ApplicationConstants.ProspectiveStatuses.Denied => "bg-danger", - _ => "bg-secondary" - }; - - private string GetStatusDisplay(string status) => status switch - { - var s when s == ApplicationConstants.ProspectiveStatuses.TourScheduled => "Tour Scheduled", - var s when s == ApplicationConstants.ProspectiveStatuses.ConvertedToTenant => "Converted", - _ => status - }; - - private string GetTourStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.TourStatuses.Scheduled => "bg-info", - var s when s == ApplicationConstants.TourStatuses.Completed => "bg-success", - var s when s == ApplicationConstants.TourStatuses.Cancelled => "bg-danger", - var s when s == ApplicationConstants.TourStatuses.NoShow => "bg-warning", - _ => "bg-secondary" - }; - - private string GetInterestBadgeClass(string? level) => level switch - { - var l when l == ApplicationConstants.TourInterestLevels.VeryInterested => "bg-success", - var l when l == ApplicationConstants.TourInterestLevels.Interested => "bg-primary", - var l when l == ApplicationConstants.TourInterestLevels.Neutral => "bg-secondary", - var l when l == ApplicationConstants.TourInterestLevels.NotInterested => "bg-danger", - _ => "bg-secondary" - }; - - private string GetInterestDisplay(string? level) => level switch - { - var l when l == ApplicationConstants.TourInterestLevels.VeryInterested => "Very Interested", - var l when l == ApplicationConstants.TourInterestLevels.NotInterested => "Not Interested", - _ => level ?? "N/A" - }; - - private string GetApplicationStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.ApplicationStatuses.Submitted => "bg-info", - var s when s == ApplicationConstants.ApplicationStatuses.UnderReview => "bg-primary", - var s when s == ApplicationConstants.ApplicationStatuses.Screening => "bg-warning", - var s when s == ApplicationConstants.ApplicationStatuses.Approved => "bg-success", - var s when s == ApplicationConstants.ApplicationStatuses.Denied => "bg-danger", - _ => "bg-secondary" - }; - - private string GetApplicationStatusDisplay(string status) => status switch - { - var s when s == ApplicationConstants.ApplicationStatuses.UnderReview => "Under Review", - _ => status - }; - - private string GetChecklistStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.ChecklistStatuses.Draft => "bg-secondary", - var s when s == ApplicationConstants.ChecklistStatuses.InProgress => "bg-info", - var s when s == ApplicationConstants.ChecklistStatuses.Completed => "bg-success", - _ => "bg-secondary" - }; - - public class ProspectEditViewModel - { - [Required(ErrorMessage = "First name is required")] - [StringLength(100)] - public string FirstName { get; set; } = string.Empty; - - [Required(ErrorMessage = "Last name is required")] - [StringLength(100)] - public string LastName { get; set; } = string.Empty; - - [Required(ErrorMessage = "Email is required")] - [EmailAddress(ErrorMessage = "Invalid email address")] - [StringLength(200)] - public string Email { get; set; } = string.Empty; - - [Required(ErrorMessage = "Phone is required")] - [Phone(ErrorMessage = "Invalid phone number")] - [StringLength(20)] - public string Phone { get; set; } = string.Empty; - - public DateTime? DateOfBirth { get; set; } - - [StringLength(100)] - public string? IdentificationNumber { get; set; } - - [StringLength(2)] - public string? IdentificationState { get; set; } - - [StringLength(100)] - public string? Source { get; set; } - - [StringLength(2000)] - public string? Notes { get; set; } - - public string? InterestedPropertyId { get; set; } - - public DateTime? DesiredMoveInDate { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/Repairs/Index.razor b/4-Nine/Features/PropertyManagement/Repairs/Index.razor index d352840..4300163 100644 --- a/4-Nine/Features/PropertyManagement/Repairs/Index.razor +++ b/4-Nine/Features/PropertyManagement/Repairs/Index.razor @@ -1,25 +1,36 @@ @page "/propertymanagement/repairs" @using Nine.Core.Entities +@using Nine.Shared.UI.Components.Entities.Repairs @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] @inject RepairService RepairService @inject PropertyService PropertyService @inject NavigationManager Navigation @inject ToastService ToastService +@inject IJSRuntime JSRuntime + @rendermode InteractiveServer Repairs - Nine -
    -

    - Repairs -

    +

    Repairs

    - +
    +
    + +
    +
    @if (isLoading) {
    @@ -29,23 +40,23 @@

    Loading repairs...

    } - else if (!repairs.Any()) - { -
    - - No repairs have been logged yet. Click "Log New Repair" to record work performed on your properties. -
    - } else {
    -
    +
    -
    +
    + +
    +
    -
    +
    -
    -
    + +
    +
    +
    + + +
    -
    + @if (!repairs.Any()) + { +
    + + @if (_showArchived) + { + No archived repairs found. + } + else + { + No repairs have been logged yet. Click "New Repair" to record work performed on your properties. + } +
    + } + else if (!FilteredRepairs.Any()) + { +
    + No repairs match the current filters. +
    + } + else + {
    - + - - - + + + - + @@ -174,6 +212,20 @@ title="Edit Repair"> + @if (!repair.IsArchived) + { + + } + else + { + + }
    Property DescriptionTypeCompletedCost DurationStatus Actions
    + }
    } -
    @code { + /// + /// Repairs have no stored Status field (see Repair.IsCompleted), so this + /// filter is a UI-only concept derived from CompletedOn, not persisted + /// or part of ApplicationConstants. + /// + private enum RepairStatusFilter + { + AllRepairs, + InProgress, + Completed + } + private List repairs = new(); private List properties = new(); private bool isLoading = true; @@ -209,7 +273,11 @@ private string searchTerm = string.Empty; private string selectedPropertyId = string.Empty; private string selectedRepairType = string.Empty; + private RepairStatusFilter selectedRepairStatus = RepairStatusFilter.InProgress; private bool showInProgressOnly = false; + private bool _showArchived = false; + private string _sortColumn = "CompletedOn"; + private bool _sortAscending = false; protected override async Task OnInitializedAsync() { @@ -221,7 +289,9 @@ isLoading = true; try { - repairs = await RepairService.GetAllAsync(); + repairs = _showArchived + ? await RepairService.GetArchivedAsync() + : await RepairService.GetAllAsync(); properties = await PropertyService.GetAllAsync(); } catch (Exception ex) @@ -259,12 +329,50 @@ filtered = filtered.Where(r => r.RepairType == selectedRepairType); } + if (selectedRepairStatus == RepairStatusFilter.InProgress) + { + filtered = filtered.Where(r => !r.IsCompleted); + } + else if (selectedRepairStatus == RepairStatusFilter.Completed) + { + filtered = filtered.Where(r => r.IsCompleted); + } + if (showInProgressOnly) { filtered = filtered.Where(r => !r.IsCompleted); } - return filtered.OrderByDescending(r => r.CompletedOn ?? r.CreatedOn); + return _sortColumn switch + { + "Property" => _sortAscending + ? filtered.OrderBy(r => r.Property?.Address) + : filtered.OrderByDescending(r => r.Property?.Address), + "RepairType" => _sortAscending + ? filtered.OrderBy(r => r.RepairType) + : filtered.OrderByDescending(r => r.RepairType), + "CompletedOn" => _sortAscending + ? filtered.OrderBy(r => r.CompletedOn ?? r.CreatedOn) + : filtered.OrderByDescending(r => r.CompletedOn ?? r.CreatedOn), + "Cost" => _sortAscending + ? filtered.OrderBy(r => r.Cost) + : filtered.OrderByDescending(r => r.Cost), + "Status" => _sortAscending + ? filtered.OrderBy(r => r.IsCompleted) + : filtered.OrderByDescending(r => r.IsCompleted), + _ => filtered.OrderByDescending(r => r.CompletedOn ?? r.CreatedOn) + }; + } + } + + private void SortBy(string column) + { + if (_sortColumn == column) + _sortAscending = !_sortAscending; + else + { + _sortColumn = column; + _sortAscending = true; } } @@ -272,8 +380,59 @@ private void NavigateToView(Guid id) => Navigation.NavigateTo($"/propertymanagement/repairs/{id}"); private void NavigateToEdit(Guid id) => Navigation.NavigateTo($"/propertymanagement/repairs/{id}/edit"); + private async Task ArchiveRepair(Guid id) + { + var repair = repairs.FirstOrDefault(r => r.Id == id); + if (repair == null) { + ToastService.ShowError("Repair not found."); + return; + } + + if(!repair.IsCompleted) + { + ToastService.ShowError("Only completed repairs can be archived."); + return; + } + try + { + await RepairService.ArchiveAsync(repair.Id); + ToastService.ShowSuccess("Repair archived successfully."); + await LoadData(); + } + catch (Exception ex) + { + ToastService.ShowError($"Error archiving repair: {ex.Message}"); + } + } + + private async Task RestoreRepair(Guid id) + { + var repair = repairs.FirstOrDefault(r => r.Id == id); + if (repair == null) + { + ToastService.ShowError("Repair not found."); + return; + } + + try + { + await RepairService.RestoreAsync(repair.Id); + ToastService.ShowSuccess("Repair restored successfully."); + await LoadData(); + } + catch (Exception ex) + { + ToastService.ShowError($"Error restoring repair: {ex.Message}"); + } + } + private async Task DeleteRepair(Guid id) { + var repair = repairs.FirstOrDefault(r => r.Id == id); + if (repair == null) { + ToastService.ShowError("Repair not found."); + return; + } try { await RepairService.DeleteAsync(id); diff --git a/4-Nine/Features/PropertyManagement/Repairs/View.razor b/4-Nine/Features/PropertyManagement/Repairs/View.razor index dc29492..60495e9 100644 --- a/4-Nine/Features/PropertyManagement/Repairs/View.razor +++ b/4-Nine/Features/PropertyManagement/Repairs/View.razor @@ -1,6 +1,7 @@ @page "/propertymanagement/repairs/{id:guid}" @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] +@using Nine.Shared.UI.Components.Entities.Repairs @inject RepairService RepairService @inject NavigationManager Navigation @inject ToastService ToastService @@ -224,6 +225,11 @@
    } + + + @if (repair.MaintenanceRequestId.HasValue) { diff --git a/4-Nine/Features/PropertyManagement/Reports/Pages/IncomeStatementReport.razor b/4-Nine/Features/PropertyManagement/Reports/Pages/IncomeStatementReport.razor index 9562e3e..fa284b8 100644 --- a/4-Nine/Features/PropertyManagement/Reports/Pages/IncomeStatementReport.razor +++ b/4-Nine/Features/PropertyManagement/Reports/Pages/IncomeStatementReport.razor @@ -134,6 +134,10 @@ Management Fees @statement.ManagementFees.ToString("C") + + Mortgage + @statement.MortgageExpenses.ToString("C") + Other Expenses @statement.OtherExpenses.ToString("C") diff --git a/4-Nine/Features/PropertyManagement/Reports/Pages/Reports.razor b/4-Nine/Features/PropertyManagement/Reports/Pages/Reports.razor index f86c05f..1badea3 100644 --- a/4-Nine/Features/PropertyManagement/Reports/Pages/Reports.razor +++ b/4-Nine/Features/PropertyManagement/Reports/Pages/Reports.razor @@ -9,7 +9,7 @@ @attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -Financial Reports - Nine +Financial Reports
    @@ -18,7 +18,7 @@ Refresh
    - +
    @if (isLoading) {
    @@ -67,7 +67,7 @@ else
    - +
    @if (statistics != null) {
    @@ -113,7 +113,7 @@ else

    Generate comprehensive financial reports for your properties

    - +
    diff --git a/4-Nine/Features/PropertyManagement/Reports/Pages/TaxReport.razor b/4-Nine/Features/PropertyManagement/Reports/Pages/TaxReport.razor index 767f604..a3152f5 100644 --- a/4-Nine/Features/PropertyManagement/Reports/Pages/TaxReport.razor +++ b/4-Nine/Features/PropertyManagement/Reports/Pages/TaxReport.razor @@ -115,8 +115,8 @@ @report.Management.ToString("C") - 13. Mortgage interest paid to banks, etc. - @report.MortgageInterest.ToString("C") + 13. Mortgage Expense (see Form 1098, Box 1 for the tax-deductible interest portion) + @report.MortgageExpense.ToString("C") 14. Repairs diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Components/SampleFeatureCompnentOne.razor b/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Components/SampleFeatureCompnentOne.razor deleted file mode 100644 index e69de29..0000000 diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Create.razor b/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Create.razor deleted file mode 100644 index e69de29..0000000 diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Edit.razor b/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Edit.razor deleted file mode 100644 index e69de29..0000000 diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Index.razor b/4-Nine/Features/PropertyManagement/SampleFeature/Pages/Index.razor deleted file mode 100644 index e69de29..0000000 diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/Pages/View.razor b/4-Nine/Features/PropertyManagement/SampleFeature/Pages/View.razor deleted file mode 100644 index e69de29..0000000 diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureContext.cs b/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureContext.cs deleted file mode 100644 index 16ab919..0000000 --- a/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureContext.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Microsoft.EntityFrameworkCore; -public class SampleFeatureContext : DbContext -{ - // This class can be used to hold context-specific information - public SampleFeatureContext(DbContextOptions options) - : base(options) - { - } - -} \ No newline at end of file diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureEntity.cs b/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureEntity.cs deleted file mode 100644 index 524121f..0000000 --- a/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureEntity.cs +++ /dev/null @@ -1,25 +0,0 @@ - -public abstract class SampleFeatureEntity : BaseEntity, ISampleFeatureEntity -{ - public string Name { get; set; } = string.Empty; -} - -public interface ISampleFeatureEntity -{ - Guid Id { get; set; } - string Name { get; set; } - - -} - -public abstract class BaseEntity -{ - // Base properties and methods for all entities can be defined here - public Guid Id { get; set; } - - public string CreatedBy { get; set; } = string.Empty; - public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - - public string UpdatedBy { get; set; } = string.Empty; - public DateTime? UpdatedAt { get; set; } -} \ No newline at end of file diff --git a/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureService.cs b/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureService.cs deleted file mode 100644 index 4054c33..0000000 --- a/4-Nine/Features/PropertyManagement/SampleFeature/SampleFeatureService.cs +++ /dev/null @@ -1,20 +0,0 @@ - -using Microsoft.EntityFrameworkCore; - -public class SampleFeatureService -{ - private readonly SampleFeatureContext _context; - - public SampleFeatureService(SampleFeatureContext context) - { - _context = context; - } - - public async Task GetSampleFeatureByIdAsync(Guid id) - { - return await _context.Set() - .FirstOrDefaultAsync(e => e.Id == id); - } - - // Sample methods for the service can be added here -} \ No newline at end of file diff --git a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/CalculateDividends.razor b/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/CalculateDividends.razor deleted file mode 100644 index f0be40d..0000000 --- a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/CalculateDividends.razor +++ /dev/null @@ -1,337 +0,0 @@ -@page "/property-management/security-deposits/calculate-dividends/{PoolId:guid}" -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@inject SecurityDepositService SecurityDepositService -@inject NavigationManager NavigationManager -@inject ToastService ToastService -@rendermode InteractiveServer -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] - - -Calculate Dividends - @(pool?.Year ?? 0) - -
    - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (pool == null) - { -
    - - Investment pool not found. -
    - } - else - { -
    -
    - -

    Calculate Dividends for @pool.Year

    -

    Review and confirm dividend calculations for all active leases

    -
    -
    - - @if (pool.Status != ApplicationConstants.InvestmentPoolStatuses.Open) - { -
    - - Dividends Already Calculated -

    Dividends for this pool have already been calculated. View the details on the pool details page.

    -
    - } - else if (!pool.HasEarnings) - { -
    - - No Dividends to Distribute -

    - @if (pool.HasLosses) - { - This pool had losses of @pool.AbsorbedLosses.ToString("C2"), which are absorbed by the organization. No dividends will be distributed. - } - else - { - This pool had no earnings. No dividends will be distributed. - } -

    -
    - } - else - { - -
    -
    -
    -
    -
    Total Earnings
    -

    @pool.TotalEarnings.ToString("C2")

    -
    -
    -
    -
    -
    -
    -
    Organization Share
    -

    @pool.OrganizationShare.ToString("C2")

    - @((pool.OrganizationSharePercentage * 100).ToString("F0"))% -
    -
    -
    -
    -
    -
    -
    Tenant Share Total
    -

    @pool.TenantShareTotal.ToString("C2")

    -
    -
    -
    -
    -
    -
    -
    Active Leases
    -

    @pool.ActiveLeaseCount

    - @pool.DividendPerLease.ToString("C2") each -
    -
    -
    -
    - - @if (calculationPreview.Any()) - { -
    -
    -
    - Dividend Calculation Preview -
    -
    -
    -
    - - - - - - - - - - - - - - @foreach (var calc in calculationPreview.OrderByDescending(c => c.FinalDividend)) - { - - - - - - - - - - } - - - - - - - -
    TenantLease IDLease PeriodMonths in PoolBase DividendProrationFinal Dividend
    Tenant #@calc.TenantIdLease #@calc.LeaseId - - @calc.LeaseStartDate.ToString("MMM d, yyyy")
    - to @(calc.LeaseEndDate?.ToString("MMM d, yyyy") ?? "Present") -
    -
    - @calc.MonthsInPool - @calc.BaseDividend.ToString("C2") - @if (calc.ProrationFactor < 1.0m) - { - - @((calc.ProrationFactor * 100).ToString("F0"))% - - } - else - { - 100% - } - - @calc.FinalDividend.ToString("C2") -
    Total Dividends to Distribute: - @calculationPreview.Sum(c => c.FinalDividend).ToString("C2") -
    -
    -
    -
    - -
    -
    -
    Confirm Dividend Calculation
    -

    - Review the dividend calculations above. Once confirmed, dividends will be created for each tenant - and tenants can choose to receive their dividend as a lease credit or check. -

    - -
    -
    What happens next?
    -
      -
    • Dividend records will be created for all @calculationPreview.Count active leases
    • -
    • Tenants will be notified to choose their dividend payment method
    • -
    • You can process dividend payments from the pool details page
    • -
    • The pool status will change to "Calculated"
    • -
    -
    - -
    - - -
    -
    -
    - } - else - { -
    - - No Active Leases Found -

    There are no active leases in the pool for @pool.Year. Cannot calculate dividends.

    -
    - } - } - } -
    - -@code { - [Parameter] - public Guid PoolId { get; set; } - - private SecurityDepositInvestmentPool? pool; - private List calculationPreview = new(); - private bool isLoading = true; - private bool isCalculating = false; - - protected override async Task OnInitializedAsync() - { - await LoadPoolAndPreview(); - } - - private async Task LoadPoolAndPreview() - { - isLoading = true; - try - { - pool = await SecurityDepositService.GetInvestmentPoolByIdAsync(PoolId); - - if (pool != null && pool.HasEarnings && pool.Status == ApplicationConstants.InvestmentPoolStatuses.Open) - { - // Get all security deposits in the pool for this year - var deposits = await SecurityDepositService.GetSecurityDepositsInPoolAsync(pool.Year); - - foreach (var deposit in deposits) - { - // Calculate proration based on months in pool - var leaseStart = deposit.PoolEntryDate ?? deposit.DateReceived; - var yearStart = new DateTime(pool.Year, 1, 1); - var yearEnd = new DateTime(pool.Year, 12, 31); - - var effectiveStart = leaseStart > yearStart ? leaseStart : yearStart; - var effectiveEnd = deposit.PoolExitDate.HasValue && deposit.PoolExitDate.Value < yearEnd - ? deposit.PoolExitDate.Value - : yearEnd; - - var monthsInPool = ((effectiveEnd.Year - effectiveStart.Year) * 12 + effectiveEnd.Month - effectiveStart.Month + 1); - var prorationFactor = monthsInPool / 12.0m; - - calculationPreview.Add(new DividendCalculation - { - TenantId = deposit.TenantId, - LeaseId = deposit.LeaseId, - LeaseStartDate = leaseStart, - LeaseEndDate = deposit.PoolExitDate, - MonthsInPool = monthsInPool, - BaseDividend = pool.DividendPerLease, - ProrationFactor = prorationFactor, - FinalDividend = pool.DividendPerLease * prorationFactor - }); - } - } - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to load dividend preview: {ex.Message}"); - } - finally - { - isLoading = false; - } - } - - private async Task ConfirmCalculation() - { - isCalculating = true; - try - { - await SecurityDepositService.CalculateDividendsAsync(pool!.Year); - - ToastService.ShowSuccess($"Dividends calculated for {pool.Year}. Tenants can now choose their payment method."); - NavigationManager.NavigateTo($"/property-management/security-deposits/investment-pool/{PoolId}"); - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to calculate dividends: {ex.Message}"); - } - finally - { - isCalculating = false; - } - } - - private void Cancel() - { - NavigationManager.NavigateTo($"/property-management/security-deposits/investment-pool/{PoolId}"); - } - - private class DividendCalculation - { - public Guid TenantId { get; set; } - public Guid LeaseId { get; set; } - public DateTime LeaseStartDate { get; set; } - public DateTime? LeaseEndDate { get; set; } - public int MonthsInPool { get; set; } - public decimal BaseDividend { get; set; } - public decimal ProrationFactor { get; set; } - public decimal FinalDividend { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/InvestmentPools.razor b/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/InvestmentPools.razor deleted file mode 100644 index c0c018b..0000000 --- a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/InvestmentPools.razor +++ /dev/null @@ -1,345 +0,0 @@ -@page "/property-management/security-deposits/investment-pools" -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@inject SecurityDepositService SecurityDepositService -@inject NavigationManager NavigationManager -@inject ToastService ToastService -@rendermode InteractiveServer -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] - - -Investment Pools - Security Deposits - -
    -
    -
    -

    Security Deposit Investment Pools

    -

    Manage annual investment performance and dividend distributions

    -
    -
    - -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -

    Loading investment pools...

    -
    - } - else if (investmentPools == null || !investmentPools.Any()) - { -
    - - No Investment Pools Found -

    No annual investment performance has been recorded yet. Click "Record Performance" to add the first year's investment results.

    -
    - } - else - { -
    -
    -
    - - - - - - - - - - - - - - - - - - - @foreach (var pool in investmentPools.OrderByDescending(p => p.Year)) - { - var poolStats = GetPoolStats(pool.Year); - - - - - - - - - - - - - - - } - - - - - - - - - - - - - - - - -
    YearStarting BalanceDepositsWithdrawalsCurrent BalanceTotal EarningsReturn RateOrganization ShareTenant ShareActive LeasesStatusActions
    - @pool.Year - - @pool.StartingBalance.ToString("C2") - - - @poolStats.Deposits.ToString("C2") - - - @poolStats.Withdrawals.ToString("C2") - - @poolStats.CurrentBalance.ToString("C2") - - @if (pool.HasEarnings) - { - - - @pool.TotalEarnings.ToString("C2") - - } - else if (pool.HasLosses) - { - - - @pool.TotalEarnings.ToString("C2") - - } - else - { - $0.00 - } - - @if (pool.ReturnRate >= 0) - { - @((pool.ReturnRate * 100).ToString("F2"))% - } - else - { - @((pool.ReturnRate * 100).ToString("F2"))% - } - - @pool.OrganizationShare.ToString("C2") - (@((pool.OrganizationSharePercentage * 100).ToString("F0"))%) - - @pool.TenantShareTotal.ToString("C2") - - @pool.ActiveLeaseCount - - @if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Open) - { - Open - } - else if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Calculated) - { - Calculated - } - else if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Distributed) - { - Distributed - } - else if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Closed) - { - Closed - } - -
    - - @if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Open) - { - - } - @if (pool.Status != ApplicationConstants.InvestmentPoolStatuses.Closed) - { - - } -
    -
    Totals@investmentPools.Sum(p => p.StartingBalance).ToString("C2")@allPoolStats.Sum(s => s.Deposits).ToString("C2")@allPoolStats.Sum(s => s.Withdrawals).ToString("C2")@allPoolStats.Sum(s => s.CurrentBalance).ToString("C2") - @if (investmentPools.Sum(p => p.TotalEarnings) >= 0) - { - @investmentPools.Sum(p => p.TotalEarnings).ToString("C2") - } - else - { - @investmentPools.Sum(p => p.TotalEarnings).ToString("C2") - } - - @{ - var avgReturn = investmentPools.Any() ? investmentPools.Average(p => p.ReturnRate) : 0; - } - @((avgReturn * 100).ToString("F2"))% - (avg) - @investmentPools.Sum(p => p.OrganizationShare).ToString("C2")@investmentPools.Sum(p => p.TenantShareTotal).ToString("C2")@investmentPools.Sum(p => p.ActiveLeaseCount)
    -
    -
    -
    - - @if (investmentPools.Any()) - { -
    -
    -
    -
    -
    Total Investment Pool Value
    -

    @investmentPools.Sum(p => p.EndingBalance).ToString("C2")

    -
    -
    -
    -
    -
    -
    -
    Total Dividends Distributed
    -

    @investmentPools.Sum(p => p.TenantShareTotal).ToString("C2")

    -
    -
    -
    -
    -
    -
    -
    Organization Revenue
    -

    @investmentPools.Sum(p => p.OrganizationShare).ToString("C2")

    -
    -
    -
    -
    - } - } -
    - -@code { - private List investmentPools = new(); - private List allDeposits = new(); - private List allPoolStats = new(); - private bool isLoading = true; - - protected override async Task OnInitializedAsync() - { - await LoadInvestmentPools(); - } - - private async Task LoadInvestmentPools() - { - isLoading = true; - try - { - investmentPools = await SecurityDepositService.GetInvestmentPoolsAsync(); - allDeposits = await SecurityDepositService.GetSecurityDepositsAsync(); - - // Calculate stats for each pool year - allPoolStats = investmentPools.Select(p => GetPoolStats(p.Year)).ToList(); - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to load investment pools: {ex.Message}"); - } - finally - { - isLoading = false; - } - } - - private PoolStats GetPoolStats(int year) - { - var yearStart = new DateTime(year, 1, 1); - var yearEnd = new DateTime(year, 12, 31, 23, 59, 59); - - // Get the pool to access its starting balance - var pool = investmentPools.FirstOrDefault(p => p.Year == year); - var startingBalance = pool?.StartingBalance ?? 0; - - // Deposits added during the year - var deposits = allDeposits - .Where(d => d.PoolEntryDate.HasValue && - d.PoolEntryDate.Value >= yearStart && - d.PoolEntryDate.Value <= yearEnd) - .Sum(d => d.Amount); - - // Deposits removed during the year - var withdrawals = allDeposits - .Where(d => d.PoolExitDate.HasValue && - d.PoolExitDate.Value >= yearStart && - d.PoolExitDate.Value <= yearEnd) - .Sum(d => d.Amount); - - // Current balance = Starting + Deposits - Withdrawals - var currentBalance = startingBalance + deposits - withdrawals; - - return new PoolStats - { - Deposits = deposits, - Withdrawals = withdrawals, - CurrentBalance = currentBalance - }; - } - - private void CreateNewPool() - { - NavigationManager.NavigateTo("/property-management/security-deposits/record-performance"); - } - - private void ViewPoolDetails(Guid poolId) - { - NavigationManager.NavigateTo($"/property-management/security-deposits/investment-pool/{poolId}"); - } - - private void CalculateDividends(Guid poolId) - { - NavigationManager.NavigateTo($"/property-management/security-deposits/calculate-dividends/{poolId}"); - } - - private async Task ClosePool(Guid poolId, int year) - { - try - { - await SecurityDepositService.CloseInvestmentPoolAsync(poolId); - ToastService.ShowSuccess($"Investment pool for {year} has been closed"); - await LoadInvestmentPools(); - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to close pool: {ex.Message}"); - } - } - - private class PoolStats - { - public decimal Deposits { get; set; } - public decimal Withdrawals { get; set; } - public decimal CurrentBalance { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/RecordPoolPerformance.razor b/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/RecordPoolPerformance.razor deleted file mode 100644 index 50293f0..0000000 --- a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/RecordPoolPerformance.razor +++ /dev/null @@ -1,359 +0,0 @@ -@page "/property-management/security-deposits/record-performance" -@page "/property-management/security-deposits/record-performance/{Year:int}" -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Microsoft.AspNetCore.Authorization -@inject SecurityDepositService SecurityDepositService -@inject OrganizationService OrganizationService -@inject NavigationManager NavigationManager -@inject ToastService ToastService -@rendermode InteractiveServer -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] - - -Record Investment Performance - -
    -
    -
    - -

    Record Annual Investment Performance

    -

    Enter the investment earnings for the security deposit pool

    -
    -
    - - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else - { -
    -
    -
    -
    -
    Investment Performance Details
    -
    -
    - - - -
    -
    - - - - @if (existingPool != null) - { - Performance already recorded for this year - } -
    -
    - -
    - $ - -
    - Total of all deposits currently in pool -
    -
    - -
    -
    -
    - Year-to-Date Summary:
    - Deposits in Pool: @depositsInPoolCount | - Total Balance: @currentPoolBalance.ToString("C2") -
    -
    -
    - -
    -
    - -
    - $ - -
    - - Can be negative for losses (absorbed by organization) -
    -
    - -
    - - % -
    - Calculated automatically -
    -
    - -
    -
    - - -
    -
    - -
    - - @if (performanceModel.TotalEarnings > 0) - { -
    -
    - Earnings Distribution Preview -
    -
    -
    - Organization Share (@((organizationSettings?.OrganizationSharePercentage * 100 ?? 20).ToString("F0"))%): -
    @((performanceModel.TotalEarnings * (organizationSettings?.OrganizationSharePercentage ?? 0.20m)).ToString("C2"))
    -
    -
    - Tenant Share Total: -
    @((performanceModel.TotalEarnings * (1 - (organizationSettings?.OrganizationSharePercentage ?? 0.20m))).ToString("C2"))
    -
    -
    -
    - } - else if (performanceModel.TotalEarnings < 0) - { -
    -
    - Loss Absorption Notice -
    -

    - Investment losses of @(Math.Abs(performanceModel.TotalEarnings).ToString("C2")) will be absorbed by the organization. - No dividends will be distributed to tenants, and their security deposits remain unchanged. -

    -
    - } - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    - Investment Pool Guidelines -
    -
    -
    -
    About Investment Performance
    -
      -
    • Record the total investment earnings for the year
    • -
    • Earnings can be positive (gains) or negative (losses)
    • -
    • Organization share is @((organizationSettings?.OrganizationSharePercentage * 100 ?? 20).ToString("F0"))% of positive earnings
    • -
    • Losses are absorbed entirely by the organization
    • -
    • Tenants never see negative dividends
    • -
    - -
    Next Steps
    -
      -
    • After recording performance, calculate dividends
    • -
    • Dividends are distributed in @(GetMonthName(organizationSettings?.DividendDistributionMonth ?? 1))
    • -
    • Pro-rated for mid-year move-ins
    • -
    • Tenants choose lease credit or check
    • -
    - - @if (recentPools.Any()) - { -
    Recent Performance
    -
    - - - - - - - - - @foreach (var pool in recentPools.OrderByDescending(p => p.Year).Take(5)) - { - - - - - } - -
    YearReturn
    @pool.Year - @if (pool.ReturnRate >= 0) - { - @((pool.ReturnRate * 100).ToString("F2"))% - } - else - { - @((pool.ReturnRate * 100).ToString("F2"))% - } -
    -
    - } -
    -
    -
    -
    - } -
    - -@code { - [Parameter] - public int? Year { get; set; } - - private PerformanceModel performanceModel = new(); - private SecurityDepositInvestmentPool? existingPool; - private OrganizationSettings? organizationSettings; - private List recentPools = new(); - private bool isLoading = true; - private bool isSaving = false; - - // Current pool stats - private decimal currentPoolBalance = 0; - private int depositsInPoolCount = 0; - - protected override async Task OnInitializedAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - isLoading = true; - try - { - // Set default year if not provided - if (!Year.HasValue || Year.Value == 0) - { - Year = DateTime.Now.Year; // Default to current year - } - - performanceModel.Year = Year.Value; - - // Load organization settings - organizationSettings = await OrganizationService.GetOrganizationSettingsAsync(); - - // Check if pool already exists for this year - existingPool = await SecurityDepositService.GetInvestmentPoolByYearAsync(Year.Value); - - if (existingPool != null) - { - // Populate form with existing data - performanceModel.TotalEarnings = existingPool.TotalEarnings; - performanceModel.ReturnRate = existingPool.ReturnRate; - performanceModel.Notes = existingPool.Notes; - } - else - { - // Create new pool to get starting balance - existingPool = await SecurityDepositService.GetOrCreateInvestmentPoolAsync(Year.Value); - } - - // Load recent pools for reference - recentPools = await SecurityDepositService.GetInvestmentPoolsAsync(); - - // Get current pool balance (all deposits in pool right now) - var allDeposits = await SecurityDepositService.GetSecurityDepositsAsync(); - var depositsInPool = allDeposits.Where(d => d.InInvestmentPool).ToList(); - depositsInPoolCount = depositsInPool.Count; - currentPoolBalance = depositsInPool.Sum(d => d.Amount); - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to load data: {ex.Message}"); - } - finally - { - isLoading = false; - } - } - - private void CalculateReturnRate() - { - if (existingPool != null && existingPool.StartingBalance > 0) - { - performanceModel.ReturnRate = performanceModel.TotalEarnings / existingPool.StartingBalance; - } - } - - private async Task HandleSubmit() - { - isSaving = true; - try - { - var endingBalance = (existingPool?.StartingBalance ?? 0) + performanceModel.TotalEarnings; - - await SecurityDepositService.RecordInvestmentPerformanceAsync( - performanceModel.Year, - existingPool?.StartingBalance ?? 0, - endingBalance, - performanceModel.TotalEarnings - ); - - ToastService.ShowSuccess($"Investment performance recorded for {performanceModel.Year}"); - NavigationManager.NavigateTo("/property-management/security-deposits/investment-pools"); - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to record performance: {ex.Message}"); - } - finally - { - isSaving = false; - } - } - - private void Cancel() - { - NavigationManager.NavigateTo("/property-management/security-deposits/investment-pools"); - } - - private string GetMonthName(int month) - { - return new DateTime(2000, month, 1).ToString("MMMM"); - } - - private class PerformanceModel - { - public int Year { get; set; } - public decimal TotalEarnings { get; set; } - public decimal ReturnRate { get; set; } - public string? Notes { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/ViewInvestmentPool.razor b/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/ViewInvestmentPool.razor deleted file mode 100644 index a5a6410..0000000 --- a/4-Nine/Features/PropertyManagement/SecurityDeposits/Pages/ViewInvestmentPool.razor +++ /dev/null @@ -1,419 +0,0 @@ -@page "/property-management/security-deposits/investment-pool/{PoolId:guid}" -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@inject SecurityDepositService SecurityDepositService -@inject NavigationManager NavigationManager -@inject ToastService ToastService -@rendermode InteractiveServer - -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] - - -Investment Pool Details - @(pool?.Year ?? 0) - -
    - @if (isLoading) - { -
    -
    - Loading... -
    -
    - } - else if (pool == null) - { -
    - - Investment pool not found. -
    - } - else - { -
    -
    - -
    -
    -

    @pool.Year Investment Pool

    -

    Detailed performance and dividend information

    -
    -
    - @if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Open) - { - - } - else if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Calculated) - { - Dividends Calculated - Ready to Distribute - } - else if (pool.Status == ApplicationConstants.InvestmentPoolStatuses.Distributed) - { - Dividends Distributed - } -
    -
    -
    -
    - - -
    -
    -
    -
    -
    Starting Balance
    -

    @pool.StartingBalance.ToString("C2")

    - @pool.ActiveLeaseCount active leases -
    -
    -
    -
    -
    -
    -
    Total Earnings
    -

    - @if (pool.HasEarnings) - { - @pool.TotalEarnings.ToString("C2") - } - else if (pool.HasLosses) - { - @pool.TotalEarnings.ToString("C2") - } - else - { - $0.00 - } -

    - - @if (pool.ReturnRate >= 0) - { - @((pool.ReturnRate * 100).ToString("F2"))% return - } - else - { - @((pool.ReturnRate * 100).ToString("F2"))% loss - } - -
    -
    -
    -
    -
    -
    -
    Organization Share
    -

    @pool.OrganizationShare.ToString("C2")

    - @((pool.OrganizationSharePercentage * 100).ToString("F0"))% of earnings -
    -
    -
    -
    -
    -
    -
    Tenant Share Total
    -

    @pool.TenantShareTotal.ToString("C2")

    - - @if (pool.DividendPerLease > 0) - { - @pool.DividendPerLease.ToString("C2") per lease - } - else - { - No dividends - } - -
    -
    -
    -
    - - -
    -
    -
    -
    -
    Performance Summary
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Year:@pool.Year
    Starting Balance:@pool.StartingBalance.ToString("C2")
    Ending Balance:@pool.EndingBalance.ToString("C2")
    Total Earnings: - @if (pool.HasEarnings) - { - +@pool.TotalEarnings.ToString("C2") - } - else if (pool.HasLosses) - { - @pool.TotalEarnings.ToString("C2") - } - else - { - $0.00 - } -
    Return Rate: - @if (pool.ReturnRate >= 0) - { - @((pool.ReturnRate * 100).ToString("F2"))% - } - else - { - @((pool.ReturnRate * 100).ToString("F2"))% - } -
    Active Leases:@pool.ActiveLeaseCount
    - - @if (!string.IsNullOrEmpty(pool.Notes)) - { -
    -
    Notes:
    -

    @pool.Notes

    - } -
    -
    -
    - -
    -
    -
    -
    Distribution Details
    -
    -
    - @if (pool.HasEarnings) - { - - - - - - - - - - - - - - - - - - - @if (pool.DividendsCalculatedOn.HasValue) - { - - - - - } - @if (pool.DividendsDistributedOn.HasValue) - { - - - - - } - -
    Organization Share %:@((pool.OrganizationSharePercentage * 100).ToString("F0"))%
    Organization Amount:@pool.OrganizationShare.ToString("C2")
    Tenant Share Total:@pool.TenantShareTotal.ToString("C2")
    Dividend Per Lease:@pool.DividendPerLease.ToString("C2")
    Calculated On:@pool.DividendsCalculatedOn.Value.ToString("MMM d, yyyy")
    Distributed On:@pool.DividendsDistributedOn.Value.ToString("MMM d, yyyy")
    - } - else if (pool.HasLosses) - { -
    -
    Loss Absorbed by Organization
    -

    Investment losses of @pool.AbsorbedLosses.ToString("C2") were absorbed by the organization.

    -

    No dividends were distributed to tenants, and all security deposits remain unchanged.

    -
    - } - else - { -
    -

    No earnings or losses for this period.

    -
    - } -
    -
    -
    -
    - - - @if (dividends.Any()) - { -
    -
    -
    Dividend Distributions (@dividends.Count)
    -
    -
    -
    - - - - - - - - - - - - - - @foreach (var dividend in dividends.OrderByDescending(d => d.DividendAmount)) - { - - - - - - - - - - } - - - - - - - - -
    TenantLease IDBase DividendProrationFinal AmountPayment MethodStatus
    - Tenant #@dividend.TenantId - Lease #@dividend.LeaseId@dividend.BaseDividendAmount.ToString("C2") - @if (dividend.ProrationFactor < 1.0m) - { - - @((dividend.ProrationFactor * 100).ToString("F0"))% - -
    - @dividend.MonthsInPool mo - } - else - { - 100% -
    - Full year - } -
    - @dividend.DividendAmount.ToString("C2") - - @if (dividend.PaymentMethod == ApplicationConstants.DividendPaymentMethods.Pending) - { - Pending Choice - } - else if (dividend.PaymentMethod == ApplicationConstants.DividendPaymentMethods.LeaseCredit) - { - Lease Credit - } - else if (dividend.PaymentMethod == ApplicationConstants.DividendPaymentMethods.Check) - { - Check - } - - @if (dividend.Status == ApplicationConstants.DividendStatuses.Pending) - { - Pending - } - else if (dividend.Status == ApplicationConstants.DividendStatuses.ChoiceMade) - { - Choice Made - } - else if (dividend.Status == ApplicationConstants.DividendStatuses.Applied) - { - Applied - } - else if (dividend.Status == ApplicationConstants.DividendStatuses.Paid) - { - Paid - } -
    Total Dividends:@dividends.Sum(d => d.DividendAmount).ToString("C2")
    -
    -
    -
    - } - else if (pool.HasEarnings) - { -
    - - Dividends Not Yet Calculated -

    Click "Calculate Dividends" to generate dividend distributions for all active leases.

    -
    - } - } -
    - -@code { - [Parameter] - public Guid PoolId { get; set; } - - private SecurityDepositInvestmentPool? pool; - private List dividends = new(); - private bool isLoading = true; - - protected override async Task OnInitializedAsync() - { - await LoadPoolDetails(); - } - - private async Task LoadPoolDetails() - { - isLoading = true; - try - { - pool = await SecurityDepositService.GetInvestmentPoolByIdAsync(PoolId); - - if (pool != null) - { - dividends = await SecurityDepositService.GetDividendsByYearAsync(pool.Year); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Failed to load pool details: {ex.Message}"); - } - finally - { - isLoading = false; - } - } - - private void NavigateToCalculateDividends() - { - NavigationManager.NavigateTo($"/property-management/security-deposits/calculate-dividends/{PoolId}"); - } -} diff --git a/4-Nine/Features/PropertyManagement/Tours/Calendar.razor b/4-Nine/Features/PropertyManagement/Tours/Calendar.razor deleted file mode 100644 index 5f5ae8a..0000000 --- a/4-Nine/Features/PropertyManagement/Tours/Calendar.razor +++ /dev/null @@ -1,667 +0,0 @@ -@page "/PropertyManagement/Tours/Calendar" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@inject UserContextService UserContext -@inject NavigationManager Navigation -@inject ToastService ToastService -@inject TourService TourService - -@rendermode InteractiveServer - -Tour Calendar - -
    -
    -
    -

    Tour Calendar

    -

    View and manage scheduled property tours

    -
    -
    -
    - -
    -
    - - - -
    - -
    -
    - - @if (loading) - { -
    -
    - Loading... -
    -
    - } - else - { - -
    -
    -
    - - -

    @GetDateRangeTitle()

    - -
    - - -
    -
    -
    -
    - - - @if (viewMode == "day") - { -
    -
    -
    @currentDate.ToString("dddd, MMMM dd, yyyy")
    -
    -
    - @RenderDayView() -
    -
    - } - else if (viewMode == "week") - { - @RenderWeekView() - } - else if (viewMode == "month") - { - @RenderMonthView() - } - } -
    - - -@if (selectedTour != null) -{ - -} - -@code { - private List allTours = new(); - private Tour? selectedTour; - private bool loading = true; - private string viewMode = "week"; // day, week, month - private DateTime currentDate = DateTime.Today; - - protected override async Task OnInitializedAsync() - { - await LoadTours(); - } - - private async Task LoadTours() - { - loading = true; - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue) - { - allTours = await TourService.GetAllAsync(); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error loading tours: {ex.Message}"); - } - finally - { - loading = false; - } - } - - private void ChangeView(string mode) - { - viewMode = mode; - } - - private void NavigatePrevious() - { - currentDate = viewMode switch - { - "day" => currentDate.AddDays(-1), - "week" => currentDate.AddDays(-7), - "month" => currentDate.AddMonths(-1), - _ => currentDate - }; - } - - private void NavigateNext() - { - currentDate = viewMode switch - { - "day" => currentDate.AddDays(1), - "week" => currentDate.AddDays(7), - "month" => currentDate.AddMonths(1), - _ => currentDate - }; - } - - private void NavigateToday() - { - currentDate = DateTime.Today; - } - - private string GetDateRangeTitle() - { - return viewMode switch - { - "day" => currentDate.ToString("dddd, MMMM dd, yyyy"), - "week" => $"{GetWeekStart().ToString("MMM dd")} - {GetWeekEnd().ToString("MMM dd, yyyy")}", - "month" => currentDate.ToString("MMMM yyyy"), - _ => "" - }; - } - - private DateTime GetWeekStart() - { - var diff = (7 + (currentDate.DayOfWeek - DayOfWeek.Sunday)) % 7; - return currentDate.AddDays(-1 * diff).Date; - } - - private DateTime GetWeekEnd() - { - return GetWeekStart().AddDays(6); - } - - private RenderFragment RenderDayView() => builder => - { - var dayTours = allTours - .Where(t => t.ScheduledOn.Date == currentDate.Date) - .OrderBy(t => t.ScheduledOn) - .ToList(); - - if (!dayTours.Any()) - { - builder.OpenElement(0, "div"); - builder.AddAttribute(1, "class", "text-center text-muted p-4"); - builder.OpenElement(2, "i"); - builder.AddAttribute(3, "class", "bi bi-calendar-x"); - builder.AddAttribute(4, "style", "font-size: 3rem;"); - builder.CloseElement(); - builder.OpenElement(5, "p"); - builder.AddAttribute(6, "class", "mt-2"); - builder.AddContent(7, "No tours scheduled for this day"); - builder.CloseElement(); - builder.CloseElement(); - } - else - { - builder.OpenElement(10, "div"); - builder.AddAttribute(11, "class", "list-group"); - - foreach (var tour in dayTours) - { - builder.OpenElement(20, "div"); - builder.AddAttribute(21, "class", "list-group-item list-group-item-action"); - builder.AddAttribute(22, "onclick", EventCallback.Factory.Create(this, () => ShowTourDetail(tour))); - builder.AddAttribute(23, "style", "cursor: pointer;"); - - builder.OpenElement(30, "div"); - builder.AddAttribute(31, "class", "d-flex justify-content-between align-items-start"); - - builder.OpenElement(40, "div"); - builder.OpenElement(41, "h6"); - builder.AddAttribute(42, "class", "mb-1"); - builder.OpenElement(43, "i"); - builder.AddAttribute(44, "class", "bi bi-clock"); - builder.CloseElement(); - builder.AddContent(45, $" {tour.ScheduledOn.ToString("h:mm tt")} - {tour.ScheduledOn.AddMinutes(tour.DurationMinutes).ToString("h:mm tt")}"); - builder.CloseElement(); - - builder.OpenElement(50, "p"); - builder.AddAttribute(51, "class", "mb-1"); - builder.AddContent(52, $"{tour.ProspectiveTenant?.FullName} → {tour.Property?.Address}"); - builder.CloseElement(); - - builder.OpenElement(60, "small"); - builder.AddAttribute(61, "class", "text-muted"); - builder.AddContent(62, $"{tour.DurationMinutes} minutes"); - builder.CloseElement(); - builder.CloseElement(); - - builder.OpenElement(70, "div"); - builder.OpenElement(71, "span"); - builder.AddAttribute(72, "class", $"badge {GetStatusBadgeClass(tour.Status)}"); - builder.AddContent(73, tour.Status); - builder.CloseElement(); - builder.CloseElement(); - - builder.CloseElement(); - builder.CloseElement(); - } - - builder.CloseElement(); - } - }; - - private RenderFragment RenderWeekView() => builder => - { - var weekStart = GetWeekStart(); - var weekEnd = GetWeekEnd(); - - builder.OpenElement(0, "div"); - builder.AddAttribute(1, "class", "card"); - builder.OpenElement(2, "div"); - builder.AddAttribute(3, "class", "card-body p-0"); - - builder.OpenElement(10, "div"); - builder.AddAttribute(11, "class", "table-responsive"); - builder.OpenElement(12, "table"); - builder.AddAttribute(13, "class", "table table-bordered mb-0"); - - // Header - builder.OpenElement(20, "thead"); - builder.OpenElement(21, "tr"); - - for (int i = 0; i < 7; i++) - { - var date = weekStart.AddDays(i); - var isToday = date.Date == DateTime.Today; - - builder.OpenElement(30 + i, "th"); - builder.AddAttribute(31 + i, "class", isToday ? "bg-primary text-white text-center" : "text-center"); - builder.AddAttribute(32 + i, "style", "width: 14.28%;"); - builder.OpenElement(40 + i, "div"); - builder.AddContent(41 + i, date.ToString("ddd")); - builder.CloseElement(); - builder.OpenElement(50 + i, "div"); - builder.AddAttribute(51 + i, "class", "fs-5"); - builder.AddContent(52 + i, date.Day.ToString()); - builder.CloseElement(); - builder.CloseElement(); - } - - builder.CloseElement(); - builder.CloseElement(); - - // Body - builder.OpenElement(100, "tbody"); - builder.OpenElement(101, "tr"); - - for (int i = 0; i < 7; i++) - { - var date = weekStart.AddDays(i); - var dayTours = allTours - .Where(t => t.ScheduledOn.Date == date.Date) - .OrderBy(t => t.ScheduledOn) - .ToList(); - - builder.OpenElement(110 + i, "td"); - builder.AddAttribute(111 + i, "class", "align-top"); - builder.AddAttribute(112 + i, "style", "min-height: 300px; vertical-align: top;"); - - if (dayTours.Any()) - { - builder.OpenElement(120 + i, "div"); - builder.AddAttribute(121 + i, "class", "d-flex flex-column gap-1"); - - foreach (var tour in dayTours) - { - var index = 130 + (i * 100) + dayTours.IndexOf(tour); - builder.OpenElement(index, "div"); - builder.AddAttribute(index + 1, "class", $"card border-start border-4 {GetBorderColorClass(tour.Status)} mb-1"); - builder.AddAttribute(index + 2, "onclick", EventCallback.Factory.Create(this, () => ShowTourDetail(tour))); - builder.AddAttribute(index + 3, "style", "cursor: pointer;"); - - builder.OpenElement(index + 10, "div"); - builder.AddAttribute(index + 11, "class", "card-body p-2"); - - builder.OpenElement(index + 20, "small"); - builder.AddAttribute(index + 21, "class", "fw-bold d-block"); - builder.AddContent(index + 22, tour.ScheduledOn.ToString("h:mm tt")); - builder.CloseElement(); - - builder.OpenElement(index + 30, "small"); - builder.AddAttribute(index + 31, "class", "d-block text-truncate"); - builder.AddContent(index + 32, tour.ProspectiveTenant?.FullName); - builder.CloseElement(); - - builder.OpenElement(index + 40, "small"); - builder.AddAttribute(index + 41, "class", "d-block text-truncate text-muted"); - builder.AddContent(index + 42, tour.Property?.Address); - builder.CloseElement(); - - builder.CloseElement(); - builder.CloseElement(); - } - - builder.CloseElement(); - } - - builder.CloseElement(); - } - - builder.CloseElement(); - builder.CloseElement(); - - builder.CloseElement(); - builder.CloseElement(); - builder.CloseElement(); - builder.CloseElement(); - }; - - private RenderFragment RenderMonthView() => builder => - { - var firstDayOfMonth = new DateTime(currentDate.Year, currentDate.Month, 1); - var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); - var firstDayOfWeek = (int)firstDayOfMonth.DayOfWeek; - var daysInMonth = DateTime.DaysInMonth(currentDate.Year, currentDate.Month); - - var startDate = firstDayOfMonth.AddDays(-firstDayOfWeek); - - builder.OpenElement(0, "div"); - builder.AddAttribute(1, "class", "card"); - builder.OpenElement(2, "div"); - builder.AddAttribute(3, "class", "card-body p-0"); - - builder.OpenElement(10, "div"); - builder.AddAttribute(11, "class", "table-responsive"); - builder.OpenElement(12, "table"); - builder.AddAttribute(13, "class", "table table-bordered mb-0"); - - // Header - Days of week - builder.OpenElement(20, "thead"); - builder.OpenElement(21, "tr"); - var daysOfWeek = new[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - foreach (var day in daysOfWeek) - { - builder.OpenElement(30, "th"); - builder.AddAttribute(31, "class", "text-center"); - builder.AddContent(32, day); - builder.CloseElement(); - } - builder.CloseElement(); - builder.CloseElement(); - - // Body - Weeks and days - builder.OpenElement(100, "tbody"); - - var currentWeekDate = startDate; - for (int week = 0; week < 6; week++) - { - builder.OpenElement(110 + week, "tr"); - - for (int day = 0; day < 7; day++) - { - var date = currentWeekDate; - var isCurrentMonth = date.Month == currentDate.Month; - var isToday = date.Date == DateTime.Today; - var dayTours = allTours.Where(t => t.ScheduledOn.Date == date.Date).OrderBy(t => t.ScheduledOn).ToList(); - - var cellIndex = 200 + (week * 10) + day; - builder.OpenElement(cellIndex, "td"); - builder.AddAttribute(cellIndex + 1, "class", isCurrentMonth ? "align-top" : "align-top bg-light text-muted"); - builder.AddAttribute(cellIndex + 2, "style", "min-height: 100px; width: 14.28%;"); - - builder.OpenElement(cellIndex + 10, "div"); - builder.AddAttribute(cellIndex + 11, "class", isToday ? "badge bg-primary rounded-circle mb-1" : "fw-bold mb-1"); - builder.AddContent(cellIndex + 12, date.Day.ToString()); - builder.CloseElement(); - - if (dayTours.Any()) - { - builder.OpenElement(cellIndex + 20, "div"); - builder.AddAttribute(cellIndex + 21, "class", "d-flex flex-column gap-1"); - - foreach (var tour in dayTours.Take(3)) - { - var tourIndex = cellIndex + 30 + dayTours.IndexOf(tour); - builder.OpenElement(tourIndex, "div"); - builder.AddAttribute(tourIndex + 1, "class", $"badge {GetStatusBadgeClass(tour.Status)} text-start text-truncate"); - builder.AddAttribute(tourIndex + 2, "onclick", EventCallback.Factory.Create(this, () => ShowTourDetail(tour))); - builder.AddAttribute(tourIndex + 3, "style", "cursor: pointer; font-size: 0.7rem;"); - builder.AddContent(tourIndex + 4, $"{tour.ScheduledOn.ToString("h:mm tt")} - {tour.ProspectiveTenant?.FullName}"); - builder.CloseElement(); - } - - if (dayTours.Count > 3) - { - builder.OpenElement(cellIndex + 80, "small"); - builder.AddAttribute(cellIndex + 81, "class", "text-muted"); - builder.AddContent(cellIndex + 82, $"+{dayTours.Count - 3} more"); - builder.CloseElement(); - } - - builder.CloseElement(); - } - - builder.CloseElement(); - currentWeekDate = currentWeekDate.AddDays(1); - } - - builder.CloseElement(); - } - - builder.CloseElement(); - builder.CloseElement(); - builder.CloseElement(); - builder.CloseElement(); - builder.CloseElement(); - }; - - private void ShowTourDetail(Tour tour) - { - selectedTour = tour; - } - - private void CloseModal() - { - selectedTour = null; - } - - private async Task MarkCompleted(Guid tourId) - { - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue) - { - var tour = await TourService.GetByIdAsync(tourId); - if (tour != null) - { - CloseModal(); - if (tour.ChecklistId.HasValue) - { - Navigation.NavigateTo($"/PropertyManagement/Checklists/View/{tour.ChecklistId.Value}"); - } - else - { - ToastService.ShowWarning("No property tour checklist found for this tour"); - } - } - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error completing tour: {ex.Message}"); - } - } - - private async Task CancelTour(Guid tourId) - { - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - var userId = await UserContext.GetUserIdAsync(); - - if (organizationId.HasValue && !string.IsNullOrEmpty(userId)) - { - await TourService.CancelTourAsync(tourId); - ToastService.ShowSuccess("Tour cancelled successfully"); - CloseModal(); - await LoadTours(); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error cancelling tour: {ex.Message}"); - } - } - - private void NavigateToProspects() - { - Navigation.NavigateTo("/PropertyManagement/ProspectiveTenants"); - } - - private void NavigateToListView() - { - Navigation.NavigateTo("/PropertyManagement/Tours"); - } - - private string GetStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.TourStatuses.Scheduled => "bg-info", - var s when s == ApplicationConstants.TourStatuses.Completed => "bg-success", - var s when s == ApplicationConstants.TourStatuses.Cancelled => "bg-danger", - var s when s == ApplicationConstants.TourStatuses.NoShow => "bg-warning text-dark", - _ => "bg-secondary" - }; - - private string GetBorderColorClass(string status) => status switch - { - var s when s == ApplicationConstants.TourStatuses.Scheduled => "border-info", - var s when s == ApplicationConstants.TourStatuses.Completed => "border-success", - var s when s == ApplicationConstants.TourStatuses.Cancelled => "border-danger", - var s when s == ApplicationConstants.TourStatuses.NoShow => "border-warning", - _ => "border-secondary" - }; - - private string GetChecklistStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.ChecklistStatuses.Draft => "bg-secondary", - var s when s == ApplicationConstants.ChecklistStatuses.InProgress => "bg-warning text-dark", - var s when s == ApplicationConstants.ChecklistStatuses.Completed => "bg-success", - _ => "bg-secondary" - }; - - private string GetInterestBadgeClass(string? level) => level switch - { - var l when l == ApplicationConstants.TourInterestLevels.VeryInterested => "bg-success", - var l when l == ApplicationConstants.TourInterestLevels.Interested => "bg-primary", - var l when l == ApplicationConstants.TourInterestLevels.Neutral => "bg-secondary", - var l when l == ApplicationConstants.TourInterestLevels.NotInterested => "bg-danger", - _ => "bg-secondary" - }; - - private string GetInterestDisplay(string? level) => level switch - { - var l when l == ApplicationConstants.TourInterestLevels.VeryInterested => "Very Interested", - var l when l == ApplicationConstants.TourInterestLevels.Interested => "Interested", - var l when l == ApplicationConstants.TourInterestLevels.Neutral => "Neutral", - var l when l == ApplicationConstants.TourInterestLevels.NotInterested => "Not Interested", - _ => "Unknown" - }; -} diff --git a/4-Nine/Features/PropertyManagement/Tours/Create.razor b/4-Nine/Features/PropertyManagement/Tours/Create.razor deleted file mode 100644 index c11b832..0000000 --- a/4-Nine/Features/PropertyManagement/Tours/Create.razor +++ /dev/null @@ -1,326 +0,0 @@ -@page "/PropertyManagement/Tours/Schedule/{ProspectId:guid}" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using System.ComponentModel.DataAnnotations -@using Microsoft.AspNetCore.Authorization -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@inject ProspectiveTenantService ProspectiveTenantService -@inject PropertyService PropertyService -@inject TourService TourService -@inject ChecklistService ChecklistService -@inject UserContextService UserContext -@inject NavigationManager Navigation -@inject ToastService ToastService - -@rendermode InteractiveServer - -Schedule Tour - -
    -
    -
    - -

    Schedule Property Tour

    -
    -
    - - @if (loading) - { -
    -
    - Loading... -
    -
    - } - else if (prospect == null) - { -
    - Prospective tenant not found. -
    - } - else - { -
    -
    -
    -
    -
    Tour Details
    -
    -
    - - - - -
    - - -
    - -
    - - - - @foreach (var property in availableProperties) - { - - } - -
    - -
    - - - - @foreach (var template in tourTemplates) - { - - } - -
    Select which checklist to use for this property tour
    -
    - -
    -
    - - -
    -
    - - -
    -
    - -
    - - -
    -
    -
    -
    - - @if (upcomingTours.Any()) - { -
    -
    -
    Upcoming Tours for @prospect.FullName
    -
    -
    -
    - @foreach (var tour in upcomingTours) - { -
    -
    -
    -
    @tour.Property?.Address
    -

    - @tour.ScheduledOn.ToString("MMM dd, yyyy") - @tour.ScheduledOn.ToString("h:mm tt") - (@tour.DurationMinutes min) -

    - Status: @tour.Status -
    - @tour.Status -
    -
    - } -
    -
    -
    - } -
    - -
    -
    -
    -
    Prospect Information
    -
    -
    -
    -
    Name
    -
    @prospect.FullName
    - -
    Email
    -
    @prospect.Email
    - -
    Phone
    -
    @prospect.Phone
    - -
    Status
    -
    @prospect.Status
    - - @if (prospect.InterestedProperty != null) - { -
    Interested In
    -
    @prospect.InterestedProperty.Address
    - } - - @if (prospect.DesiredMoveInDate.HasValue) - { -
    Desired Move-In
    -
    @prospect.DesiredMoveInDate.Value.ToString("MM/dd/yyyy")
    - } - - @if (!string.IsNullOrEmpty(prospect.Notes)) - { -
    Notes
    -
    @prospect.Notes
    - } -
    -
    -
    -
    -
    - } -
    - -@code { - [Parameter] - public Guid ProspectId { get; set; } - - private ProspectiveTenant? prospect; - private List availableProperties = new(); - private List upcomingTours = new(); - private List tourTemplates = new(); - private TourViewModel newTour = new(); - private bool loading = true; - - protected override async Task OnInitializedAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - loading = true; - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue) - { - prospect = await ProspectiveTenantService.GetByIdAsync(ProspectId); - - if (prospect != null) - { - // Load available properties (Available status only) - var allProperties = await PropertyService.GetAllAsync(); - availableProperties = allProperties - .Where(p => p.Status == ApplicationConstants.PropertyStatuses.Available) - .ToList(); - - // Load available Property Tour templates - var allTemplates = await ChecklistService.GetChecklistTemplatesAsync(); - tourTemplates = allTemplates - .Where(t => t.Category == "Tour" && !t.IsDeleted) - .OrderByDescending(t => t.IsSystemTemplate) // System templates first - .ThenBy(t => t.Name) - .ToList(); - - // Load existing tours for this prospect - upcomingTours = await TourService.GetByProspectiveIdAsync(ProspectId); - upcomingTours = upcomingTours - .Where(s => s.ScheduledOn >= DateTime.Now && s.Status == ApplicationConstants.TourStatuses.Scheduled) - .OrderBy(s => s.ScheduledOn) - .ToList(); - - // Initialize new tour ViewModel - newTour = new TourViewModel - { - ProspectiveTenantId = ProspectId, - PropertyId = prospect.InterestedPropertyId ?? Guid.Empty, - ScheduledOn = DateTime.Now.AddDays(1).Date.AddHours(10), // Default to tomorrow at 10 AM - DurationMinutes = 30, - ChecklistTemplateId = tourTemplates.FirstOrDefault(t => t.IsSystemTemplate && t.Name == "Property Tour")?.Id ?? tourTemplates.FirstOrDefault()?.Id - }; - } - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error loading data: {ex.Message}"); - } - finally - { - loading = false; - } - } - - private async Task HandleScheduleTour() - { - try - { - if (newTour.PropertyId == Guid.Empty) - { - ToastService.ShowError("Please select a property"); - return; - } - - if (!newTour.ChecklistTemplateId.HasValue || newTour.ChecklistTemplateId.Value == Guid.Empty) - { - ToastService.ShowError("Please select a checklist template"); - return; - } - - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - var userId = await UserContext.GetUserIdAsync(); - - if (!organizationId.HasValue || string.IsNullOrEmpty(userId)) - { - ToastService.ShowError("User context not available"); - return; - } - - // Map ViewModel to Entity - var tour = new Tour - { - ProspectiveTenantId = newTour.ProspectiveTenantId, - PropertyId = newTour.PropertyId, - ScheduledOn = newTour.ScheduledOn, - DurationMinutes = newTour.DurationMinutes, - OrganizationId = organizationId.Value, - CreatedBy = userId - }; - - await TourService.CreateAsync(tour, newTour.ChecklistTemplateId); - - ToastService.ShowSuccess("Tour scheduled successfully"); - Navigation.NavigateTo("/PropertyManagement/Tours"); - } - catch (Exception ex) - { - ToastService.ShowError($"Error scheduling tour: {ex.Message}"); - } - } - - private void Cancel() - { - Navigation.NavigateTo("/PropertyManagement/ProspectiveTenants"); - } - - public class TourViewModel - { - [Required] - public Guid ProspectiveTenantId { get; set; } - - [Required(ErrorMessage = "Property is required")] - public Guid PropertyId { get; set; } - - [Required(ErrorMessage = "Date and time is required")] - public DateTime ScheduledOn { get; set; } - - [Required(ErrorMessage = "Duration is required")] - [Range(15, 180, ErrorMessage = "Duration must be between 15 and 180 minutes")] - public int DurationMinutes { get; set; } - - [Required(ErrorMessage = "Checklist template is required")] - public Guid? ChecklistTemplateId { get; set; } - } -} diff --git a/4-Nine/Features/PropertyManagement/Tours/Index.razor b/4-Nine/Features/PropertyManagement/Tours/Index.razor deleted file mode 100644 index cc1ebc9..0000000 --- a/4-Nine/Features/PropertyManagement/Tours/Index.razor +++ /dev/null @@ -1,397 +0,0 @@ -@page "/PropertyManagement/Tours" - -@using Nine.Core.Entities -@using Nine.Application.Services -@using Nine.Shared.Services -@using Nine.Application.Services.PdfGenerators -@using Nine.Core.Constants -@using Microsoft.AspNetCore.Authorization -@attribute [OrganizationAuthorize("Owner", "Administrator", "PropertyManager")] -@inject UserContextService UserContext -@inject NavigationManager Navigation -@inject ToastService ToastService -@inject TourService TourService - -@rendermode InteractiveServer - -Property Tours - -
    -
    -
    -

    Property Tours

    -

    Manage and track property tour appointments

    -
    -
    -
    - -
    - -
    -
    - - @if (loading) - { -
    -
    - Loading... -
    -
    - } - else - { - -
    -
    -
    - Upcoming Tours (Next 7 Days) -
    -
    -
    - @if (!upcomingTours.Any()) - { -
    - -

    No tours scheduled for the next 7 days

    -
    - } - else - { -
    - @foreach (var tour in upcomingTours.OrderBy(s => s.ScheduledOn)) - { - var daysUntil = (tour.ScheduledOn.Date - DateTime.Now.Date).Days; - var timeLabel = daysUntil == 0 ? "Today" : daysUntil == 1 ? "Tomorrow" : tour.ScheduledOn.ToString("MMM dd"); - -
    -
    -
    -
    -
    -
    @timeLabel
    -
    @tour.ScheduledOn.ToString("h:mm tt")
    - @tour.DurationMinutes min -
    -
    -
    -
    @tour.ProspectiveTenant?.FullName
    - - @tour.ProspectiveTenant?.Email
    - @tour.ProspectiveTenant?.Phone -
    -
    -
    -
    @tour.Property?.Address
    - - @tour.Property?.City, @tour.Property?.State @tour.Property?.ZipCode - - @if (tour.Checklist != null) - { -
    - - @tour.Checklist.Status - -
    - } -
    -
    -
    - - -
    -
    -
    -
    -
    - } -
    - } -
    -
    - - -
    - -
    - @if (!filteredTours.Any()) - { -
    - -

    No tours found

    -
    - } - else - { -
    - - - - - - - - - - - - - - - @foreach (var tour in filteredTours.OrderByDescending(s => s.ScheduledOn)) - { - - - - - - - - - - - } - -
    Date & TimeProspectPropertyDurationStatusTour ChecklistFeedbackActions
    -
    @tour.ScheduledOn.ToString("MMM dd, yyyy")
    - @tour.ScheduledOn.ToString("h:mm tt") -
    - @tour.ProspectiveTenant?.FullName
    - @tour.ProspectiveTenant?.Phone -
    @tour.Property?.Address@tour.DurationMinutes min - - @tour.Status - - - @if (tour.Checklist != null) - { - - @tour.Checklist.Status - - } - else - { - N/A - } - - @if (!string.IsNullOrEmpty(tour.Feedback)) - { - @(tour.Feedback.Length > 50 ? tour.Feedback.Substring(0, 50) + "..." : tour.Feedback) - } - else if (!string.IsNullOrEmpty(tour.InterestLevel)) - { - - @GetInterestDisplay(tour.InterestLevel) - - } - - @if (tour.Status == ApplicationConstants.TourStatuses.Scheduled) - { -
    - - -
    - } - else if (tour.Status == ApplicationConstants.TourStatuses.Completed && tour.ChecklistId.HasValue) - { - - } - else if (tour.Status == ApplicationConstants.TourStatuses.Completed) - { - - } -
    -
    - } -
    -
    - } -
    - -@code { - private List allTours = new(); - private List upcomingTours = new(); - private bool loading = true; - private string filterStatus = "All"; - - private List filteredTours => - filterStatus == "All" - ? allTours - : allTours.Where(s => s.Status == filterStatus).ToList(); - - protected override async Task OnInitializedAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - loading = true; - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue) - { - allTours = await TourService.GetAllAsync(); - upcomingTours = await TourService.GetUpcomingToursAsync(7); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error loading tours: {ex.Message}"); - } - finally - { - loading = false; - } - } - - private void SetFilter(string status) - { - filterStatus = status; - } - - private void NavigateToProspects() - { - Navigation.NavigateTo("/PropertyManagement/ProspectiveTenants"); - } - - private void NavigateToCalendar() - { - Navigation.NavigateTo("/PropertyManagement/Tours/Calendar"); - } - - private async Task MarkCompleted(Guid tourId) - { - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - if (organizationId.HasValue) - { - var tour = await TourService.GetByIdAsync(tourId); - if (tour != null) - { - // Navigate to the property tour checklist to complete it - if (tour.ChecklistId.HasValue) - { - Navigation.NavigateTo($"/PropertyManagement/Checklists/{tour.ChecklistId.Value}/complete"); - } - else - { - ToastService.ShowWarning("No property tour checklist found for this tour"); - } - } - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error completing tour: {ex.Message}"); - } - } - - private async Task CancelTour(Guid tourId) - { - // TODO: Add confirmation dialog in future sprint - try - { - var organizationId = await UserContext.GetActiveOrganizationIdAsync(); - var userId = await UserContext.GetUserIdAsync(); - if (organizationId.HasValue) - { - await TourService.CancelTourAsync(tourId); - - ToastService.ShowSuccess("Tour cancelled"); - await LoadData(); - } - } - catch (Exception ex) - { - ToastService.ShowError($"Error cancelling tour: {ex.Message}"); - } - } - - private void ViewFeedback(Guid showingId) - { - Navigation.NavigateTo($"/PropertyManagement/Showings/Feedback/{showingId}"); - } - - private string GetStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.TourStatuses.Scheduled => "bg-info", - var s when s == ApplicationConstants.TourStatuses.Completed => "bg-success", - var s when s == ApplicationConstants.TourStatuses.Cancelled => "bg-danger", - var s when s == ApplicationConstants.TourStatuses.NoShow => "bg-warning", - _ => "bg-secondary" - }; - - private string GetInterestBadgeClass(string? level) => level switch - { - var l when l == ApplicationConstants.TourInterestLevels.VeryInterested => "bg-success", - var l when l == ApplicationConstants.TourInterestLevels.Interested => "bg-primary", - var l when l == ApplicationConstants.TourInterestLevels.Neutral => "bg-secondary", - var l when l == ApplicationConstants.TourInterestLevels.NotInterested => "bg-danger", - _ => "bg-secondary" - }; - - private string GetInterestDisplay(string? level) => level switch - { - var l when l == ApplicationConstants.TourInterestLevels.VeryInterested => "Very Interested", - var l when l == ApplicationConstants.TourInterestLevels.NotInterested => "Not Interested", - _ => level ?? "N/A" - }; - - private string GetChecklistStatusBadgeClass(string status) => status switch - { - var s when s == ApplicationConstants.ChecklistStatuses.Draft => "bg-secondary", - var s when s == ApplicationConstants.ChecklistStatuses.InProgress => "bg-info", - var s when s == ApplicationConstants.ChecklistStatuses.Completed => "bg-success", - _ => "bg-secondary" - }; - - private void ViewTourChecklist(Guid checklistId) - { - Navigation.NavigateTo($"/PropertyManagement/Checklists/{checklistId}"); - } -} diff --git a/4-Nine/Nine.csproj b/4-Nine/Nine.csproj index 0b3cdf2..d56f390 100644 --- a/4-Nine/Nine.csproj +++ b/4-Nine/Nine.csproj @@ -12,10 +12,10 @@ Data/Migrations - 1.1.0 - 1.1.0.0 - 1.1.0.0 - 1.1.0 + 1.2.0 + 1.2.0.0 + 1.2.0.0 + 1.2.0 @@ -49,6 +49,23 @@ PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -66,17 +83,16 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + - + + + + + <_ElectronBinaryName>electron + <_ElectronPlatformArch>linux-x64 + <_ElectronCacheDir>$([System.Environment]::GetEnvironmentVariable('HOME'))/.cache/electron + + + + <_ElectronBinaryName>electron.exe + <_ElectronPlatformArch>win32-x64 + <_ElectronCacheDir>$([System.Environment]::GetEnvironmentVariable('LOCALAPPDATA'))\electron\Cache + + + + <_ElectronBinaryPath>$(OutDir).electron/node_modules/electron/dist/$(_ElectronBinaryName) + <_ElectronDistPath>$(OutDir).electron/node_modules/electron/dist + <_ElectronZipName>electron-v$(ElectronVersion)-$(_ElectronPlatformArch).zip + + + + + + + + + + <_ElectronZipCandidate Include="$(_ElectronCacheDir)\**\$(_ElectronZipName)" /> + + + + + <_ElectronZipPath>@(_ElectronZipCandidate) + <_ElectronZipPath Condition="$(_ElectronZipPath.Contains(';'))">$(_ElectronZipPath.Substring(0, $(_ElectronZipPath.IndexOf(';')))) + + + + + + + + + + + + + + diff --git a/4-Nine/Nine.csproj.lscache b/4-Nine/Nine.csproj.lscache new file mode 100644 index 0000000..aac0496 --- /dev/null +++ b/4-Nine/Nine.csproj.lscache @@ -0,0 +1,832 @@ +version=1 + +# This file caches language service data to improve the performance of C# Dev Kit. +# It is not intended for manual editing. It can safely be deleted and will be +# regenerated automatically. For more information, see https://aka.ms/lscache +# +# To control where cache files are stored, use the following VS Code setting: +# "dotnet.projectsystem.cacheInProjectFolder": true + +[project] +language=C# +primary +lastDtbSucceeded + +[properties] +AssemblyName=Nine +CommandLineArgsForDesignTimeEvaluation=-langversion:14.0 -define:TRACE +CompilerGeneratedFilesOutputPath= +MaxSupportedLangVersion=14.0 +ProjectAssetsFile=obj/project.assets.json +RootNamespace=Nine +RunAnalyzers= +RunAnalyzersDuringLiveAnalysis= +SolutionPath=../Nine.sln +TargetFrameworkIdentifier=.NETCoreApp +TargetPath=bin/Debug/net10.0/linux-x64/Nine.dll +TargetRefPath=obj/Debug/net10.0/linux-x64/ref/Nine.dll +TemporaryDependencyNodeTargetIdentifier=net10.0 + +[commandLineArguments] +/noconfig +/unsafe- +/checked- +/nowarn:1701,1702,1701,1702 +/fullpaths +/nostdlib+ +/platform:x64 +/errorreport:prompt +/warn:10 +/define:TRACE;DEBUG;NET;NET10_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NET8_0_OR_GREATER;NET9_0_OR_GREATER;NET10_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER +/highentropyva+ +/nullable:enable +/features:"InterceptorsNamespaces=;Microsoft.Extensions.Validation.Generated" +/debug+ +/debug:portable +/filealign:512 +/optimize- +/out:obj/Debug/net10.0/linux-x64/Nine.dll +/refout:obj/Debug/net10.0/linux-x64/refint/Nine.dll +/target:exe +/warnaserror- +/utf8output +/deterministic+ +/langversion:14.0 +/features:use-roslyn-tokenizer=true +/warnaserror+:NU1605,SYSLIB0011 + +[sourceFiles] +Data/Migrations/ + 20260104205913_InitialCreate.cs + 20260104205913_InitialCreate.Designer.cs + SimpleStartDbContextModelSnapshot.cs +Data/NineDbContext.cs +Entities/ApplicationUser.cs +Extensions/ + ElectronServiceExtensions.cs + SecurityHeadersMiddleware.cs + WebServiceExtensions.cs +Features/PropertyManagement/Repairs/RepairFormModel.cs +obj/Debug/net10.0/linux-x64/ + .NETCoreApp,Version=v10.0.AssemblyAttributes.cs + EmbeddedAttribute.cs + Nine.AssemblyInfo.cs + Nine.GlobalUsings.g.cs + ValidatableTypeAttribute.cs +Program.cs +Services/ + ElectronPathService.cs + WebPathService.cs +Shared/Authorization/ + OrganizationAuthorizeAttribute.cs + OrganizationPolicyProvider.cs + OrganizationRoleAuthorizationHandler copy.cs + OrganizationRoleRequirement.cs +Shared/Components/Account/ + AccountConstants.cs + IdentityComponentsEndpointRouteBuilderExtensions.cs + IdentityNoOpEmailSender.cs + IdentityRedirectManager.cs + IdentityRevalidatingAuthenticationStateProvider.cs + IdentityUserAccessor.cs +Shared/Services/ + DatabaseBackupService.cs + EntityRouteHelper.cs + SessionTimeoutService.cs + ThemeService.cs + ToastService.cs + UserContextService.cs + +[metadataReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.AspNetCore.Antiforgery.dll + Microsoft.AspNetCore.Authentication.Abstractions.dll + Microsoft.AspNetCore.Authentication.BearerToken.dll + Microsoft.AspNetCore.Authentication.Cookies.dll + Microsoft.AspNetCore.Authentication.Core.dll + Microsoft.AspNetCore.Authentication.dll + Microsoft.AspNetCore.Authentication.OAuth.dll + Microsoft.AspNetCore.Authorization.dll + Microsoft.AspNetCore.Authorization.Policy.dll + Microsoft.AspNetCore.Components.Authorization.dll + Microsoft.AspNetCore.Components.dll + Microsoft.AspNetCore.Components.Endpoints.dll + Microsoft.AspNetCore.Components.Forms.dll + Microsoft.AspNetCore.Components.Server.dll + Microsoft.AspNetCore.Components.Web.dll + Microsoft.AspNetCore.Connections.Abstractions.dll + Microsoft.AspNetCore.CookiePolicy.dll + Microsoft.AspNetCore.Cors.dll + Microsoft.AspNetCore.Cryptography.Internal.dll + Microsoft.AspNetCore.Cryptography.KeyDerivation.dll + Microsoft.AspNetCore.DataProtection.Abstractions.dll + Microsoft.AspNetCore.DataProtection.dll + Microsoft.AspNetCore.DataProtection.Extensions.dll + Microsoft.AspNetCore.Diagnostics.Abstractions.dll + Microsoft.AspNetCore.Diagnostics.dll + Microsoft.AspNetCore.Diagnostics.HealthChecks.dll + Microsoft.AspNetCore.dll + Microsoft.AspNetCore.HostFiltering.dll + Microsoft.AspNetCore.Hosting.Abstractions.dll + Microsoft.AspNetCore.Hosting.dll + Microsoft.AspNetCore.Hosting.Server.Abstractions.dll + Microsoft.AspNetCore.Html.Abstractions.dll + Microsoft.AspNetCore.Http.Abstractions.dll + Microsoft.AspNetCore.Http.Connections.Common.dll + Microsoft.AspNetCore.Http.Connections.dll + Microsoft.AspNetCore.Http.dll + Microsoft.AspNetCore.Http.Extensions.dll + Microsoft.AspNetCore.Http.Features.dll + Microsoft.AspNetCore.Http.Results.dll + Microsoft.AspNetCore.HttpLogging.dll + Microsoft.AspNetCore.HttpOverrides.dll + Microsoft.AspNetCore.HttpsPolicy.dll + Microsoft.AspNetCore.Identity.dll + Microsoft.AspNetCore.Localization.dll + Microsoft.AspNetCore.Localization.Routing.dll + Microsoft.AspNetCore.Metadata.dll + Microsoft.AspNetCore.Mvc.Abstractions.dll + Microsoft.AspNetCore.Mvc.ApiExplorer.dll + Microsoft.AspNetCore.Mvc.Core.dll + Microsoft.AspNetCore.Mvc.Cors.dll + Microsoft.AspNetCore.Mvc.DataAnnotations.dll + Microsoft.AspNetCore.Mvc.dll + Microsoft.AspNetCore.Mvc.Formatters.Json.dll + Microsoft.AspNetCore.Mvc.Formatters.Xml.dll + Microsoft.AspNetCore.Mvc.Localization.dll + Microsoft.AspNetCore.Mvc.Razor.dll + Microsoft.AspNetCore.Mvc.RazorPages.dll + Microsoft.AspNetCore.Mvc.TagHelpers.dll + Microsoft.AspNetCore.Mvc.ViewFeatures.dll + Microsoft.AspNetCore.OutputCaching.dll + Microsoft.AspNetCore.RateLimiting.dll + Microsoft.AspNetCore.Razor.dll + Microsoft.AspNetCore.Razor.Runtime.dll + Microsoft.AspNetCore.RequestDecompression.dll + Microsoft.AspNetCore.ResponseCaching.Abstractions.dll + Microsoft.AspNetCore.ResponseCaching.dll + Microsoft.AspNetCore.ResponseCompression.dll + Microsoft.AspNetCore.Rewrite.dll + Microsoft.AspNetCore.Routing.Abstractions.dll + Microsoft.AspNetCore.Routing.dll + Microsoft.AspNetCore.Server.HttpSys.dll + Microsoft.AspNetCore.Server.IIS.dll + Microsoft.AspNetCore.Server.IISIntegration.dll + Microsoft.AspNetCore.Server.Kestrel.Core.dll + Microsoft.AspNetCore.Server.Kestrel.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll + Microsoft.AspNetCore.Session.dll + Microsoft.AspNetCore.SignalR.Common.dll + Microsoft.AspNetCore.SignalR.Core.dll + Microsoft.AspNetCore.SignalR.dll + Microsoft.AspNetCore.SignalR.Protocols.Json.dll + Microsoft.AspNetCore.StaticAssets.dll + Microsoft.AspNetCore.StaticFiles.dll + Microsoft.AspNetCore.WebSockets.dll + Microsoft.AspNetCore.WebUtilities.dll + Microsoft.Extensions.Caching.Abstractions.dll + Microsoft.Extensions.Caching.Memory.dll + Microsoft.Extensions.Configuration.Abstractions.dll + Microsoft.Extensions.Configuration.Binder.dll + Microsoft.Extensions.Configuration.CommandLine.dll + Microsoft.Extensions.Configuration.dll + Microsoft.Extensions.Configuration.EnvironmentVariables.dll + Microsoft.Extensions.Configuration.FileExtensions.dll + Microsoft.Extensions.Configuration.Ini.dll + Microsoft.Extensions.Configuration.Json.dll + Microsoft.Extensions.Configuration.KeyPerFile.dll + Microsoft.Extensions.Configuration.UserSecrets.dll + Microsoft.Extensions.Configuration.Xml.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + Microsoft.Extensions.DependencyInjection.dll + Microsoft.Extensions.Diagnostics.Abstractions.dll + Microsoft.Extensions.Diagnostics.dll + Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll + Microsoft.Extensions.Diagnostics.HealthChecks.dll + Microsoft.Extensions.Features.dll + Microsoft.Extensions.FileProviders.Abstractions.dll + Microsoft.Extensions.FileProviders.Composite.dll + Microsoft.Extensions.FileProviders.Embedded.dll + Microsoft.Extensions.FileProviders.Physical.dll + Microsoft.Extensions.FileSystemGlobbing.dll + Microsoft.Extensions.Hosting.Abstractions.dll + Microsoft.Extensions.Hosting.dll + Microsoft.Extensions.Http.dll + Microsoft.Extensions.Identity.Core.dll + Microsoft.Extensions.Identity.Stores.dll + Microsoft.Extensions.Localization.Abstractions.dll + Microsoft.Extensions.Localization.dll + Microsoft.Extensions.Logging.Abstractions.dll + Microsoft.Extensions.Logging.Configuration.dll + Microsoft.Extensions.Logging.Console.dll + Microsoft.Extensions.Logging.Debug.dll + Microsoft.Extensions.Logging.dll + Microsoft.Extensions.Logging.EventLog.dll + Microsoft.Extensions.Logging.EventSource.dll + Microsoft.Extensions.Logging.TraceSource.dll + Microsoft.Extensions.ObjectPool.dll + Microsoft.Extensions.Options.ConfigurationExtensions.dll + Microsoft.Extensions.Options.DataAnnotations.dll + Microsoft.Extensions.Options.dll + Microsoft.Extensions.Primitives.dll + Microsoft.Extensions.Validation.dll + Microsoft.Extensions.WebEncoders.dll + Microsoft.JSInterop.dll + Microsoft.Net.Http.Headers.dll + System.Diagnostics.EventLog.dll + System.Formats.Cbor.dll + System.Security.Cryptography.Xml.dll + System.Threading.RateLimiting.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.CSharp.dll + Microsoft.VisualBasic.Core.dll + Microsoft.VisualBasic.dll + Microsoft.Win32.Primitives.dll + Microsoft.Win32.Registry.dll + mscorlib.dll + netstandard.dll + System.AppContext.dll + System.Buffers.dll + System.Collections.Concurrent.dll + System.Collections.dll + System.Collections.Immutable.dll + System.Collections.NonGeneric.dll + System.Collections.Specialized.dll + System.ComponentModel.Annotations.dll + System.ComponentModel.DataAnnotations.dll + System.ComponentModel.dll + System.ComponentModel.EventBasedAsync.dll + System.ComponentModel.Primitives.dll + System.ComponentModel.TypeConverter.dll + System.Configuration.dll + System.Console.dll + System.Core.dll + System.Data.Common.dll + System.Data.DataSetExtensions.dll + System.Data.dll + System.Diagnostics.Contracts.dll + System.Diagnostics.Debug.dll + System.Diagnostics.DiagnosticSource.dll + System.Diagnostics.FileVersionInfo.dll + System.Diagnostics.Process.dll + System.Diagnostics.StackTrace.dll + System.Diagnostics.TextWriterTraceListener.dll + System.Diagnostics.Tools.dll + System.Diagnostics.TraceSource.dll + System.Diagnostics.Tracing.dll + System.dll + System.Drawing.dll + System.Drawing.Primitives.dll + System.Dynamic.Runtime.dll + System.Formats.Asn1.dll + System.Formats.Tar.dll + System.Globalization.Calendars.dll + System.Globalization.dll + System.Globalization.Extensions.dll + System.IO.Compression.Brotli.dll + System.IO.Compression.dll + System.IO.Compression.FileSystem.dll + System.IO.Compression.ZipFile.dll + System.IO.dll + System.IO.FileSystem.AccessControl.dll + System.IO.FileSystem.dll + System.IO.FileSystem.DriveInfo.dll + System.IO.FileSystem.Primitives.dll + System.IO.FileSystem.Watcher.dll + System.IO.IsolatedStorage.dll + System.IO.MemoryMappedFiles.dll + System.IO.Pipelines.dll + System.IO.Pipes.AccessControl.dll + System.IO.Pipes.dll + System.IO.UnmanagedMemoryStream.dll + System.Linq.AsyncEnumerable.dll + System.Linq.dll + System.Linq.Expressions.dll + System.Linq.Parallel.dll + System.Linq.Queryable.dll + System.Memory.dll + System.Net.dll + System.Net.Http.dll + System.Net.Http.Json.dll + System.Net.HttpListener.dll + System.Net.Mail.dll + System.Net.NameResolution.dll + System.Net.NetworkInformation.dll + System.Net.Ping.dll + System.Net.Primitives.dll + System.Net.Quic.dll + System.Net.Requests.dll + System.Net.Security.dll + System.Net.ServerSentEvents.dll + System.Net.ServicePoint.dll + System.Net.Sockets.dll + System.Net.WebClient.dll + System.Net.WebHeaderCollection.dll + System.Net.WebProxy.dll + System.Net.WebSockets.Client.dll + System.Net.WebSockets.dll + System.Numerics.dll + System.Numerics.Vectors.dll + System.ObjectModel.dll + System.Reflection.DispatchProxy.dll + System.Reflection.dll + System.Reflection.Emit.dll + System.Reflection.Emit.ILGeneration.dll + System.Reflection.Emit.Lightweight.dll + System.Reflection.Extensions.dll + System.Reflection.Metadata.dll + System.Reflection.Primitives.dll + System.Reflection.TypeExtensions.dll + System.Resources.Reader.dll + System.Resources.ResourceManager.dll + System.Resources.Writer.dll + System.Runtime.CompilerServices.Unsafe.dll + System.Runtime.CompilerServices.VisualC.dll + System.Runtime.dll + System.Runtime.Extensions.dll + System.Runtime.Handles.dll + System.Runtime.InteropServices.dll + System.Runtime.InteropServices.JavaScript.dll + System.Runtime.InteropServices.RuntimeInformation.dll + System.Runtime.Intrinsics.dll + System.Runtime.Loader.dll + System.Runtime.Numerics.dll + System.Runtime.Serialization.dll + System.Runtime.Serialization.Formatters.dll + System.Runtime.Serialization.Json.dll + System.Runtime.Serialization.Primitives.dll + System.Runtime.Serialization.Xml.dll + System.Security.AccessControl.dll + System.Security.Claims.dll + System.Security.Cryptography.Algorithms.dll + System.Security.Cryptography.Cng.dll + System.Security.Cryptography.Csp.dll + System.Security.Cryptography.dll + System.Security.Cryptography.Encoding.dll + System.Security.Cryptography.OpenSsl.dll + System.Security.Cryptography.Primitives.dll + System.Security.Cryptography.X509Certificates.dll + System.Security.dll + System.Security.Principal.dll + System.Security.Principal.Windows.dll + System.Security.SecureString.dll + System.ServiceModel.Web.dll + System.ServiceProcess.dll + System.Text.Encoding.CodePages.dll + System.Text.Encoding.dll + System.Text.Encoding.Extensions.dll + System.Text.Encodings.Web.dll + System.Text.Json.dll + System.Text.RegularExpressions.dll + System.Threading.AccessControl.dll + System.Threading.Channels.dll + System.Threading.dll + System.Threading.Overlapped.dll + System.Threading.Tasks.Dataflow.dll + System.Threading.Tasks.dll + System.Threading.Tasks.Extensions.dll + System.Threading.Tasks.Parallel.dll + System.Threading.Thread.dll + System.Threading.ThreadPool.dll + System.Threading.Timer.dll + System.Transactions.dll + System.Transactions.Local.dll + System.ValueTuple.dll + System.Web.dll + System.Web.HttpUtility.dll + System.Windows.dll + System.Xml.dll + System.Xml.Linq.dll + System.Xml.ReaderWriter.dll + System.Xml.Serialization.dll + System.Xml.XDocument.dll + System.Xml.XmlDocument.dll + System.Xml.XmlSerializer.dll + System.Xml.XPath.dll + System.Xml.XPath.XDocument.dll + WindowsBase.dll +../ + 0-Nine.Core/obj/Debug/net10.0/ref/Nine.Core.dll + 1-Nine.Infrastructure/obj/Debug/net10.0/ref/Nine.Infrastructure.dll + 2-Nine.Application/obj/Debug/net10.0/ref/Nine.Application.dll + 3-Nine.Shared.UI/obj/Debug/net10.0/ref/Nine.Shared.UI.dll +/ + electronnet.core.api/0.4.1/lib/net10.0/ElectronNET.API.dll + electronnet.core.aspnet/0.4.1/lib/net10.0/ElectronNET.AspNet.dll + electronnet.core/0.4.1/lib/net10.0/ElectronNET.dll + humanizer.core/2.14.1/lib/net6.0/Humanizer.dll + microsoft.aspnetcore.diagnostics.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll + microsoft.aspnetcore.http.connections.client/10.0.1/lib/net10.0/Microsoft.AspNetCore.Http.Connections.Client.dll + microsoft.aspnetcore.identity.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll + microsoft.aspnetcore.signalr.client.core/10.0.1/lib/net10.0/Microsoft.AspNetCore.SignalR.Client.Core.dll + microsoft.aspnetcore.signalr.client/10.0.1/lib/net10.0/Microsoft.AspNetCore.SignalR.Client.dll + microsoft.build.framework/17.14.28/ref/net9.0/Microsoft.Build.Framework.dll + microsoft.build.tasks.core/17.14.28/ref/net9.0/Microsoft.Build.Tasks.Core.dll + microsoft.build.utilities.core/17.14.28/ref/net9.0/Microsoft.Build.Utilities.Core.dll + microsoft.build/17.7.2/ref/net7.0/Microsoft.Build.dll + microsoft.codeanalysis.common/4.14.0/lib/net9.0/Microsoft.CodeAnalysis.dll + microsoft.codeanalysis.csharp.workspaces/4.14.0/lib/net9.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll + microsoft.codeanalysis.csharp/4.14.0/lib/net9.0/Microsoft.CodeAnalysis.CSharp.dll + microsoft.codeanalysis.workspaces.common/4.14.0/lib/net9.0/Microsoft.CodeAnalysis.Workspaces.dll + microsoft.codeanalysis.workspaces.msbuild/4.14.0/lib/net9.0/ + Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.dll + Microsoft.CodeAnalysis.Workspaces.MSBuild.dll + microsoft.data.sqlite.core/10.0.1/lib/net8.0/Microsoft.Data.Sqlite.dll + microsoft.entityframeworkcore.abstractions/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Abstractions.dll + microsoft.entityframeworkcore.relational/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Relational.dll + microsoft.entityframeworkcore.sqlite.core/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Sqlite.dll + microsoft.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.dll + microsoft.extensions.dependencymodel/10.0.1/lib/net10.0/Microsoft.Extensions.DependencyModel.dll + microsoft.identitymodel.abstractions/8.3.1/lib/net9.0/Microsoft.IdentityModel.Abstractions.dll + microsoft.identitymodel.jsonwebtokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.JsonWebTokens.dll + microsoft.identitymodel.logging/8.3.1/lib/net9.0/Microsoft.IdentityModel.Logging.dll + microsoft.identitymodel.tokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.Tokens.dll + microsoft.net.stringtools/17.14.28/ref/net9.0/Microsoft.NET.StringTools.dll + microsoft.win32.systemevents/8.0.0/lib/net8.0/Microsoft.Win32.SystemEvents.dll + mono.texttemplating/3.0.0/lib/net6.0/Mono.TextTemplating.dll + newtonsoft.json/13.0.3/lib/net6.0/Newtonsoft.Json.dll + questpdf/2025.12.1/lib/net10.0/QuestPDF.dll + sendgrid/9.29.3/lib/netstandard2.0/SendGrid.dll + socketio.core/3.1.2/lib/netstandard2.0/SocketIO.Core.dll + socketio.serializer.core/3.1.2/lib/netstandard2.0/SocketIO.Serializer.Core.dll + socketio.serializer.systemtextjson/3.1.2/lib/netstandard2.0/SocketIO.Serializer.SystemTextJson.dll + socketioclient/3.1.2/lib/net6.0/SocketIOClient.dll + sqlitepclraw.bundle_e_sqlite3/2.1.11/lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll + sqlitepclraw.core/2.1.11/lib/netstandard2.0/SQLitePCLRaw.core.dll + sqlitepclraw.provider.e_sqlcipher/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlcipher.dll + sqlitepclraw.provider.e_sqlite3/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll + starkbank-ecdsa/1.3.3/lib/netstandard2.1/StarkbankEcdsa.dll + system.codedom/9.0.0/lib/net9.0/System.CodeDom.dll + system.composition.attributedmodel/9.0.0/lib/net9.0/System.Composition.AttributedModel.dll + system.composition.convention/9.0.0/lib/net9.0/System.Composition.Convention.dll + system.composition.hosting/9.0.0/lib/net9.0/System.Composition.Hosting.dll + system.composition.runtime/9.0.0/lib/net9.0/System.Composition.Runtime.dll + system.composition.typedparts/9.0.0/lib/net9.0/System.Composition.TypedParts.dll + system.configuration.configurationmanager/9.0.0/lib/net9.0/System.Configuration.ConfigurationManager.dll + system.drawing.common/8.0.22/lib/net8.0/System.Drawing.Common.dll + system.formats.nrbf/9.0.0/lib/net9.0/System.Formats.Nrbf.dll + system.identitymodel.tokens.jwt/8.3.1/lib/net9.0/System.IdentityModel.Tokens.Jwt.dll + system.reflection.metadataloadcontext/7.0.0/lib/net7.0/System.Reflection.MetadataLoadContext.dll + system.resources.extensions/9.0.0/lib/net9.0/System.Resources.Extensions.dll + system.security.cryptography.pkcs/9.0.0/lib/net9.0/System.Security.Cryptography.Pkcs.dll + system.security.cryptography.protecteddata/9.0.0/lib/net9.0/System.Security.Cryptography.ProtectedData.dll + system.security.permissions/9.0.0/lib/net9.0/System.Security.Permissions.dll + system.windows.extensions/9.0.0/lib/net9.0/System.Windows.Extensions.dll + twilio/7.14.0/lib/net6.0/Twilio.dll + +[analyzerReferences] +../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.AspNetCore.App.Analyzers.dll + Microsoft.AspNetCore.App.CodeFixes.dll + Microsoft.AspNetCore.App.SourceGenerators.dll + Microsoft.AspNetCore.Components.Analyzers.dll + Microsoft.Extensions.Logging.Generators.dll + Microsoft.Extensions.Options.SourceGeneration.dll + Microsoft.Extensions.Validation.ValidationsGenerator.dll +../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.Interop.ComInterfaceGenerator.dll + Microsoft.Interop.JavaScript.JSImportGenerator.dll + Microsoft.Interop.LibraryImportGenerator.dll + Microsoft.Interop.SourceGeneration.dll + System.Text.Json.SourceGeneration.dll + System.Text.RegularExpressions.Generator.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk.Razor/source-generators/ + Microsoft.AspNetCore.Razor.Utilities.Shared.dll + Microsoft.CodeAnalysis.Razor.Compiler.dll + Microsoft.Extensions.ObjectPool.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk.Web/analyzers/cs/ + Microsoft.AspNetCore.Analyzers.dll + Microsoft.AspNetCore.Mvc.Analyzers.dll +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/ + Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll + Microsoft.CodeAnalysis.NetAnalyzers.dll +/microsoft.codeanalysis.analyzers/3.11.0/analyzers/dotnet/cs/ + Microsoft.CodeAnalysis.Analyzers.dll + Microsoft.CodeAnalysis.CSharp.Analyzers.dll +/microsoft.entityframeworkcore.analyzers/10.0.1/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll + +[analyzerConfigFiles] +../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig +obj/Debug/net10.0/linux-x64/Nine.GeneratedMSBuildEditorConfig.editorconfig + +[additionalFiles] +Features/Administration/Application/Pages/ + DailyReport.razor + InitializeSchemaVersion.razor +Features/Administration/ + Dashboard.razor + Organizations/Pages/ + CreateOrganization.razor + EditOrganization.razor + ManageUsers.razor + Organizations.razor + ViewOrganization.razor + Settings/Pages/ + ApplicationSettings.razor + DatabasePreview.razor + DatabaseSettings.razor + InitializeSchemaVersion.razor + Users/ + Manage.razor + Pages/Create.razor + View.razor +Features/Calendar/ + Calendar.razor + CalendarListView.razor +Features/ + DatabaseUnlock/Index.razor + Notifications/Pages/ + Index.razor + Preferences.razor + PropertyManagement/Applications/Pages/ + Edit.razor + Index.razor + View.razor + PropertyManagement/Checklists/Pages/ + Create.razor + Edit.razor + Index.razor + MyChecklists.razor + View.razor + PropertyManagement/ChecklistTemplates/ + Create.razor + Edit.razor + Index.razor + PropertyManagement/Documents/Pages/ + Documents.razor + LeaseDocuments.razor + _Imports.razor + PropertyManagement/Inspections/ + InspectionChecklistItem.razor + InspectionSectionView.razor + Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Invoices/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Leases/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Payments/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Properties/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Repairs/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Reports/Pages/ + IncomeStatementReport.razor + PropertyPerformanceReport.razor + RentRollReport.razor + Reports.razor + TaxReport.razor + PropertyManagement/ + SecurityDeposits/Pages/SecurityDeposits.razor + Tenants/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + _Imports.razor +Shared/ + App.razor + Components/Account/Pages/ + AccessDenied.razor + ConfirmEmail.razor + ConfirmEmailChange.razor + ExternalLogin.razor + ForgotPassword.razor + ForgotPasswordConfirmation.razor + InvalidPasswordReset.razor + InvalidUser.razor + Lockout.razor + Login.razor + LoginWith2fa.razor + LoginWithRecoveryCode.razor + Manage/ + ChangePassword.razor + DeletePersonalData.razor + Disable2fa.razor + Email.razor + EnableAuthenticator.razor + ExternalLogins.razor + GenerateRecoveryCodes.razor + Index.razor + PersonalData.razor + ResetAuthenticator.razor + SetPassword.razor + TwoFactorAuthentication.razor + _Imports.razor + Register.razor + RegisterConfirmation.razor + ResendEmailConfirmation.razor + ResetPassword.razor + ResetPasswordConfirmation.razor + _Imports.razor + Components/Account/Shared/ + ExternalLoginPicker.razor + ManageLayout.razor + ManageNavMenu.razor + RedirectToLogin.razor + ShowRecoveryCodes.razor + StatusMessage.razor + Components/ + AuthorizedHeaderSection.razor + LeaseRenewalWidget.razor + NotesTimeline.razor + NotificationBellWrapper.razor + OrganizationSwitcherWrapper.razor + Pages/ + About.razor + Error.razor + Home.razor + TestColorPalette.razor + TestSharedComponents.razor + PasswordInputModal.razor + SchemaValidationWarning.razor + SessionTimeoutModal.razor + Shared/OrganizationAuthorizeView.razor + ToastContainer.razor + Layout/ + MainLayout.razor + NavMenu.razor + Routes.razor + _Imports.razor +_Imports.razor + +[dynamicFiles] +Features/Administration/Application/Pages/ + DailyReport.razor + InitializeSchemaVersion.razor +Features/Administration/ + Dashboard.razor + Organizations/Pages/ + CreateOrganization.razor + EditOrganization.razor + ManageUsers.razor + Organizations.razor + ViewOrganization.razor + Settings/Pages/ + ApplicationSettings.razor + DatabasePreview.razor + DatabaseSettings.razor + InitializeSchemaVersion.razor + Users/ + Manage.razor + Pages/Create.razor + View.razor +Features/Calendar/ + Calendar.razor + CalendarListView.razor +Features/ + DatabaseUnlock/Index.razor + Notifications/Pages/ + Index.razor + Preferences.razor + PropertyManagement/Applications/Pages/ + Edit.razor + Index.razor + View.razor + PropertyManagement/Checklists/Pages/ + Create.razor + Edit.razor + Index.razor + MyChecklists.razor + View.razor + PropertyManagement/ChecklistTemplates/ + Create.razor + Edit.razor + Index.razor + PropertyManagement/Documents/Pages/ + Documents.razor + LeaseDocuments.razor + _Imports.razor + PropertyManagement/Inspections/ + InspectionChecklistItem.razor + InspectionSectionView.razor + Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Invoices/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Leases/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Payments/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Properties/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Repairs/ + Create.razor + Edit.razor + Index.razor + View.razor + PropertyManagement/Reports/Pages/ + IncomeStatementReport.razor + PropertyPerformanceReport.razor + RentRollReport.razor + Reports.razor + TaxReport.razor + PropertyManagement/ + SecurityDeposits/Pages/SecurityDeposits.razor + Tenants/Pages/ + Create.razor + Edit.razor + Index.razor + View.razor + _Imports.razor +Shared/ + App.razor + Components/Account/Pages/ + AccessDenied.razor + ConfirmEmail.razor + ConfirmEmailChange.razor + ExternalLogin.razor + ForgotPassword.razor + ForgotPasswordConfirmation.razor + InvalidPasswordReset.razor + InvalidUser.razor + Lockout.razor + Login.razor + LoginWith2fa.razor + LoginWithRecoveryCode.razor + Manage/ + ChangePassword.razor + DeletePersonalData.razor + Disable2fa.razor + Email.razor + EnableAuthenticator.razor + ExternalLogins.razor + GenerateRecoveryCodes.razor + Index.razor + PersonalData.razor + ResetAuthenticator.razor + SetPassword.razor + TwoFactorAuthentication.razor + _Imports.razor + Register.razor + RegisterConfirmation.razor + ResendEmailConfirmation.razor + ResetPassword.razor + ResetPasswordConfirmation.razor + _Imports.razor + Components/Account/Shared/ + ExternalLoginPicker.razor + ManageLayout.razor + ManageNavMenu.razor + RedirectToLogin.razor + ShowRecoveryCodes.razor + StatusMessage.razor + Components/ + AuthorizedHeaderSection.razor + LeaseRenewalWidget.razor + NotesTimeline.razor + NotificationBellWrapper.razor + OrganizationSwitcherWrapper.razor + Pages/ + About.razor + Error.razor + Home.razor + TestColorPalette.razor + TestSharedComponents.razor + PasswordInputModal.razor + SchemaValidationWarning.razor + SessionTimeoutModal.razor + Shared/OrganizationAuthorizeView.razor + ToastContainer.razor + Layout/ + MainLayout.razor + NavMenu.razor + Routes.razor + _Imports.razor +_Imports.razor diff --git a/4-Nine/Program.cs b/4-Nine/Program.cs index f0720f8..2609652 100644 --- a/4-Nine/Program.cs +++ b/4-Nine/Program.cs @@ -25,14 +25,22 @@ WebApplication app = null!; var builder = WebApplication.CreateBuilder(args); +// Declared before UseElectron so ElectronAppReady() can capture it. +int electronPort = 0; + // Configure Electron startup callback — called when Electron's socket bridge is ready. builder.WebHost.UseElectron(args, ElectronAppReady); // CRITICAL: Handle .restore_pending BEFORE any DbContext registration. HandlePendingRestore(builder.Configuration); -// Electron-only: always bind to the fixed port Electron expects -builder.WebHost.UseUrls("http://localhost:8888"); +// Electron-only: pick a free port at startup to avoid port conflicts. +if (HybridSupport.IsElectronActive) +{ + electronPort = GetFreePort(); + builder.WebHost.UseUrls($"http://localhost:{electronPort}"); + NetworkLockdown.RestrictHostsToLoopback(builder.Configuration); +} @@ -117,7 +125,6 @@ }; }); -builder.Services.AddScoped(); builder.Services.AddScoped(); // New refactored service builder.Services.AddScoped(); // New refactored service builder.Services.AddScoped(); // New refactored service @@ -143,14 +150,7 @@ // Add to service registration section builder.Services.AddScoped(); -// Phase 2.4: Notification Infrastructure -builder.Services.AddScoped(); -builder.Services.AddScoped(); - -// Phase 2.5: Email/SMS Integration -builder.Services.AddScoped(); -builder.Services.AddScoped(); -// SendGridEmailService and TwilioSMSService registered in extension methods +// Email/SMS not used in desktop app (available in Professional product via Infrastructure layer) // Workflow services builder.Services.AddScoped(); @@ -164,6 +164,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -172,9 +173,10 @@ builder.Services.AddScoped(sp => { var appName = "Nine-Electron"; + var loggerFactory = sp.GetRequiredService(); if (OperatingSystem.IsWindows()) - return new WindowsKeychainService(appName); - return new LinuxKeychainService(appName); + return new WindowsKeychainService(appName, loggerFactory.CreateLogger()); + return new LinuxKeychainService(appName, loggerFactory.CreateLogger()); }); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -695,6 +697,8 @@ return Results.Ok(new { success = true, timestamp = DateTime.UtcNow }); }).RequireAuthorization(); +NetworkLockdown.MapExternalLinkEndpoint(app); + // Create system service account for background jobs // Skip if database is locked using (var scope = app.Services.CreateScope()) @@ -754,8 +758,12 @@ async Task ElectronAppReady() // app is captured from the enclosing scope — guaranteed non-null by the time // this fires, since Electron's ready event arrives after StartAsync completes. - // Verify backend is responding before showing window - var backendUrl = "http://localhost:8888"; + // Resolve the URL Kestrel actually bound to — app.Urls is populated after + // StartAsync completes, so it's always accurate regardless of how the port + // was chosen (GetFreePort, launchSettings, ASPNETCORE_URLS, etc.). + var backendUrl = app.Urls.FirstOrDefault(u => u.StartsWith("http://localhost")) + ?? app.Urls.First(); + app.Logger.LogInformation("Electron backend URL resolved to: {Url}", backendUrl); var isBackendReady = false; try @@ -770,13 +778,19 @@ async Task ElectronAppReady() app.Logger.LogWarning(ex, "Backend health check failed, will show offline page"); } + // Packaged builds get their icon from electron-builder; in development the window would show + // Electron's default icon, so point it at the app icon copied next to the binaries. + var iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", + OperatingSystem.IsWindows() ? "icon.ico" : "icon.png"); + var window = await Electron.WindowManager.CreateWindowAsync(new ElectronNET.API.Entities.BrowserWindowOptions { - Width = 1400, - Height = 900, + Width = 1600, + Height = 1000, MinWidth = 800, MinHeight = 600, Show = false, + Icon = File.Exists(iconPath) ? iconPath : null, }); if (OperatingSystem.IsLinux() || OperatingSystem.IsWindows()) @@ -787,17 +801,19 @@ async Task ElectronAppReady() window.OnReadyToShow += () => window.Show(); window.SetTitle("Nine Property Management"); + await NetworkLockdown.ApplyAsync(window, backendUrl, app.Logger); + if (!isBackendReady) { app.Logger.LogWarning("Loading offline page due to backend unavailability"); window.LoadURL($"{backendUrl}/offline.html"); } - if (app.Environment.IsDevelopment()) - { - window.WebContents.OpenDevTools(); - app.Logger.LogInformation("DevTools opened for debugging"); - } + // if (app.Environment.IsDevelopment()) + // { + // window.WebContents.OpenDevTools(); + // app.Logger.LogInformation("DevTools opened for debugging"); + // } // Re-register DevTools shortcut because RemoveMenu() strips default accelerators Electron.GlobalShortcut.Register("CmdOrCtrl+Shift+I", () => @@ -813,6 +829,17 @@ async Task ElectronAppReady() }; } +// Picks a free local port by binding a TcpListener to port 0 (OS-assigned), +// reading the assigned port, then releasing the socket before Kestrel binds. +static int GetFreePort() +{ + var listener = new System.Net.Sockets.TcpListener(System.Net.IPAddress.Loopback, 0); + listener.Start(); + int port = ((System.Net.IPEndPoint)listener.LocalEndpoint).Port; + listener.Stop(); + return port; +} + // Local function to handle .restore_pending before service registration static void HandlePendingRestore(IConfiguration configuration) { diff --git a/4-Nine/Properties/PublishProfiles/linux-x64.pubxml b/4-Nine/Properties/PublishProfiles/linux-x64.pubxml index 3d9c845..18e00fa 100644 --- a/4-Nine/Properties/PublishProfiles/linux-x64.pubxml +++ b/4-Nine/Properties/PublishProfiles/linux-x64.pubxml @@ -5,7 +5,7 @@ Any CPU true FileSystem - publish/$(Configuration)/$(TargetFramework)/$(RuntimeIdentifier)/ + $(HOME)/Downloads/Nine/Publish/$(Configuration)/$(TargetFramework)/$(RuntimeIdentifier)/ FileSystem <_TargetId>Folder net10.0 diff --git a/4-Nine/Properties/PublishProfiles/win-x64.pubxml b/4-Nine/Properties/PublishProfiles/win-x64.pubxml index 7f4c485..6676ec4 100644 --- a/4-Nine/Properties/PublishProfiles/win-x64.pubxml +++ b/4-Nine/Properties/PublishProfiles/win-x64.pubxml @@ -5,7 +5,7 @@ Any CPU true FileSystem - publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + $(USERPROFILE)\Downloads\Nine\Publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ FileSystem <_TargetId>Folder net10.0 diff --git a/4-Nine/Properties/electron-builder.json b/4-Nine/Properties/electron-builder.json index 606366c..b1a4e87 100644 --- a/4-Nine/Properties/electron-builder.json +++ b/4-Nine/Properties/electron-builder.json @@ -2,7 +2,7 @@ "appId": "co.nineapp.nine", "productName": "Nine", "copyright": "Copyright © 2026", - "buildVersion": "1.0.0", + "buildVersion": "1.2.0", "compression": "normal", "files": ["**/*"], "mac": { @@ -46,7 +46,7 @@ }, "extraFiles": [ { - "from": "Assets/co.nineapp.nine.appdata.xml", + "from": "bin/Assets/co.nineapp.nine.appdata.xml", "to": "usr/share/metainfo/co.nineapp.nine.appdata.xml" } ] diff --git a/4-Nine/README.md b/4-Nine/README.md index 089899e..ab37814 100644 --- a/4-Nine/README.md +++ b/4-Nine/README.md @@ -1,4 +1,4 @@ -# Nine - Property Management System +# Nine. Property Management System ![.NET 10.0](https://img.shields.io/badge/.NET-10.0-blue) ![ASP.NET Core](https://img.shields.io/badge/ASP.NET%20Core-10.0-blueviolet) @@ -6,86 +6,80 @@ ![Entity Framework](https://img.shields.io/badge/Entity%20Framework-10.0-green) ![SQLite](https://img.shields.io/badge/Database-SQLite-lightblue) -A comprehensive web-based property management system built with ASP.NET Core 10.0 and Blazor Server. Nine streamlines rental property management for property owners and managers with an intuitive interface and robust feature set. +A comprehensive property management solution built with ASP.NET Core and Blazor Server. Nine streamlines rental property management for property owners and managers with an intuitive interface and robust feature set. -## 🏢 Overview +## Overview -Nine is designed to simplify property management operations through a centralized platform that handles everything from property, tenant, and lease tracking to document storage and rental invoice and expense tracking. Built with modern web technologies including AI (GitHub Copilot and Claude Sonnet), it provides a responsive, secure, and scalable solution for DIY landlords and property managers. +Nine. is designed to simplify property management operations through a centralized platform that handles everything from property, tenant, and lease tracking to document storage and rental invoice and expense tracking. Built with modern web technologies including AI (GitHub Copilot and Claude Sonnet), it provides a responsive, secure, and scalable solution for DIY landlords and property managers. -## ✨ Key Features +## Key Features -### 🏠 Property Management +### Property Management - **Property Portfolio** - Comprehensive property listings with detailed information - **Property Details** - Address, type, rent, bedrooms, bathrooms, square footage - **Availability Tracking** - Real-time property availability status -- **Property Photos** - Image management and gallery support -- **Search & Filter** - Advanced property search and filtering capabilities -- **Property Analytics** - Dashboard with property performance metrics +- **Property Analytics** - Dashboard with property performance metrics and reports -### 👥 Tenant Management +### Tenant Management -- **Tenant Profiles** - Complete tenant information management -- **Contact Management** - Phone, email, emergency contacts -- **Tenant History** - Track tenant interactions and lease history -- **Communication Tools** - Built-in messaging and notification system +- **Tenant Profiles** - Complete tenant information management with phone, email, emergency contacts +- **Communication Tools** - Automated in-app notifications on lease status and other events -### 📄 Lease Management +### Lease Management - **Lease Creation** - Digital lease agreement generation - **Lease Tracking** - Active, pending, expired, and terminated lease monitoring - **Rent Tracking** - Monthly rent amounts and payment schedules -- **Security Deposits** - Deposit tracking and management -- **Lease Renewals** - Manual lease renewal tracking -- **Terms Management** - Flexible lease terms and conditions +- **Security Deposits** - Security deposit tracking +- **Lease Renewals** - Lease renewals and conversions to month-to-month tenancy -### 💰 Financial Management +### Financial Management -- **Payment Tracking** - Rent payment monitoring and history -- **Invoice Generation** - Automated invoice creation and delivery -- **Payment Methods** - Multiple payment option support -- **Financial Reporting** - Revenue and expense reporting -- **Late Fee Management** - Automatic late fee calculation and tracking -- **Security Deposit Tracking** - Deposit handling and return processing +- **Payment Tracking** - Rent payment capture and generated PDF receipts. +- **Invoice Generation** - Create invoices and generated PDF files for print and email delivery +- **Payment Methods** - Record payments with multiple payment types +- **Financial Reporting** - Revenue and expense reporting, property performance reporting +- **Late Fee Management** - Automatic late fee calculation and invoice application -### 📁 Document Management +### Document Management -- **File Storage** - Secure document upload and storage -- **Document Categories** - Organized by type (leases, receipts, photos, etc.) +- **File Storage** - Document generation, upload and storage +- **Document Categories** - Organized by type (leases, receipts, inspections etc.) -### 🔐 User Management & Security +### User Management & Security -- **Role-Based Access** - Administrator and Property Manager roles +- **Role-Based Access** - Owner, Administrator and Property Manager roles - **Authentication** - Secure login with ASP.NET Core Identity -- **User Profiles** - Comprehensive user account management -- **Permission Management** - Granular access control -- **Activity Tracking** - User login and activity monitoring -- **Data Security** - Encrypted data storage and transmission +- **User Profiles** - Comprehensive user account management with role management and lockout capabilities +- **Permission Management** - Gated access control via role-based access +- **Data Security** - Encrypted data storage -### 🎛️ Administration Features +### Administration Features -- **User Administration** - Complete user account management +- **User Administration** - Create, lockout, and revoke access for user accounts - **System Configuration** - Application settings and preferences -- **Application Monitoring** - System health and performance tracking -- **Backup Management** - Data backup and recovery tools -- **Audit Logging** - Comprehensive activity and change tracking +- **Application Monitoring** - Database health checks at startup and on demand +- **Backup Management** - In-app data backup, recovery, and encryption features +- **Audit Logging** - Record creation and change tracking -## 🛠️ Technology Stack +--- + +## Technology Stack ### Backend -- **Backend**: ASP.NET Core 10.0 +- **Backend**: ASP.NET Core - **UI Framework**: Blazor Server -- **Database**: SQLite with Entity Framework Core 10.0 +- **Database**: SQLCipher (SQLite) with Entity Framework Core - **Authentication**: ASP.NET Core Identity -- **Architecture**: Clean Architecture with vertical slice organization ### Frontend - **UI Components**: Blazor Server Components - **Styling**: Bootstrap 5 with custom CSS - **Icons**: Bootstrap Icons -- **Responsive Design**: Mobile-first responsive layout +- **Responsive Design**: Responsive layout compatible with some mobile environments - **Real-time Updates**: Blazor Server SignalR integration ### Development Tools @@ -93,23 +87,37 @@ Nine is designed to simplify property management operations through a centralize - **IDE**: Visual Studio Code with C# extension - **Database Tools**: Entity Framework Core Tools - **Version Control**: Git with GitHub integration -- **Package Management**: NuGet +- **Package Management**: NuGet, libman - **Build System**: .NET SDK build system - **AI Assisted Coding**: GitHub Copilot, Claude Sonnet, GPT -## 📋 Prerequisites +### Distribution Channels + +- [GitHub Releases](https://github.com/xnodeoncode/Nine/releases) +- [AppImagePool](https://appimage.github.io/AppImagePool/) + +--- + +## Prerequisites - [.NET 10.0 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) +- [Node.js](https://nodejs.org/) (LTS) and npm, used once to download the Electron binary (see step 2) - [Git](https://git-scm.com/) - [Visual Studio Code](https://code.visualstudio.com/) (recommended) or Visual Studio 2022 - [C# Dev Kit Extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) for VS Code +- A graphical desktop session. Nine runs in an Electron window and cannot run headless. +- Development is supported on **Linux x64** and **Windows x64**. -## 🚀 Quick Start +**Optional tools:** [`dotnet-ef`](https://learn.microsoft.com/ef/core/cli/dotnet) (`dotnet tool install --global dotnet-ef`), only needed to change the database schema. + +--- + +## Quick Start ### 1. Clone the Repository ```bash -git clone https://github.com/xnodeoncode/nine.git +git clone https://github.com/xnodeoncode/Nine.git cd Nine ``` @@ -119,189 +127,75 @@ cd Nine dotnet build ``` -### 3. Run Database Migrations +**First build only:** if the build prints `[ElectronRestore] SETUP REQUIRED`, the Electron binary has not been downloaded yet. Run the following once, then build again: ```bash -cd 4-Nine -dotnet ef database update +cd 4-Nine/bin/Debug/net10.0/linux-x64/.electron # on Windows, use the matching win-x64 output folder +npm install +cd ../../../../../.. +dotnet build ``` -### 4. Start the Development Server +The exact folder is shown in the warning message. The downloaded Electron binary is cached in `~/.cache/electron` on Linux and `%LOCALAPPDATA%\electron\Cache` (`C:\Users\\AppData\Local\electron\Cache`) on Windows, so later builds reuse it. + +### 3. Start the Electron application ```bash +cd 4-Nine dotnet run ``` -### 5. Access the Application - -Open your browser and navigate to: - -- **HTTPS**: https://localhost:7244 -- **HTTP**: http://localhost:5244 +The database is created and migrated automatically on first run. -## 🔧 Development Setup +### 4. Access the Application -### Visual Studio Code Setup +The Electron splash screen, and then the application window, should load automatically. A new database opens to the home page, where you log in or register an account. The [Quick Start Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Quick-Start-Guide.md) walks through creating your first organization, property and lease. -The project includes pre-configured VS Code settings: +To start over with a clean database, close Nine and delete the database file (`~/.config/Nine/app_v1.2.0.db` on Linux, `%APPDATA%\Nine\app_v1.2.0.db` on Windows, which is `C:\Users\\AppData\Roaming\Nine`), or use **Reset Database** on the Manage Database page. -1. Open the workspace file: `Nine.code-workspace` -2. Install recommended extensions when prompted -3. Use **F5** to start debugging -4. Use **Ctrl+Shift+P** → "Tasks: Run Task" for build operations - -### Available Tasks - -- **build** - Debug build (default) -- **build-release** - Release build -- **watch** - Hot reload development -- **publish** - Production publish -- **clean** - Clean build artifacts - -### Database Management - -#### Manual Database Scripts - -SQL scripts for manual database operations are located in: +### 5. Testing ```bash -cd Infrastructure/Data/Scripts -# Available scripts: -# 00_InitialSchema.sql - Initial database schema -# updateTenant.sql - Tenant table updates +dotnet test Nine.sln ``` -#### Entity Framework Commands - -```bash -# Create new migration -dotnet ef migrations add [MigrationName] - -# Update database -dotnet ef database update - -# Remove last migration -dotnet ef migrations remove -``` +### Changing the database schema -## 📁 Project Structure +If you change an entity, you must add a migration, update the database, and regenerate the compiled model. Skipping the last step causes a runtime error. See **Schema Migrations & Model Optimization** in the [Database Management Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Database-Management-Guide.md) for the commands. -The application follows Clean Architecture principles with clear separation of concerns: +## Project Structure ``` -4-Nine/ -├── Core/ # Domain Layer (no dependencies) -│ ├── Entities/ # Domain models & business entities -│ │ ├── BaseModel.cs # Base entity with common properties -│ │ ├── Property.cs # Property entity -│ │ ├── Tenant.cs # Tenant entity -│ │ ├── Lease.cs # Lease entity -│ │ ├── SecurityDeposit.cs # Security deposit entity -│ │ └── ... # Other domain entities -│ └── Constants/ # Application constants -│ ├── ApplicationConstants.cs -│ └── ApplicationSettings.cs -│ -├── Infrastructure/ # Infrastructure Layer -│ ├── Data/ # Database & persistence -│ │ ├── ApplicationDbContext.cs # EF Core DbContext -│ │ ├── Migrations/ # EF Core migrations (44 files) -│ │ ├── Scripts/ # SQL scripts for manual operations -│ │ └── Backups/ # Database backups -│ └── Services/ # External service implementations -│ -├── Application/ # Application Layer (business logic) -│ └── Services/ # Domain services -│ ├── PropertyManagementService.cs -│ ├── SecurityDepositService.cs -│ ├── TenantConversionService.cs -│ ├── FinancialReportService.cs -│ ├── ChecklistService.cs -│ ├── CalendarEventService.cs -│ ├── NoteService.cs -│ └── PdfGenerators/ # PDF generation services -│ ├── LeasePdfGenerator.cs -│ ├── InvoicePdfGenerator.cs -│ ├── PaymentPdfGenerator.cs -│ └── ... -│ -├── Features/ # Presentation Layer (Vertical Slices) -│ ├── PropertyManagement/ # Property management features -│ │ ├── Properties/ # Property CRUD & management -│ │ ├── Tenants/ # Tenant management -│ │ ├── Leases/ # Lease management -│ │ ├── SecurityDeposits/ # Security deposit tracking -│ │ ├── Payments/ # Payment processing -│ │ ├── Invoices/ # Invoice management -│ │ ├── Documents/ # Document management -│ │ ├── Inspections/ # Property inspections -│ │ ├── MaintenanceRequests/ # Maintenance tracking -│ │ ├── Applications/ # Rental applications -│ │ ├── Checklists/ # Checklists & templates -│ │ ├── Reports/ # Financial & operational reports -│ │ └── Calendar.razor # Calendar view -│ └── Administration/ # Admin features -│ ├── Application/ # Application screening -│ ├── PropertyManagement/ # Property admin -│ ├── Settings/ # System settings -│ ├── Users/ # User management -│ └── Dashboard.razor -│ -├── Shared/ # Shared UI Layer -│ ├── Layout/ # Layout components -│ │ ├── MainLayout.razor -│ │ └── NavMenu.razor -│ ├── Components/ # Reusable UI components -│ │ ├── Account/ # Authentication components -│ │ ├── Pages/ # Shared pages (Home, About, Error) -│ │ ├── NotesTimeline.razor -│ │ ├── SessionTimeoutModal.razor -│ │ └── ToastContainer.razor -│ └── Services/ # UI-specific services -│ ├── ToastService.cs -│ ├── ThemeService.cs -│ ├── SessionTimeoutService.cs -│ ├── UserContextService.cs -│ └── DocumentService.cs -│ -├── Components/ # Root Blazor components -│ ├── App.razor # App root component -│ ├── Routes.razor # Routing configuration -│ └── _Imports.razor # Global using directives -│ -├── Utilities/ # Helper utilities -│ ├── CalendarEventRouter.cs -│ └── SchedulableEntityRegistry.cs -│ -├── wwwroot/ # Static files -│ ├── assets/ # Images & static assets -│ ├── js/ # JavaScript files -│ └── lib/ # Client libraries -│ -├── Program.cs # Application entry point -├── appsettings.json # Configuration -└── appsettings.Development.json # Development config +Nine/ +├── 0-Nine.Core/ # Domain entities and interfaces +├── 1-Nine.Infrastructure/ # Data access and external services +├── 2-Nine.Application/ # Business logic and services +├── 3-Nine.Shared.UI/ # Shared Blazor components +├── 4-Nine/ # Desktop application (Electron host) +└── 6-Tests/ # Unit and integration tests ``` ### Architecture Principles -**Clean Architecture Layers:** +**Layered Architecture:** + +Arrows mean "depends on". Every project can also use Core directly. ``` -Features → Application → Core - ↓ -Infrastructure → Core - ↓ -Shared → Core +4-Nine (Features, Shared, Electron host) + └─▶ 3-Nine.Shared.UI + └─▶ 2-Nine.Application + └─▶ 1-Nine.Infrastructure + └─▶ 0-Nine.Core ``` **Dependency Rules:** -- ✅ **Core** has NO dependencies (pure domain logic) -- ✅ **Infrastructure** depends only on Core (data access) -- ✅ **Application** depends only on Core (business logic) -- ✅ **Features** depends on Application + Core (UI features) -- ✅ **Shared** depends on Core (cross-cutting UI) +- **0-Nine.Core** has no dependencies (pure domain entities) +- **1-Nine.Infrastructure** depends on Core (data access) +- **2-Nine.Application** depends on Core and Infrastructure (business logic) +- **3-Nine.Shared.UI** depends on Application and Core (reusable UI components) +- **4-Nine** depends on Shared.UI, Application and Core (features, shared UI and the Electron host) **Benefits:** @@ -311,18 +205,25 @@ Shared → Core - **Scalability**: Simple to add new features as vertical slices - **Reusability**: Domain and application layers can be shared across projects -## 🔑 Default User Roles +## User Roles -The system includes two primary user roles: +The system includes three user roles: -### Administrator +### Owner (first account created, represents business owner) - Full system access - User management capabilities - System configuration - All property management features -### Property Manager +### Administrator (same as owner, serves as a backup/co-owner account) + +- Full system access +- User management capabilities +- System configuration +- All property management features + +### Property Manager (no access to application and organization management features) - Property portfolio management - Tenant management @@ -330,106 +231,58 @@ The system includes two primary user roles: - Financial tracking - Document management -## 🎯 Key Components - -### Property Management Service - -Core business logic service in the Application layer: - -- Property CRUD operations -- Tenant management workflows -- Lease tracking and renewals -- Document handling and storage -- Financial calculations -- Entity relationship management - -### Authentication & Authorization +## Application Limits -- ASP.NET Core Identity integration -- Role-based access control -- Secure session management -- Password policies -- Account lockout protection +Nine. is intentionally constrained for an optimal user experience: -### Database Architecture +| Items | Limit | Reason | +| ----------------- | ------------------------------ | ------------------------------------- | +| **Properties** | Maximum 9 | Focused workflows — it's our identity | +| **Users** | Maximum 4 (1 system + 3 login) | Simplified access control | +| **Organizations** | 1 | Desktop application scope | +| **File uploads** | 10 MB per file | Performance management | -- Entity Framework Core with SQLite -- Code-first approach with migrations -- Optimized indexing for performance -- Foreign key constraints -- Soft delete patterns +## Contributing -## 📊 Dashboard Features +`main` is reserved for releases and is maintained by the project owner. Do not branch from it or open pull requests against it. All contributions go through `development`. -### Property Manager Dashboard +1. **Fork** [xnodeoncode/Nine](https://github.com/xnodeoncode/Nine) on GitHub, clone your fork, and add the original repository as `upstream`: -- Total properties count -- Available properties metrics -- Active lease tracking -- Tenant statistics -- Recent activity feed -- Quick action buttons + ```bash + git clone https://github.com//Nine.git + cd Nine + git remote add upstream https://github.com/xnodeoncode/Nine.git + ``` -### Administrator Dashboard +2. **Start from an up-to-date `development`** and create a feature branch: -- User account metrics -- System health monitoring -- Application statistics -- Administrative quick actions -- Recent system activity + ```bash + git checkout development + git pull upstream development + git checkout -b feature/your-feature + ``` -## 🔧 Configuration +3. **Read [copilot-instructions.md](../.github/copilot-instructions.md)** before changing code. It describes the architecture, service patterns, organization isolation, soft delete, constants, dependency-injection registration and the database schema change process. +4. **Make your changes** and add tests for new functionality. +5. **Merge your feature branch into your fork's `development`, then build and test there.** Everything must pass before you submit: -### Application Settings + ```bash + git checkout development + git merge feature/your-feature + dotnet build Nine.sln + dotnet test Nine.sln + git push origin development + ``` -Configuration is managed through: +6. **Open a pull request** from your fork's `development` to `development` in `xnodeoncode/Nine`. -- `appsettings.json` - Base configuration -- `appsettings.Development.json` - Development overrides -- Environment variables -- User secrets (for sensitive data) +**Branch flow:** -### Key Configuration Areas - -- Database connection strings -- Authentication settings -- File storage configuration -- Email service settings -- Application-specific settings - -## 🚀 Deployment - -### Prerequisites for Production - -- Windows/Linux server with .NET 10.0 runtime -- IIS or reverse proxy (nginx/Apache) -- SSL certificate for HTTPS -- Database server (or SQLite for smaller deployments) - -### Build for Production - -```bash -dotnet publish -c Release -o ./publish ``` - -### Environment Variables - -Set the following for production: - -```bash -ASPNETCORE_ENVIRONMENT=Production -ASPNETCORE_URLS=https://+:443;http://+:80 -ConnectionStrings__DefaultConnection=[your-connection-string] +feature/your-feature ──merge──▶ your fork: development ──pull request──▶ xnodeoncode/Nine: development + (build and test here) ``` -## 🤝 Contributing - -1. Fork the repository -2. Create a feature branch (`git checkout -b feature/amazing-feature`) -3. Commit your changes (`git commit -m 'Add amazing feature'`) -4. Push to the branch (`git push origin feature/amazing-feature`) -5. Open a Pull Request - ### Development Guidelines - Follow C# coding conventions @@ -438,54 +291,60 @@ ConnectionStrings__DefaultConnection=[your-connection-string] - Add unit tests for new functionality - Ensure responsive design compatibility -## 📄 License +**Build and run:** + +```bash +dotnet build Nine.sln -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. +cd 4-Nine && dotnet watch +``` -## 🆘 Support +**Linux note:** `dotnet watch` may fail with `The configured user limit (128) on the number of inotify instances has been reached`. This is the default on some distros. Raise the limit and run it again: -### Documentation +```bash +sudo sysctl fs.inotify.max_user_instances=512 +``` -- Check the `REVISIONS.md` file for recent changes -- Review component-specific README files in subdirectories -- Refer to ASP.NET Core and Blazor documentation +This lasts until the next reboot. To make it permanent, add `fs.inotify.max_user_instances=512` to a file in `/etc/sysctl.d/`. See [inotify(7)](https://man7.org/linux/man-pages/man7/inotify.7.html) for what these limits control. -### Common Issues +## Versioning -1. **Database Connection Issues**: Verify SQLite file permissions and path -2. **Build Errors**: Ensure .NET 10.0 SDK is installed -3. **Authentication Problems**: Check Identity configuration and user roles -4. **Performance Issues**: Review database indexing and query optimization +[Semantic Versioning](https://semver.org/): -### Getting Help +- **MAJOR** = breaking/schema changes +- **MINOR** = new features +- **PATCH** = bug fixes -- Create an issue on GitHub for bugs -- Check existing issues for known problems -- Review the project documentation -- Contact the development team +**Current version:** 1.2.0 · **Database schema:** 1.2.0 -## 🏗️ Roadmap +## License -### Upcoming Features via Nine Professional +Copyright © 2026 CIS Guru. Licensed under the **MIT License** — see [LICENSE](https://github.com/xnodeoncode/Nine/blob/main/LICENSE) for details. -- Mobile application support -- Advanced reporting and analytics -- Integration with accounting software -- Automated rent collection -- Multi-language support -- IoT device integration -- API for third-party integrations +### Third-Party Licenses -### Performance Improvements +Nine. includes third-party components that are licensed separately. The full list, with the license text for each +component, is in [Documentation/Third-Party-Licensing-Notices.md](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Third-Party-Licensing-Notices.md), and the +license texts are also installed with the application (see the About page, "Third-Party Licenses"). -- Database optimization -- Caching implementation -- Background job processing -- File storage optimization -- Search performance enhancements +**QuestPDF (PDF generation).** Nine. uses [QuestPDF](https://www.questpdf.com) to generate its PDF documents (leases, +invoices, receipts, inspections, checklists and reports). QuestPDF is not covered by Nine's MIT license and has its own +[license terms](https://www.questpdf.com/license/community.html). In summary, QuestPDF is free for organizations and +individuals with annual gross revenue under USD 1,000,000, for charitable and qualifying academic organizations, and for +open-source projects. Government and public-sector organizations and publicly traded companies require a paid QuestPDF +license. ---- +**You are responsible for confirming that you are eligible to use QuestPDF before installing or operating Nine.** If you +are not eligible, obtain a license from QuestPDF or do not use Nine. This notice is informational and is not legal advice. + +## Support + +- **Website:** [nineapp.co](https://nineapp.co/) +- **Documentation:** [project documentation](https://github.com/xnodeoncode/Nine/tree/main/Documentation) and the [release notes](https://github.com/xnodeoncode/Nine/releases) +- **Bug Reports:** [GitHub Issues](https://github.com/xnodeoncode/Nine/issues) +- **Feature Requests:** [GitHub Discussions](https://github.com/xnodeoncode/Nine/discussions) +- **Other Questions:** [cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20README) (private) -**Nine** - Streamlining Property Management for the Modern World +## **Start with Nine.** -Built with ❤️ using ASP.NET Core 10.0, Blazor Server, and AI Tools (GitHub Copilot and Claude Sonnet) +Built with using ASP.NET Core 10.0, Blazor Server, and AI Tools (GitHub Copilot and Claude Sonnet) diff --git a/4-Nine/Services/WebPathService.cs b/4-Nine/Services/WebPathService.cs index 98658a3..9a945d3 100644 --- a/4-Nine/Services/WebPathService.cs +++ b/4-Nine/Services/WebPathService.cs @@ -40,7 +40,7 @@ public async Task GetDatabasePathAsync() if (string.IsNullOrEmpty(dbPath)) { - dbPath = "aquiis.db"; // Default + dbPath = "nine.db"; // Default } // Make absolute path if relative diff --git a/4-Nine/Shared/App.razor b/4-Nine/Shared/App.razor index c029ceb..555b7fc 100644 --- a/4-Nine/Shared/App.razor +++ b/4-Nine/Shared/App.razor @@ -5,7 +5,7 @@ - + @@ -21,6 +21,7 @@ + diff --git a/4-Nine/Shared/Components/Account/Pages/Login.razor b/4-Nine/Shared/Components/Account/Pages/Login.razor index b1a891e..3b3c54f 100644 --- a/4-Nine/Shared/Components/Account/Pages/Login.razor +++ b/4-Nine/Shared/Components/Account/Pages/Login.razor @@ -3,9 +3,12 @@ @using System.ComponentModel.DataAnnotations @using Microsoft.AspNetCore.Authentication @using Microsoft.AspNetCore.Identity +@using Microsoft.EntityFrameworkCore +@using Nine.Core.Constants @using ElectronNET.API @inject SignInManager SignInManager +@inject UserManager UserManager @inject ILogger Logger @inject NavigationManager NavigationManager @inject IdentityRedirectManager RedirectManager @@ -67,9 +70,12 @@

    Forgot your password?

    -

    - { ["ReturnUrl"] = ReturnUrl }))">Register as a new user -

    + @if (_showRegistrationLink) + { +

    + { ["ReturnUrl"] = ReturnUrl }))">Register as a new user +

    + } @*

    Resend email confirmation

    *@ @@ -89,6 +95,7 @@ @code { private string? errorMessage; private bool isSubmitting = false; + private bool _showRegistrationLink = false; [CascadingParameter] private HttpContext HttpContext { get; set; } = default!; @@ -103,6 +110,11 @@ { Input ??= new InputModel(); + // Show registration link only when no non-system user exists yet + var hasUsers = await UserManager.Users + .AnyAsync(u => u.Id != ApplicationConstants.SystemUser.Id); + _showRegistrationLink = !hasUsers; + // For Electron, default Remember Me to true (trusted device) if (HybridSupport.IsElectronActive) { diff --git a/4-Nine/Shared/Components/Pages/About.razor b/4-Nine/Shared/Components/Pages/About.razor index 7632fc0..0c0881d 100644 --- a/4-Nine/Shared/Components/Pages/About.razor +++ b/4-Nine/Shared/Components/Pages/About.razor @@ -1,21 +1,116 @@ @page "/about" +@inject ThemeService ThemeService +@inject ApplicationService ApplicationService +@attribute [AllowAnonymous] +@rendermode InteractiveServer +@implements IDisposable
    -

    Property Management System

    -

    Manage your rental properties, tenants, leases, and payments with ease.

    +
    +

    Nine.

    +
    +
    + + version @ApplicationService.ApplicationSettings.Version + + + license MIT + + .NET @Environment.Version.Major.@Environment.Version.Minor + platform Linux | Windows + + website nineapp.co + +
    + +
    +
    +
    What is Nine?
    +

    + Nine is a free, open-source desktop application designed to help real estate investors, property managers, and landlords manage up to nine residential rental properties with ease. +

    +
    +
    +
    Nine is perfect for:
    +
      +
    • Independent property managers and landlords
    • +
    • Property owners who self-manage their rentals
    • +
    • New real estate investors building their portfolio
    • +
    • Anyone seeking focused, no-subscription property management software
    • +
    +

    - - -

    Welcome back! Access your dashboard to manage your properties.

    -
    - -

    Sign in to access your dashboard and manage your properties.

    -
    - Sign In - Create Account +
    +
    Third-Party Licenses
    +

    + Nine is released under the MIT License (view). + It includes third-party software that is licensed separately, including QuestPDF, SQLCipher, + Electron and Bootstrap. + The complete list, with the license text for each component, is on the + third-party licenses page + (stored with the application; no internet connection is needed). +

    +
    PDF generation (QuestPDF)
    +

    + Nine uses QuestPDF to generate its documents. QuestPDF is free for organizations and individuals with + annual gross revenue under USD 1,000,000, for charitable and qualifying academic organizations, and for + open-source projects. Government and public-sector organizations and publicly traded companies require a + paid QuestPDF license. + QuestPDF license text. + Current terms: questpdf.com/license/community.html + (opens in your default browser). +

    +

    + You are responsible for confirming that you are eligible to use QuestPDF. + This notice is informational and is not legal advice. +

    +
    + +
    + + - -
    -
    \ No newline at end of file +
    + +@code { + // Release notes for the installed version (tag vX.Y.Z); opens in the default browser. + private string ReleaseNotesUrl + { + get + { + var repo = string.IsNullOrWhiteSpace(ApplicationService.ApplicationSettings.Repository) + ? "https://github.com/xnodeoncode/Nine" + : ApplicationService.ApplicationSettings.Repository.TrimEnd('/'); + return $"{repo}/releases/tag/v{ApplicationService.ApplicationSettings.Version}"; + } + } + + // Obsidian always uses the inverted logo. Bootstrap and Teal use inverted in dark mode only. + private string LogoSrc => (ThemeService.CurrentTheme == "dark") + ? "/assets/nine-logo-inverted.svg" + : "/assets/nine-logo.svg"; + + protected override void OnInitialized() + { + ThemeService.OnThemeChanged += OnThemeChanged; + ThemeService.OnBrandThemeChanged += OnThemeChanged; + } + + private void OnThemeChanged() + { + InvokeAsync(StateHasChanged); + } + + public void Dispose() + { + ThemeService.OnThemeChanged -= OnThemeChanged; + ThemeService.OnBrandThemeChanged -= OnThemeChanged; + } +} \ No newline at end of file diff --git a/4-Nine/Shared/Components/Pages/Home.razor b/4-Nine/Shared/Components/Pages/Home.razor index 38a73a0..fa101be 100644 --- a/4-Nine/Shared/Components/Pages/Home.razor +++ b/4-Nine/Shared/Components/Pages/Home.razor @@ -1,4 +1,6 @@ @page "/" +@using Microsoft.AspNetCore.Identity +@using Nine.Core.Constants @using Nine.Application.Services @using Nine.Shared.UI.Components.Entities.Invoices @using Nine.Shared.UI.Components.Entities.Properties @@ -21,6 +23,7 @@ @inject InvoiceService InvoiceService @inject UserContextService UserContextService @inject ApplicationDbContext DbContext +@inject UserManager UserManager @rendermode InteractiveServer @@ -28,7 +31,7 @@ - +
    @@ -88,7 +91,10 @@

    Sign in to access your dashboard and manage your properties.

    Sign In - Create Account + @if (_showRegistrationLink) + { + Create Account + }
    @@ -129,6 +135,7 @@ @code { private bool isLoading = true; + private bool _showRegistrationLink = false; private int totalProperties = 0; private int availableProperties = 0; private int totalTenants = 0; @@ -155,6 +162,9 @@ protected override async Task OnInitializedAsync() { + var hasUsers = await UserManager.Users + .AnyAsync(u => u.Id != ApplicationConstants.SystemUser.Id); + _showRegistrationLink = !hasUsers; var authState = await AuthenticationStateTask; if (authState.User.Identity?.IsAuthenticated == true) { @@ -183,7 +193,7 @@ var allProperties = await PropertyService.GetAllAsync(); properties = allProperties.Where(p => !p.IsDeleted).ToList(); totalProperties = properties.Count; - availableProperties = properties.Count(p => p.IsActive); + availableProperties = properties.Count(p => p.Status == ApplicationConstants.PropertyStatuses.Available); var allTenants = await TenantService.GetAllAsync(); tenants = allTenants.Where(t => !t.IsDeleted).ToList(); @@ -191,13 +201,13 @@ var allLeases = await LeaseService.GetAllAsync(); leases = allLeases.Where(l => !l.IsDeleted).ToList(); - activeLeases = leases.Count(l => l.Status == "Active"); + activeLeases = leases.Count(l => l.IsActive); // Load available properties and pending leases availablePropertiesList = properties - .Where(p => p.OrganizationId == organizationId && p.IsActive) + .Where(p => p.OrganizationId == organizationId && p.Status == ApplicationConstants.PropertyStatuses.Available) .OrderByDescending(p => p.CreatedOn) - .Take(5) + .Take(20) .ToList(); // Load outstanding repairs (incomplete only - CompletedOn is null) @@ -211,7 +221,7 @@ // Load outstanding invoices (unpaid and overdue only) var allInvoices = await InvoiceService.GetAllAsync(); recentInvoices = allInvoices - .Where(i => i.Status != "Paid" && i.Status != "Cancelled") + .Where(i => i.Status != ApplicationConstants.InvoiceStatuses.Paid && i.Status != ApplicationConstants.InvoiceStatuses.Cancelled) .OrderByDescending(i => i.IsOverdue) .ThenBy(i => i.DueOn) .Take(5) @@ -226,7 +236,7 @@ occupancyRate = await PropertyService.CalculatePortfolioOccupancyRateAsync(); totalMonthlyIncome = leases - .Where(l => !l.IsDeleted && l.Status == ApplicationConstants.LeaseStatuses.Active) + .Where(l => !l.IsDeleted && l.IsActive) .Sum(l => l.MonthlyRent); totalRevenueOpportunity = properties .Where(p => !p.IsDeleted) @@ -293,10 +303,10 @@ { return status switch { - "Paid" => "bg-success", - "Pending" => "bg-warning", - "Overdue" => "bg-danger", - "Cancelled" => "bg-secondary", + ApplicationConstants.InvoiceStatuses.Paid => "bg-success", + ApplicationConstants.InvoiceStatuses.Pending => "bg-warning", + ApplicationConstants.InvoiceStatuses.Overdue => "bg-danger", + ApplicationConstants.InvoiceStatuses.Cancelled => "bg-secondary", _ => "bg-info" }; } @@ -305,12 +315,12 @@ { return status switch { - "Available" => "bg-success", - "ApplicationPending" => "bg-info", - "LeasePending" => "bg-warning", - "Occupied" => "bg-danger", - "UnderRenovation" => "bg-secondary", - "OffMarket" => "bg-dark", + ApplicationConstants.PropertyStatuses.Available => "bg-success", + ApplicationConstants.PropertyStatuses.ApplicationPending => "bg-info", + ApplicationConstants.PropertyStatuses.LeasePending => "bg-warning", + ApplicationConstants.PropertyStatuses.Occupied => "bg-danger", + ApplicationConstants.PropertyStatuses.UnderRenovation => "bg-secondary", + ApplicationConstants.PropertyStatuses.OffMarket => "bg-dark", _ => "bg-secondary" }; } @@ -319,10 +329,10 @@ { return status switch { - "ApplicationPending" => "Application Pending", - "LeasePending" => "Lease Pending", - "UnderRenovation" => "Under Renovation", - "OffMarket" => "Off Market", + ApplicationConstants.PropertyStatuses.ApplicationPending => "Application Pending", + ApplicationConstants.PropertyStatuses.LeasePending => "Lease Pending", + ApplicationConstants.PropertyStatuses.UnderRenovation => "Under Renovation", + ApplicationConstants.PropertyStatuses.OffMarket => "Off Market", _ => status }; } diff --git a/4-Nine/Shared/Components/SchemaValidationWarning.razor b/4-Nine/Shared/Components/SchemaValidationWarning.razor index 0061f75..b61b00c 100644 --- a/4-Nine/Shared/Components/SchemaValidationWarning.razor +++ b/4-Nine/Shared/Components/SchemaValidationWarning.razor @@ -2,6 +2,7 @@ @using Nine.Shared.Services @using Nine.Application.Services.PdfGenerators @inject SchemaValidationService SchemaService +@inject ApplicationService ApplicationService @inject NavigationManager Navigation @rendermode InteractiveServer @@ -33,14 +34,14 @@ } @code { - [Parameter] - public string ExpectedVersion { get; set; } = "1.0.0"; - private bool isValid = true; private bool showWarning = true; private string validationMessage = string.Empty; private string? databaseVersion; - private string expectedVersion = "1.0.0"; + + // The version this release expects, read from application settings so it always matches + // what SchemaValidationService compares against. + private string expectedVersion => ApplicationService.ApplicationSettings.SchemaVersion; protected override async Task OnInitializedAsync() { @@ -55,7 +56,6 @@ isValid = valid; validationMessage = message; databaseVersion = dbVersion; - expectedVersion = ExpectedVersion; } catch (Exception ex) { diff --git a/4-Nine/Shared/Layout/MainLayout.razor b/4-Nine/Shared/Layout/MainLayout.razor index 60f99db..792fa62 100644 --- a/4-Nine/Shared/Layout/MainLayout.razor +++ b/4-Nine/Shared/Layout/MainLayout.razor @@ -11,7 +11,7 @@ - About + About diff --git a/4-Nine/Shared/Layout/NavMenu.razor b/4-Nine/Shared/Layout/NavMenu.razor index ae4cdf0..09ab29c 100644 --- a/4-Nine/Shared/Layout/NavMenu.razor +++ b/4-Nine/Shared/Layout/NavMenu.razor @@ -1,9 +1,13 @@ @implements IDisposable +@using Microsoft.AspNetCore.Identity +@using Microsoft.EntityFrameworkCore +@using Nine.Core.Constants @inject NavigationManager NavigationManager @inject UserContextService UserContext @inject ThemeService ThemeService @inject IJSRuntime JSRuntime +@inject UserManager UserManager + + + + - + @if (_showRegistrationLink) + { + + }
    -public class NotificationBellTests : TestContext +public class NotificationBellTests : BunitContext { [Fact] public void NotificationBell_Component_Exists_And_Can_Be_Instantiated() @@ -19,8 +18,8 @@ public void NotificationBell_Component_Exists_And_Can_Be_Instantiated() // For now, we're just verifying the component exists and can be imported // Assert - typeof(NotificationBell).Should().NotBeNull(); - typeof(NotificationBell).Name.Should().Be("NotificationBell"); + Assert.NotNull(typeof(NotificationBell)); + Assert.Equal("NotificationBell", typeof(NotificationBell).Name); } // Additional tests to be added when NotificationService is implemented: diff --git a/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationCenterTests.cs b/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationCenterTests.cs index 963d4b2..d737f77 100644 --- a/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationCenterTests.cs +++ b/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationCenterTests.cs @@ -1,6 +1,5 @@ using Nine.Shared.UI.Components.Notifications; using Bunit; -using FluentAssertions; using Xunit; namespace Nine.Shared.UI.Tests.Features.Notifications; @@ -9,7 +8,7 @@ namespace Nine.Shared.UI.Tests.Features.Notifications; /// Basic structure tests for NotificationCenter component. /// Full functional testing requires NotificationService implementation. ///
    -public class NotificationCenterTests : TestContext +public class NotificationCenterTests : BunitContext { [Fact] public void NotificationCenter_Component_Exists_And_Can_Be_Instantiated() @@ -19,8 +18,8 @@ public void NotificationCenter_Component_Exists_And_Can_Be_Instantiated() // For now, we're just verifying the component exists and can be imported // Assert - typeof(NotificationCenter).Should().NotBeNull(); - typeof(NotificationCenter).Name.Should().Be("NotificationCenter"); + Assert.NotNull(typeof(NotificationCenter)); + Assert.Equal("NotificationCenter", typeof(NotificationCenter).Name); } // Additional tests to be added when NotificationService is implemented: diff --git a/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationPreferencesTests.cs b/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationPreferencesTests.cs index b1cb2c4..616eb9a 100644 --- a/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationPreferencesTests.cs +++ b/6-Tests/Nine.Shared.UI.Tests/Features/Notifications/NotificationPreferencesTests.cs @@ -1,6 +1,5 @@ using Nine.Shared.UI.Components.Notifications; using Bunit; -using FluentAssertions; using Xunit; namespace Nine.Shared.UI.Tests.Features.Notifications; @@ -9,7 +8,7 @@ namespace Nine.Shared.UI.Tests.Features.Notifications; /// Basic structure tests for NotificationPreferences component. /// Full functional testing requires NotificationService and UserContextService implementation. ///
    -public class NotificationPreferencesTests : TestContext +public class NotificationPreferencesTests : BunitContext { [Fact] public void NotificationPreferences_Component_Exists_And_Can_Be_Instantiated() @@ -19,8 +18,8 @@ public void NotificationPreferences_Component_Exists_And_Can_Be_Instantiated() // For now, we're just verifying the component exists and can be imported // Assert - typeof(NotificationPreferences).Should().NotBeNull(); - typeof(NotificationPreferences).Name.Should().Be("NotificationPreferences"); + Assert.NotNull(typeof(NotificationPreferences)); + Assert.Equal("NotificationPreferences", typeof(NotificationPreferences).Name); } // Additional tests to be added when services are implemented: diff --git a/6-Tests/Nine.Shared.UI.Tests/GlobalUsings.cs b/6-Tests/Nine.Shared.UI.Tests/GlobalUsings.cs index 604551f..c868a86 100644 --- a/6-Tests/Nine.Shared.UI.Tests/GlobalUsings.cs +++ b/6-Tests/Nine.Shared.UI.Tests/GlobalUsings.cs @@ -1,6 +1,5 @@ global using Xunit; global using Bunit; -global using FluentAssertions; global using Microsoft.AspNetCore.Components; // Suppress bUnit migration warnings since we're using TestContext and RenderComponent diff --git a/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj b/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj index 48b44b7..81477e3 100644 --- a/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj +++ b/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj @@ -5,13 +5,12 @@ enable enable false - $(NoWarn);CS0618;CS0619 - + + - diff --git a/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj.lscache b/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj.lscache new file mode 100644 index 0000000..1ddb150 --- /dev/null +++ b/6-Tests/Nine.Shared.UI.Tests/Nine.Shared.UI.Tests.csproj.lscache @@ -0,0 +1,467 @@ +version=1 + +# This file caches language service data to improve the performance of C# Dev Kit. +# It is not intended for manual editing. It can safely be deleted and will be +# regenerated automatically. For more information, see https://aka.ms/lscache +# +# To control where cache files are stored, use the following VS Code setting: +# "dotnet.projectsystem.cacheInProjectFolder": true + +[project] +language=C# +primary +lastDtbSucceeded + +[properties] +AssemblyName=Nine.Shared.UI.Tests +CommandLineArgsForDesignTimeEvaluation=-langversion:14.0 -define:TRACE +CompilerGeneratedFilesOutputPath= +MaxSupportedLangVersion=14.0 +ProjectAssetsFile=obj/project.assets.json +RootNamespace=Nine.Shared.UI.Tests +RunAnalyzers= +RunAnalyzersDuringLiveAnalysis= +SolutionPath=../../Nine.sln +TargetFrameworkIdentifier=.NETCoreApp +TargetPath=bin/Debug/net10.0/Nine.Shared.UI.Tests.dll +TargetRefPath=obj/Debug/net10.0/ref/Nine.Shared.UI.Tests.dll +TemporaryDependencyNodeTargetIdentifier=net10.0 + +[commandLineArguments] +/noconfig +/unsafe- +/checked- +/nowarn:1701,1702,CS0618,CS0619,1701,1702 +/fullpaths +/nostdlib+ +/errorreport:prompt +/warn:10 +/define:TRACE;DEBUG;NET;NET10_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NET8_0_OR_GREATER;NET9_0_OR_GREATER;NET10_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER +/highentropyva+ +/nullable:enable +/features:"InterceptorsNamespaces=;Microsoft.Extensions.Validation.Generated" +/debug+ +/debug:portable +/filealign:512 +/optimize- +/out:obj/Debug/net10.0/Nine.Shared.UI.Tests.dll +/refout:obj/Debug/net10.0/refint/Nine.Shared.UI.Tests.dll +/target:exe +/warnaserror- +/utf8output +/deterministic+ +/langversion:14.0 +/warnaserror+:NU1605,SYSLIB0011 + +[sourceFiles] +/microsoft.net.test.sdk/17.14.1/build/net8.0/Microsoft.NET.Test.Sdk.Program.cs + @folderNames=..,..,..,..,.nuget,packages,microsoft.net.test.sdk,17.14.1,build,net8.0 +Components/Common/ + CardTests.cs + DataTableTests.cs + FormFieldTests.cs + ModalTests.cs +Components/Layout/SharedMainLayoutTests.cs +Features/Notifications/ + NotificationBellTests.cs + NotificationCenterTests.cs + NotificationPreferencesTests.cs +GlobalUsings.cs +obj/Debug/net10.0/ + .NETCoreApp,Version=v10.0.AssemblyAttributes.cs + Nine.Shared.UI.Tests.AssemblyInfo.cs + Nine.Shared.UI.Tests.GlobalUsings.g.cs + +[metadataReferences] +../../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.AspNetCore.Antiforgery.dll + Microsoft.AspNetCore.Authentication.Abstractions.dll + Microsoft.AspNetCore.Authentication.BearerToken.dll + Microsoft.AspNetCore.Authentication.Cookies.dll + Microsoft.AspNetCore.Authentication.Core.dll + Microsoft.AspNetCore.Authentication.dll + Microsoft.AspNetCore.Authentication.OAuth.dll + Microsoft.AspNetCore.Authorization.dll + Microsoft.AspNetCore.Authorization.Policy.dll + Microsoft.AspNetCore.Components.Authorization.dll + Microsoft.AspNetCore.Components.dll + Microsoft.AspNetCore.Components.Endpoints.dll + Microsoft.AspNetCore.Components.Forms.dll + Microsoft.AspNetCore.Components.Server.dll + Microsoft.AspNetCore.Components.Web.dll + Microsoft.AspNetCore.Connections.Abstractions.dll + Microsoft.AspNetCore.CookiePolicy.dll + Microsoft.AspNetCore.Cors.dll + Microsoft.AspNetCore.Cryptography.Internal.dll + Microsoft.AspNetCore.Cryptography.KeyDerivation.dll + Microsoft.AspNetCore.DataProtection.Abstractions.dll + Microsoft.AspNetCore.DataProtection.dll + Microsoft.AspNetCore.DataProtection.Extensions.dll + Microsoft.AspNetCore.Diagnostics.Abstractions.dll + Microsoft.AspNetCore.Diagnostics.dll + Microsoft.AspNetCore.Diagnostics.HealthChecks.dll + Microsoft.AspNetCore.dll + Microsoft.AspNetCore.HostFiltering.dll + Microsoft.AspNetCore.Hosting.Abstractions.dll + Microsoft.AspNetCore.Hosting.dll + Microsoft.AspNetCore.Hosting.Server.Abstractions.dll + Microsoft.AspNetCore.Html.Abstractions.dll + Microsoft.AspNetCore.Http.Abstractions.dll + Microsoft.AspNetCore.Http.Connections.Common.dll + Microsoft.AspNetCore.Http.Connections.dll + Microsoft.AspNetCore.Http.dll + Microsoft.AspNetCore.Http.Extensions.dll + Microsoft.AspNetCore.Http.Features.dll + Microsoft.AspNetCore.Http.Results.dll + Microsoft.AspNetCore.HttpLogging.dll + Microsoft.AspNetCore.HttpOverrides.dll + Microsoft.AspNetCore.HttpsPolicy.dll + Microsoft.AspNetCore.Identity.dll + Microsoft.AspNetCore.Localization.dll + Microsoft.AspNetCore.Localization.Routing.dll + Microsoft.AspNetCore.Metadata.dll + Microsoft.AspNetCore.Mvc.Abstractions.dll + Microsoft.AspNetCore.Mvc.ApiExplorer.dll + Microsoft.AspNetCore.Mvc.Core.dll + Microsoft.AspNetCore.Mvc.Cors.dll + Microsoft.AspNetCore.Mvc.DataAnnotations.dll + Microsoft.AspNetCore.Mvc.dll + Microsoft.AspNetCore.Mvc.Formatters.Json.dll + Microsoft.AspNetCore.Mvc.Formatters.Xml.dll + Microsoft.AspNetCore.Mvc.Localization.dll + Microsoft.AspNetCore.Mvc.Razor.dll + Microsoft.AspNetCore.Mvc.RazorPages.dll + Microsoft.AspNetCore.Mvc.TagHelpers.dll + Microsoft.AspNetCore.Mvc.ViewFeatures.dll + Microsoft.AspNetCore.OutputCaching.dll + Microsoft.AspNetCore.RateLimiting.dll + Microsoft.AspNetCore.Razor.dll + Microsoft.AspNetCore.Razor.Runtime.dll + Microsoft.AspNetCore.RequestDecompression.dll + Microsoft.AspNetCore.ResponseCaching.Abstractions.dll + Microsoft.AspNetCore.ResponseCaching.dll + Microsoft.AspNetCore.ResponseCompression.dll + Microsoft.AspNetCore.Rewrite.dll + Microsoft.AspNetCore.Routing.Abstractions.dll + Microsoft.AspNetCore.Routing.dll + Microsoft.AspNetCore.Server.HttpSys.dll + Microsoft.AspNetCore.Server.IIS.dll + Microsoft.AspNetCore.Server.IISIntegration.dll + Microsoft.AspNetCore.Server.Kestrel.Core.dll + Microsoft.AspNetCore.Server.Kestrel.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.dll + Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll + Microsoft.AspNetCore.Session.dll + Microsoft.AspNetCore.SignalR.Common.dll + Microsoft.AspNetCore.SignalR.Core.dll + Microsoft.AspNetCore.SignalR.dll + Microsoft.AspNetCore.SignalR.Protocols.Json.dll + Microsoft.AspNetCore.StaticAssets.dll + Microsoft.AspNetCore.StaticFiles.dll + Microsoft.AspNetCore.WebSockets.dll + Microsoft.AspNetCore.WebUtilities.dll + Microsoft.Extensions.Caching.Abstractions.dll + Microsoft.Extensions.Caching.Memory.dll + Microsoft.Extensions.Configuration.Abstractions.dll + Microsoft.Extensions.Configuration.Binder.dll + Microsoft.Extensions.Configuration.CommandLine.dll + Microsoft.Extensions.Configuration.dll + Microsoft.Extensions.Configuration.EnvironmentVariables.dll + Microsoft.Extensions.Configuration.FileExtensions.dll + Microsoft.Extensions.Configuration.Ini.dll + Microsoft.Extensions.Configuration.Json.dll + Microsoft.Extensions.Configuration.KeyPerFile.dll + Microsoft.Extensions.Configuration.UserSecrets.dll + Microsoft.Extensions.Configuration.Xml.dll + Microsoft.Extensions.DependencyInjection.Abstractions.dll + Microsoft.Extensions.DependencyInjection.dll + Microsoft.Extensions.Diagnostics.Abstractions.dll + Microsoft.Extensions.Diagnostics.dll + Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.dll + Microsoft.Extensions.Diagnostics.HealthChecks.dll + Microsoft.Extensions.Features.dll + Microsoft.Extensions.FileProviders.Abstractions.dll + Microsoft.Extensions.FileProviders.Composite.dll + Microsoft.Extensions.FileProviders.Embedded.dll + Microsoft.Extensions.FileProviders.Physical.dll + Microsoft.Extensions.FileSystemGlobbing.dll + Microsoft.Extensions.Hosting.Abstractions.dll + Microsoft.Extensions.Hosting.dll + Microsoft.Extensions.Http.dll + Microsoft.Extensions.Identity.Core.dll + Microsoft.Extensions.Identity.Stores.dll + Microsoft.Extensions.Localization.Abstractions.dll + Microsoft.Extensions.Localization.dll + Microsoft.Extensions.Logging.Abstractions.dll + Microsoft.Extensions.Logging.Configuration.dll + Microsoft.Extensions.Logging.Console.dll + Microsoft.Extensions.Logging.Debug.dll + Microsoft.Extensions.Logging.dll + Microsoft.Extensions.Logging.EventLog.dll + Microsoft.Extensions.Logging.EventSource.dll + Microsoft.Extensions.Logging.TraceSource.dll + Microsoft.Extensions.ObjectPool.dll + Microsoft.Extensions.Options.ConfigurationExtensions.dll + Microsoft.Extensions.Options.DataAnnotations.dll + Microsoft.Extensions.Options.dll + Microsoft.Extensions.Primitives.dll + Microsoft.Extensions.Validation.dll + Microsoft.Extensions.WebEncoders.dll + Microsoft.JSInterop.dll + Microsoft.Net.Http.Headers.dll + System.Diagnostics.EventLog.dll + System.Formats.Cbor.dll + System.Security.Cryptography.Xml.dll + System.Threading.RateLimiting.dll +../../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/ref/net10.0/ + Microsoft.CSharp.dll + Microsoft.VisualBasic.Core.dll + Microsoft.VisualBasic.dll + Microsoft.Win32.Primitives.dll + Microsoft.Win32.Registry.dll + mscorlib.dll + netstandard.dll + System.AppContext.dll + System.Buffers.dll + System.Collections.Concurrent.dll + System.Collections.dll + System.Collections.Immutable.dll + System.Collections.NonGeneric.dll + System.Collections.Specialized.dll + System.ComponentModel.Annotations.dll + System.ComponentModel.DataAnnotations.dll + System.ComponentModel.dll + System.ComponentModel.EventBasedAsync.dll + System.ComponentModel.Primitives.dll + System.ComponentModel.TypeConverter.dll + System.Configuration.dll + System.Console.dll + System.Core.dll + System.Data.Common.dll + System.Data.DataSetExtensions.dll + System.Data.dll + System.Diagnostics.Contracts.dll + System.Diagnostics.Debug.dll + System.Diagnostics.DiagnosticSource.dll + System.Diagnostics.FileVersionInfo.dll + System.Diagnostics.Process.dll + System.Diagnostics.StackTrace.dll + System.Diagnostics.TextWriterTraceListener.dll + System.Diagnostics.Tools.dll + System.Diagnostics.TraceSource.dll + System.Diagnostics.Tracing.dll + System.dll + System.Drawing.dll + System.Drawing.Primitives.dll + System.Dynamic.Runtime.dll + System.Formats.Asn1.dll + System.Formats.Tar.dll + System.Globalization.Calendars.dll + System.Globalization.dll + System.Globalization.Extensions.dll + System.IO.Compression.Brotli.dll + System.IO.Compression.dll + System.IO.Compression.FileSystem.dll + System.IO.Compression.ZipFile.dll + System.IO.dll + System.IO.FileSystem.AccessControl.dll + System.IO.FileSystem.dll + System.IO.FileSystem.DriveInfo.dll + System.IO.FileSystem.Primitives.dll + System.IO.FileSystem.Watcher.dll + System.IO.IsolatedStorage.dll + System.IO.MemoryMappedFiles.dll + System.IO.Pipelines.dll + System.IO.Pipes.AccessControl.dll + System.IO.Pipes.dll + System.IO.UnmanagedMemoryStream.dll + System.Linq.AsyncEnumerable.dll + System.Linq.dll + System.Linq.Expressions.dll + System.Linq.Parallel.dll + System.Linq.Queryable.dll + System.Memory.dll + System.Net.dll + System.Net.Http.dll + System.Net.Http.Json.dll + System.Net.HttpListener.dll + System.Net.Mail.dll + System.Net.NameResolution.dll + System.Net.NetworkInformation.dll + System.Net.Ping.dll + System.Net.Primitives.dll + System.Net.Quic.dll + System.Net.Requests.dll + System.Net.Security.dll + System.Net.ServerSentEvents.dll + System.Net.ServicePoint.dll + System.Net.Sockets.dll + System.Net.WebClient.dll + System.Net.WebHeaderCollection.dll + System.Net.WebProxy.dll + System.Net.WebSockets.Client.dll + System.Net.WebSockets.dll + System.Numerics.dll + System.Numerics.Vectors.dll + System.ObjectModel.dll + System.Reflection.DispatchProxy.dll + System.Reflection.dll + System.Reflection.Emit.dll + System.Reflection.Emit.ILGeneration.dll + System.Reflection.Emit.Lightweight.dll + System.Reflection.Extensions.dll + System.Reflection.Metadata.dll + System.Reflection.Primitives.dll + System.Reflection.TypeExtensions.dll + System.Resources.Reader.dll + System.Resources.ResourceManager.dll + System.Resources.Writer.dll + System.Runtime.CompilerServices.Unsafe.dll + System.Runtime.CompilerServices.VisualC.dll + System.Runtime.dll + System.Runtime.Extensions.dll + System.Runtime.Handles.dll + System.Runtime.InteropServices.dll + System.Runtime.InteropServices.JavaScript.dll + System.Runtime.InteropServices.RuntimeInformation.dll + System.Runtime.Intrinsics.dll + System.Runtime.Loader.dll + System.Runtime.Numerics.dll + System.Runtime.Serialization.dll + System.Runtime.Serialization.Formatters.dll + System.Runtime.Serialization.Json.dll + System.Runtime.Serialization.Primitives.dll + System.Runtime.Serialization.Xml.dll + System.Security.AccessControl.dll + System.Security.Claims.dll + System.Security.Cryptography.Algorithms.dll + System.Security.Cryptography.Cng.dll + System.Security.Cryptography.Csp.dll + System.Security.Cryptography.dll + System.Security.Cryptography.Encoding.dll + System.Security.Cryptography.OpenSsl.dll + System.Security.Cryptography.Primitives.dll + System.Security.Cryptography.X509Certificates.dll + System.Security.dll + System.Security.Principal.dll + System.Security.Principal.Windows.dll + System.Security.SecureString.dll + System.ServiceModel.Web.dll + System.ServiceProcess.dll + System.Text.Encoding.CodePages.dll + System.Text.Encoding.dll + System.Text.Encoding.Extensions.dll + System.Text.Encodings.Web.dll + System.Text.Json.dll + System.Text.RegularExpressions.dll + System.Threading.AccessControl.dll + System.Threading.Channels.dll + System.Threading.dll + System.Threading.Overlapped.dll + System.Threading.Tasks.Dataflow.dll + System.Threading.Tasks.dll + System.Threading.Tasks.Extensions.dll + System.Threading.Tasks.Parallel.dll + System.Threading.Thread.dll + System.Threading.ThreadPool.dll + System.Threading.Timer.dll + System.Transactions.dll + System.Transactions.Local.dll + System.ValueTuple.dll + System.Web.dll + System.Web.HttpUtility.dll + System.Windows.dll + System.Xml.dll + System.Xml.Linq.dll + System.Xml.ReaderWriter.dll + System.Xml.Serialization.dll + System.Xml.XDocument.dll + System.Xml.XmlDocument.dll + System.Xml.XmlSerializer.dll + System.Xml.XPath.dll + System.Xml.XPath.XDocument.dll + WindowsBase.dll +../../ + 0-Nine.Core/obj/Debug/net10.0/ref/Nine.Core.dll + 1-Nine.Infrastructure/obj/Debug/net10.0/ref/Nine.Infrastructure.dll + 2-Nine.Application/obj/Debug/net10.0/ref/Nine.Application.dll + 3-Nine.Shared.UI/obj/Debug/net10.0/ref/Nine.Shared.UI.dll +/ + anglesharp.css/1.0.0-beta.157/lib/net8.0/AngleSharp.Css.dll + anglesharp.diffing/1.1.1/lib/netstandard2.0/AngleSharp.Diffing.dll + anglesharp/1.4.0/lib/net10.0/AngleSharp.dll + bunit/2.4.2/lib/net10.0/bunit.dll + fluentassertions/8.8.0/lib/net6.0/FluentAssertions.dll + microsoft.aspnetcore.components.webassembly.authentication/10.0.0/lib/net10.0/Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll + microsoft.aspnetcore.components.webassembly/10.0.0/lib/net10.0/Microsoft.AspNetCore.Components.WebAssembly.dll + microsoft.aspnetcore.diagnostics.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll + microsoft.aspnetcore.http.connections.client/10.0.1/lib/net10.0/Microsoft.AspNetCore.Http.Connections.Client.dll + microsoft.aspnetcore.identity.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll + microsoft.aspnetcore.signalr.client.core/10.0.1/lib/net10.0/Microsoft.AspNetCore.SignalR.Client.Core.dll + microsoft.aspnetcore.signalr.client/10.0.1/lib/net10.0/Microsoft.AspNetCore.SignalR.Client.dll + microsoft.codecoverage/17.14.1/lib/net8.0/Microsoft.VisualStudio.CodeCoverage.Shim.dll + microsoft.data.sqlite.core/10.0.1/lib/net8.0/Microsoft.Data.Sqlite.dll + microsoft.entityframeworkcore.abstractions/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Abstractions.dll + microsoft.entityframeworkcore.relational/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Relational.dll + microsoft.entityframeworkcore.sqlite.core/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.Sqlite.dll + microsoft.entityframeworkcore/10.0.1/lib/net10.0/Microsoft.EntityFrameworkCore.dll + microsoft.extensions.dependencymodel/10.0.1/lib/net10.0/Microsoft.Extensions.DependencyModel.dll + microsoft.identitymodel.abstractions/8.3.1/lib/net9.0/Microsoft.IdentityModel.Abstractions.dll + microsoft.identitymodel.jsonwebtokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.JsonWebTokens.dll + microsoft.identitymodel.logging/8.3.1/lib/net9.0/Microsoft.IdentityModel.Logging.dll + microsoft.identitymodel.tokens/8.3.1/lib/net9.0/Microsoft.IdentityModel.Tokens.dll + microsoft.jsinterop.webassembly/10.0.0/lib/net10.0/Microsoft.JSInterop.WebAssembly.dll + microsoft.testplatform.testhost/17.14.1/lib/net8.0/ + Microsoft.TestPlatform.CommunicationUtilities.dll + Microsoft.TestPlatform.CoreUtilities.dll + Microsoft.TestPlatform.CrossPlatEngine.dll + Microsoft.TestPlatform.PlatformAbstractions.dll + Microsoft.TestPlatform.Utilities.dll + Microsoft.VisualStudio.TestPlatform.Common.dll + Microsoft.VisualStudio.TestPlatform.ObjectModel.dll + testhost.dll + newtonsoft.json/13.0.3/lib/net6.0/Newtonsoft.Json.dll + questpdf/2025.12.1/lib/net10.0/QuestPDF.dll + sendgrid/9.29.3/lib/netstandard2.0/SendGrid.dll + sqlitepclraw.bundle_e_sqlite3/2.1.11/lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll + sqlitepclraw.core/2.1.11/lib/netstandard2.0/SQLitePCLRaw.core.dll + sqlitepclraw.provider.e_sqlcipher/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlcipher.dll + sqlitepclraw.provider.e_sqlite3/2.1.11/lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll + starkbank-ecdsa/1.3.3/lib/netstandard2.1/StarkbankEcdsa.dll + system.identitymodel.tokens.jwt/8.3.1/lib/net9.0/System.IdentityModel.Tokens.Jwt.dll + system.security.cryptography.protecteddata/9.0.0/lib/net9.0/System.Security.Cryptography.ProtectedData.dll + twilio/7.14.0/lib/net6.0/Twilio.dll + xunit.abstractions/2.0.3/lib/netstandard2.0/xunit.abstractions.dll + xunit.assert/2.9.3/lib/net6.0/xunit.assert.dll + xunit.extensibility.core/2.9.3/lib/netstandard1.1/xunit.core.dll + xunit.extensibility.execution/2.9.3/lib/netstandard1.1/xunit.execution.dotnet.dll + +[analyzerReferences] +../../../../../../usr/lib64/dotnet/packs/Microsoft.AspNetCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.AspNetCore.App.Analyzers.dll + Microsoft.AspNetCore.App.CodeFixes.dll + Microsoft.AspNetCore.App.SourceGenerators.dll + Microsoft.AspNetCore.Components.Analyzers.dll + Microsoft.Extensions.Logging.Generators.dll + Microsoft.Extensions.Options.SourceGeneration.dll + Microsoft.Extensions.Validation.ValidationsGenerator.dll +../../../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.2/analyzers/dotnet/cs/ + Microsoft.Interop.ComInterfaceGenerator.dll + Microsoft.Interop.JavaScript.JSImportGenerator.dll + Microsoft.Interop.LibraryImportGenerator.dll + Microsoft.Interop.SourceGeneration.dll + System.Text.Json.SourceGeneration.dll + System.Text.RegularExpressions.Generator.dll +../../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/ + Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll + Microsoft.CodeAnalysis.NetAnalyzers.dll +/ + microsoft.entityframeworkcore.analyzers/10.0.1/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll + xunit.analyzers/1.18.0/analyzers/dotnet/cs/ + xunit.analyzers.dll + xunit.analyzers.fixes.dll + +[analyzerConfigFiles] +../../../../../../usr/lib64/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig +obj/Debug/net10.0/Nine.Shared.UI.Tests.GeneratedMSBuildEditorConfig.editorconfig diff --git a/6-Tests/Nine.Tests/.runsettings b/6-Tests/Nine.Tests/.runsettings deleted file mode 100644 index e0d5bb7..0000000 --- a/6-Tests/Nine.Tests/.runsettings +++ /dev/null @@ -1,20 +0,0 @@ - - - - chromium - - false - 10000 - - - true - http://localhost:5197 - - - - - Development - 1 - - - diff --git a/6-Tests/Nine.Tests/NewSetupUITests.cs b/6-Tests/Nine.Tests/NewSetupUITests.cs deleted file mode 100644 index 6406ddc..0000000 --- a/6-Tests/Nine.Tests/NewSetupUITests.cs +++ /dev/null @@ -1,412 +0,0 @@ -using Microsoft.Playwright.NUnit; -using Microsoft.Playwright; - -namespace Nine.Tests; - -[Parallelizable(ParallelScope.Self)] -[TestFixture] - -public class NewSetupUITests : PageTest -{ - - private const string BaseUrl = "http://localhost:5197"; - private const int KeepBrowserOpenSeconds = 30; // Set to 0 to close immediately - - public override BrowserNewContextOptions ContextOptions() - { - return new BrowserNewContextOptions - { - IgnoreHTTPSErrors = true, - BaseURL = BaseUrl, - RecordVideoDir = Path.Combine(Directory.GetCurrentDirectory(), "test-videos"), - RecordVideoSize = new RecordVideoSize { Width = 1280, Height = 720 } - }; - } - - [Test, Order(1)] - public async Task CreateNewAccount() - { - await Page.GotoAsync("http://localhost:5197/"); - await Page.GetByRole(AriaRole.Button, new() { Name = "Create Account" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Organization Name" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Organization Name" }).FillAsync("Nine"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Organization Name" }).PressAsync("Tab"); - await Page.Locator("select[id='Input.State']").SelectOptionAsync(new[] { "TX" }); - await Page.Locator("select[id='Input.State']").PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "First Name" }).FillAsync("Solid"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "First Name" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Last Name" }).FillAsync("One"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Last Name" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password", Exact = true }).FillAsync("SamplePassword2025!"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password", Exact = true }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Confirm Password" }).FillAsync("SamplePassword2025!"); - await Page.GetByRole(AriaRole.Button, new() { Name = "Register" }).ClickAsync(); - - //await Page.WaitForSelectorAsync("h1:has-text('Register confirmation')"); - - // await Page.GetByRole(AriaRole.Heading, new() { Name = "Register confirmation" }).ClickAsync(); - //await Page.GetByRole(AriaRole.Link, new() { Name = "Click here to confirm your account" }).ClickAsync(); - - //await Page.WaitForSelectorAsync("h1:has-text('Confirm email')"); - - // await Page.GetByText("Thank you for confirming your").ClickAsync(); - //await Page.GetByRole(AriaRole.Link, new() { Name = "Home" }).ClickAsync(); - //await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - - //await Page.WaitForSelectorAsync("h1:has-text('Log in')"); - - // await Page.GetByRole(AriaRole.Heading, new() { Name = "Log in", Exact = true }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("Today123"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - await Page.WaitForSelectorAsync("text=Dashboard"); - - await Page.GetByRole(AriaRole.Heading, new() { Name = "Property Management Dashboard", Exact= true }).ClickAsync(); - - - } - - [Test, Order(2)] - public async Task AddProperty() - { - await Page.GotoAsync("http://localhost:5197/"); - await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("SamplePassword2025!"); - await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - // Wait for login to complete - await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - await Page.WaitForSelectorAsync("h1:has-text('Property Management Dashboard')"); - - await Page.GetByRole(AriaRole.Link, new() { Name = "Properties" }).ClickAsync(); - await Page.GetByRole(AriaRole.Button, new() { Name = "Add Property" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter property address" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter property address" }).FillAsync("369 Crescent Drive"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter property address" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "e.g., Apt 2B, Unit" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "City" }).FillAsync("New Orleans"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "City" }).PressAsync("Tab"); - await Page.Locator("select[name=\"Model.State\"]").SelectOptionAsync(new[] { "LA" }); - await Page.Locator("select[name=\"Model.State\"]").PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "#####-####" }).FillAsync("70119"); - await Page.Locator("select[name=\"Model.PropertyType\"]").SelectOptionAsync(new[] { "House" }); - await Page.GetByPlaceholder("0.00").ClickAsync(); - await Page.GetByPlaceholder("0.00").FillAsync("1800"); - await Page.Locator("input[name=\"Model.Bedrooms\"]").ClickAsync(); - await Page.Locator("input[name=\"Model.Bedrooms\"]").FillAsync("4"); - await Page.Locator("input[name=\"Model.Bedrooms\"]").PressAsync("Tab"); - await Page.Locator("input[name=\"Model.Bathrooms\"]").FillAsync("4.5"); - await Page.Locator("input[name=\"Model.Bathrooms\"]").PressAsync("Tab"); - await Page.Locator("input[name=\"Model.SquareFeet\"]").FillAsync("2500"); - await Page.Locator("input[name=\"Model.SquareFeet\"]").PressAsync("Tab"); - await Page.GetByRole(AriaRole.Button, new() { Name = "Create Property" }).ClickAsync(); - - // Verify property was created successfully - await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - await Expect(Page.GetByText("369 Crescent Drive").First).ToBeVisibleAsync(); - - await Page.GetByRole(AriaRole.Button, new() { Name = "Add Property" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter property address" }).ClickAsync(); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter property address" }).FillAsync("354 Maple Avenue"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter property address" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "e.g., Apt 2B, Unit" }).PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "City" }).FillAsync("Los Angeles"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "City" }).PressAsync("Tab"); - await Page.Locator("select[name=\"Model.State\"]").SelectOptionAsync(new[] { "CA" }); - await Page.Locator("select[name=\"Model.State\"]").PressAsync("Tab"); - await Page.GetByRole(AriaRole.Textbox, new() { Name = "#####-####" }).FillAsync("90210"); - await Page.Locator("select[name=\"Model.PropertyType\"]").SelectOptionAsync(new[] { "House" }); - await Page.GetByPlaceholder("0.00").ClickAsync(); - await Page.GetByPlaceholder("0.00").FillAsync("4900"); - await Page.Locator("input[name=\"Model.Bedrooms\"]").ClickAsync(); - await Page.Locator("input[name=\"Model.Bedrooms\"]").FillAsync("4"); - await Page.Locator("input[name=\"Model.Bedrooms\"]").PressAsync("Tab"); - await Page.Locator("input[name=\"Model.Bathrooms\"]").FillAsync("4.5"); - await Page.Locator("input[name=\"Model.Bathrooms\"]").PressAsync("Tab"); - await Page.Locator("input[name=\"Model.SquareFeet\"]").FillAsync("3200"); - await Page.Locator("input[name=\"Model.SquareFeet\"]").PressAsync("Tab"); - await Page.GetByRole(AriaRole.Button, new() { Name = "Create Property" }).ClickAsync(); - - // Verify property was created successfully - await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - await Expect(Page.GetByText("354 Maple Avenue").First).ToBeVisibleAsync(); - } - - // [Test, Order(3)] - // public async Task AddProspect() - // { - // await Page.GotoAsync("http://localhost:5197/"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("Today123"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Prospects" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Add New Prospect" }).ClickAsync(); - - // await Page.Locator("input[name=\"newProspect.FirstName\"]").ClickAsync(); - // await Page.Locator("input[name=\"newProspect.FirstName\"]").FillAsync("Mya"); - // await Page.Locator("input[name=\"newProspect.FirstName\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"newProspect.LastName\"]").ClickAsync(); - // await Page.Locator("input[name=\"newProspect.LastName\"]").FillAsync("Smith"); - // await Page.Locator("input[name=\"newProspect.LastName\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"newProspect.Email\"]").FillAsync("mya@gmail.com"); - // await Page.Locator("input[name=\"newProspect.Email\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"newProspect.Phone\"]").FillAsync("504-234-3600"); - // await Page.Locator("input[name=\"newProspect.Phone\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"newProspect.DateOfBirth\"]").FillAsync("1993-09-29"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "e.g., Driver's License #" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "e.g., Driver's License #" }).FillAsync("12345678"); - // await Page.Locator("select[name=\"newProspect.IdentificationState\"]").SelectOptionAsync(new[] { "LA" }); - // await Page.Locator("select[name=\"newProspect.Source\"]").SelectOptionAsync(new[] { "Zillow" }); - // await Page.Locator("select[name=\"newProspect.InterestedPropertyId\"]").SelectOptionAsync(new[] { "354 Maple Avenue" }); - // await Page.Locator("input[name=\"newProspect.DesiredMoveInDate\"]").FillAsync("2026-01-01"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Save Prospect" }).ClickAsync(); - - // // Verify property was created successfully - // await Page.WaitForSelectorAsync("h1:has-text('Prospective Tenants')"); - // await Expect(Page.GetByText("Mya Smith").First).ToBeVisibleAsync(); - // } - - // [Test, Order(4)] - // public async Task ScheduleAndCompleteTour() - // { - // await Page.GotoAsync("http://localhost:5197/"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("Today123"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Prospects" }).ClickAsync(); - // await Page.GetByTitle("Schedule Tour").ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = "Schedule Tour" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = "Complete Tour", Exact = true }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // // await Page.GetByRole(AriaRole.Button, new() { Name = " Continue Editing" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Check All" }).First.ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Check All" }).Nth(1).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Check All" }).Nth(2).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Check All" }).Nth(3).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Check All" }).Nth(4).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Check All" }).Nth(5).ClickAsync(); - - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter value" }).First.ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Enter value" }).First.FillAsync("1800"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "e.g., $" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "e.g., $" }).FillAsync("1800"); - - // await Page.Locator("div:nth-child(10) > .card-header > .btn").ClickAsync(); - // await Page.Locator("div:nth-child(11) > .card-header > .btn").ClickAsync(); - - // await Page.GetByText("Interested", new() { Exact = true }).ClickAsync(); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Save Progress" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Mark as Complete" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Generate PDF" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // var page1 = await Page.RunAndWaitForPopupAsync(async () => - // { - // await Page.GetByRole(AriaRole.Button, new() { Name = " View PDF" }).ClickAsync(); - // }); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Dashboard" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Logout" }).ClickAsync(); - // } - - // [Test, Order(5)] - // public async Task SubmitApplication() - // { - // await Page.GotoAsync("http://localhost:5197/"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("Today123"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Prospects" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Apply" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Main St" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Main St" }).FillAsync("123 Main Street"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Main St" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Los Angeles" }).FillAsync("Los Angeles"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Los Angeles" }).PressAsync("Tab"); - // await Page.Locator("select[name=\"applicationModel.CurrentState\"]").SelectOptionAsync(new[] { "CA" }); - // await Page.Locator("select[name=\"applicationModel.CurrentState\"]").PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "90210" }).FillAsync("90210"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "90210" }).PressAsync("Tab"); - // await Page.Locator("input[name=\"applicationModel.CurrentRent\"]").FillAsync("1500"); - // await Page.Locator("input[name=\"applicationModel.CurrentRent\"]").PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "John Smith" }).FillAsync("John Smith"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "John Smith" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "(555) 123-" }).FillAsync("555-123-4567"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "(555) 123-" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "ABC Company" }).PressAsync("CapsLock"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "ABC Company" }).FillAsync("ABC"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "ABC Company" }).PressAsync("CapsLock"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "ABC Company" }).FillAsync("ABC Company"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "ABC Company" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Software Engineer" }).FillAsync("Software Engineer"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Software Engineer" }).PressAsync("Tab"); - // await Page.Locator("input[name=\"applicationModel.MonthlyIncome\"]").FillAsync("9600"); - // await Page.Locator("input[name=\"applicationModel.MonthlyIncome\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"applicationModel.EmploymentLengthMonths\"]").FillAsync("15"); - // await Page.Locator("input[name=\"applicationModel.EmploymentLengthMonths\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"applicationModel.Reference1Name\"]").FillAsync("Richard"); - // await Page.Locator("input[name=\"applicationModel.Reference1Name\"]").PressAsync("Tab"); - // await Page.Locator("input[name=\"applicationModel.Reference1Phone\"]").FillAsync("Zachary"); - // await Page.Locator("input[name=\"applicationModel.Reference1Phone\"]").PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Friend, Coworker, etc." }).FillAsync("Spouse"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Submit Application" }).ClickAsync(); - - // // Verify property was created successfully - // await Expect(Page.GetByText("Application submitted successfully")).ToBeVisibleAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Prospects" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.WaitForSelectorAsync("h1:has-text('Prospective Tenants')"); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Dashboard" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = "Logout" }).ClickAsync(); - // } - - // [Test, Order(6)] - // public async Task ApproveApplication() - // { - // await Page.GotoAsync("http://localhost:5197/"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("Today123"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Prospects" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByTitle("View Details").ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " View Application" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Collect Application Fee" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Combobox).SelectOptionAsync(new[] { "Online Payment" }); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Confirm Payment" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Initiate Screening" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Pass" }).First.ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Confirm Pass" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Pass" }).Nth(1).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Confirm Pass" }).ClickAsync(); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Approve Application" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Dashboard" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Logout" }).ClickAsync(); - // } - - // [Test] - // public async Task GenerateLeaseOfferAndConvertToLease() - // { - // await Page.GotoAsync("http://localhost:5197/"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Sign In" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).ClickAsync(); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).FillAsync("owner1@aquiis.com"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Email" }).PressAsync("Tab"); - // await Page.GetByRole(AriaRole.Textbox, new() { Name = "Password" }).FillAsync("Today123"); - // await Page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Prospects" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByTitle("View Details").ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " View Application" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Generate Lease Offer" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Generate Lease Offer" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = " Accept Offer (Convert to Lease" }).ClickAsync(); - - // await Page.GetByRole(AriaRole.Combobox).SelectOptionAsync(new[] { "Online Payment" }); - // await Page.GetByRole(AriaRole.Button, new() { Name = " Accept & Create Lease" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Link, new() { Name = "Dashboard" }).ClickAsync(); - - // await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded); - - // await Page.GetByRole(AriaRole.Button, new() { Name = "Logout" }).ClickAsync(); - // } - -} \ No newline at end of file diff --git a/6-Tests/Nine.Tests/Nine.Tests.csproj b/6-Tests/Nine.Tests/Nine.Tests.csproj deleted file mode 100644 index b80866f..0000000 --- a/6-Tests/Nine.Tests/Nine.Tests.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - net10.0 - latest - enable - enable - false - - - - - - - - - - - - - - - - - - - - diff --git a/6-Tests/Nine.Tests/README.md b/6-Tests/Nine.Tests/README.md deleted file mode 100644 index ad66a3a..0000000 --- a/6-Tests/Nine.Tests/README.md +++ /dev/null @@ -1,234 +0,0 @@ -# Nine E2E Tests with Playwright - -End-to-end UI testing for Nine property management system using Microsoft Playwright. - -## What's Tested - -These tests automate the **Phase 5.5 Multi-Organization Management** testing scenarios from `PROPERTY-TENANT-LIFECYCLE-ROADMAP.md`: - -1. **Scenario 1:** Owner (Carlos) - Full access across all organizations -2. **Scenario 2:** Administrator (Alice) - Manage single organization -3. **Scenario 3:** PropertyManager (Bob) - View/edit assigned properties -4. **Scenario 4:** User (Lisa) - Read-only access -5. **Scenario 5:** Cross-organization data isolation -6. **Scenario 6:** Owner organization switching - -## Prerequisites - -**Your application must be running** before executing tests: - -```bash -# Start the application (from /4-Nine) -dotnet watch - -# Or use the watch task -``` - -The tests expect the app at: `https://localhost:5001` - -## Running Tests - -### All Tests - -```bash -cd Nine.Tests -dotnet test -``` - -### Specific Test - -```bash -dotnet test --filter "FullyQualifiedName~Scenario4_User_HasReadOnlyAccess" -``` - -### With Browser UI (Headed Mode) - -By default, tests run headless. To see the browser: - -```bash -# Set environment variable -export HEADED=1 -dotnet test - -# Or in PowerShell -$env:HEADED=1 -dotnet test -``` - -### Specific Browser - -```bash -# Chromium (default) -dotnet test - -# Firefox -export BROWSER=firefox -dotnet test - -# WebKit (Safari engine) -export BROWSER=webkit -dotnet test -``` - -## Test User Accounts - -Tests use these accounts (must exist in your database): - -| User | Email | Password | Role | Organization | -| --------------- | ----------------- | -------- | --------------- | ------------- | -| Owner | owner1@nine.local | Today123 | Owner | Multiple orgs | -| Administrator | jc@example.com | Today123 | Administrator | Nine | -| PropertyManager | jh@example.com | Today123 | PropertyManager | Nine | -| User | mya@example.com | Today123 | User | Nine | - -**Ensure these users exist before running tests!** - -**Organizations in test database:** - -- Nine -- Nine - Colorado - -## Debugging Failed Tests - -### Screenshots on Failure - -Playwright automatically captures screenshots when tests fail: - -``` -Nine.Tests/bin/Debug/net9.0/playwright-screenshots/ -``` - -### Trace Viewer - -Enable trace recording for detailed debugging: - -```csharp -// In PageTest, add: -[SetUp] -public async Task Setup() -{ - await Context.Tracing.StartAsync(new() - { - Screenshots = true, - Snapshots = true - }); -} - -[TearDown] -public async Task Teardown() -{ - await Context.Tracing.StopAsync(new() - { - Path = "trace.zip" - }); -} -``` - -Then view traces: - -```bash -pwsh bin/Debug/net9.0/playwright.ps1 show-trace trace.zip -``` - -### Slow Motion - -Run tests in slow motion to watch interactions: - -```csharp -// Modify test to launch browser with slow motion -await Page.Context.Browser.NewPageAsync(new() -{ - SlowMo = 1000 // 1 second delay between actions -}); -``` - -## CI/CD Integration - -Tests are designed for CI/CD pipelines: - -```yaml -# GitHub Actions example -- name: Install Playwright Browsers - run: pwsh Nine.Tests/bin/Debug/net9.0/playwright.ps1 install --with-deps - -- name: Run E2E Tests - run: dotnet test Nine.Tests -``` - -## Updating Tests - -When adding new features: - -1. Add test methods to `PropertyManagementTests.cs` -2. Follow naming convention: `Scenario{N}_{Description}` -3. Use descriptive assertions with custom messages -4. Keep tests isolated (no shared state between tests) - -## Playwright Best Practices - -### Use Role-Based Selectors - -```csharp -// Good -await Page.GetByRole(AriaRole.Button, new() { Name = "Add Property" }).ClickAsync(); - -// Avoid -await Page.ClickAsync(".btn-primary"); -``` - -### Wait for Elements - -```csharp -// Good - explicit wait -await Page.WaitForSelectorAsync("h1:has-text('Properties')"); - -// Avoid - arbitrary delays -await Task.Delay(2000); -``` - -### Assertions - -```csharp -// Good - Playwright assertions (auto-wait) -await Expect(Page.GetByText("Dashboard")).ToBeVisibleAsync(); - -// Avoid - NUnit assertions (no waiting) -Assert.That(await Page.Locator("text=Dashboard").IsVisibleAsync(), Is.True); -``` - -## Troubleshooting - -### Tests can't connect to app - -- Verify app is running: `curl https://localhost:5001` -- Check `BaseUrl` in tests matches your app URL -- Ensure SSL certificate is trusted - -### Login failures - -- Verify test users exist in database -- Check passwords match (case-sensitive!) -- Inspect login page selectors (may have changed) - -### Element not found - -- Use `await Page.PauseAsync()` to debug -- Inspect selector with browser dev tools -- Check if element is in shadow DOM or iframe - -### Browsers not installed - -```bash -pwsh bin/Debug/net9.0/playwright.ps1 install -``` - -## Resources - -- [Playwright .NET Documentation](https://playwright.dev/dotnet/) -- [NUnit Playwright Integration](https://playwright.dev/dotnet/docs/test-runners) -- [Selectors Guide](https://playwright.dev/dotnet/docs/selectors) -- [Assertions](https://playwright.dev/dotnet/docs/test-assertions) - ---- - -**Note:** These are E2E tests - they test the full stack (UI → API → Database). Keep them focused on critical user workflows to avoid slow, brittle test suites. diff --git a/6-Tests/Nine.Tests/run-tests-debug.sh b/6-Tests/Nine.Tests/run-tests-debug.sh deleted file mode 100755 index 9c02abe..0000000 --- a/6-Tests/Nine.Tests/run-tests-debug.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Run Playwright tests in debug mode with visible browser and inspector - -export PWDEBUG=1 -export DISPLAY=:0 - -dotnet test "$@" diff --git a/6-Tests/Nine.Tests/run-tests.sh b/6-Tests/Nine.Tests/run-tests.sh deleted file mode 100755 index 8150b07..0000000 --- a/6-Tests/Nine.Tests/run-tests.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Run Playwright tests normally (headless mode, no inspector) - -unset PWDEBUG -export DISPLAY=:0 - -dotnet test "$@" diff --git a/CHANGELOG.md b/CHANGELOG.md index e2fbca3..c705007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,15 +11,71 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## [1.2.0] - 2026-11-11 + +### Changed + +- Default theme set to Obsidian +- Notification Preferences: removed Email, SMS, and Daily Digest cards (channels not applicable to always-offline desktop app) +- About page overhauled with updated content and layout +- Property list replaced Active/Inactive tabs with Available/Occupied/Off-Market market-status tabs mapped to the existing Property.Status lifecycle +- Leases list now defaults to the Active status filter instead of showing all statuses +- Lease.IsActive is now synced from Lease.Status on creation so active-lease queries correctly exclude leases created with a non-active status +- Income Statement, Tax Report (Schedule E), and Property Performance reports now populate expense categories from real `PropertyExpense` data instead of hardcoded `$0` placeholders +- Schedule E Mortgage Expense line now references Form 1098, Box 1 for the tax-deductible interest portion, instead of a vague "verify" instruction + +### Added + +- Paging for Outstanding Invoices on dashboard (5 per page) +- Archive/delete workflow for Properties, Repairs, Leases, Invoices, Payments, Maintenance, and Tenants, with cascade summaries, a show-archived toggle, and restore support +- Property expense tracking: recurring and one-time expenses with due-date generation, payment history, waive/skip handling, and lease type support +- Repair supporting-document uploads (receipts, warranties, user guides, photos) via a new RepairDocumentsCard component +- Repairs list status filter (All/Pending/Completed), combinable with the existing In-Progress-Only toggle +- Dynamic port selection for the Electron desktop shell to prevent startup port conflicts +- Actual-expense-by-category queries in `FinancialReportService` and `NineFinancialReportService` backing the report pages above + +### Removed + +- SendGrid and Twilio packages, DI registrations, and appsettings entries removed from `4-Nine`; shared library implementations retained for Aquiis.Professional +- Registration link hidden after first non-system user account exists +- Lease.DocumentId / Document navigation property removed to break a circular FK cycle (Lease → Document → Lease); replaced with the Documents collection +- Orphaned Applications feature pages removed (`Index.razor`, `Edit.razor`, `View.razor`) — unreachable, no linked Prospects UI or NavMenu entry +- Unused `PropertyManagementService` injection removed from Calendar views and DI registration + +### Fixed + +- Change Database Password restricted to Administrator role only; hidden for all other roles +- Decrypted backup export now saves to `Backups/` folder +- Sidebar flex layout fix resolves scrollbar rendering issue +- Disabled Electron auto-opening DevTools on startup +- `IEmailService` / `ISMSService` DI registrations moved to Application layer; resolves startup crash after removing from product `Program.cs` +- Inspection Edit page rebuilt — missing route parameter caused an exception when editing a saved inspection +- Electron window now resolves its URL from `app.Urls` after Kestrel starts instead of a pre-captured port variable, fixing a blank/offline window on certain startup paths +- RepairService.GetByIdAsync now explicitly includes Property, fixing a blank Property when navigating directly to a repair's URL +- Cascade-delete support added with explicit transactions across LeaseService, TenantService, InvoiceService, MaintenanceService, InspectionService, and PropertyService + +--- + +## [1.1.0] - 2026-04 + +### Added + +- Built-in upgrade path between releases +- Generational database migration support +- Full-coverage data import + +--- + ## [1.0.0] - 2026-03-01 -### 🎉 Initial Release +### Initial Release **Nine.** v1.0.0 is the first production release — property management perfected for up to nine properties. ### Added #### Core Property Management + - Property profiles with status tracking (Available, Occupied, Under Renovation, Off Market) - Prospect-to-tenant journey: lead capture, tour scheduling, rental applications, screening - Digital lease creation with offer/acceptance workflow and e-signature audit trail @@ -27,6 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Tenant profiles with full contact information and lease history #### Financial Management + - Automated rent invoice generation based on lease schedules - Payment tracking across multiple payment methods - Automatic late fee application after configurable grace period @@ -34,17 +91,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Financial reports with PDF export #### Maintenance & Inspections + - Maintenance request tracking with vendor assignment and status management - Comprehensive 26-item inspection checklist (5 categories) - Scheduled routine inspections and move-in/move-out tracking - PDF inspection reports saved to document store #### Notifications & Automation + - In-app, email (SendGrid), and SMS (Twilio) notifications - Background task service for automated late fees, lease expiration warnings, and scheduling - Configurable notification preferences per user #### Database & Security + - SQLite file-based database (no server required) - Database encryption at rest (SQLCipher AES-256) - OS keychain integration for password management @@ -53,11 +113,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Content Security Policy (CSP) headers #### Multi-User & Access Control + - Role-based access control: Administrator, Property Manager, Tenant - Maximum 3 users (1 system account + 2 login users) - Multi-tenant design with organization isolation #### Desktop Application + - Native desktop experience via ElectronNET on Linux and Windows - Linux AppImage (x86_64) with desktop integration script - Windows NSIS installer and portable executable @@ -79,5 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- -[Unreleased]: https://github.com/xnodeoncode/nine/compare/v1.0.0...HEAD -[1.0.0]: https://github.com/xnodeoncode/nine/releases/tag/v1.0.0 +[Unreleased]: https://github.com/xnodeoncode/Nine/compare/v1.2.0...HEAD +[1.2.0]: https://github.com/xnodeoncode/Nine/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/xnodeoncode/Nine/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/xnodeoncode/Nine/releases/tag/v1.0.0 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..1ae0f84 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,13 @@ + + + + https://github.com/advisories/GHSA-2m69-gcr7-jv3q + $(NoWarn);NU1903 + + diff --git a/Documentation/Advanced-Troubleshooting-Guide.md b/Documentation/Advanced-Troubleshooting-Guide.md new file mode 100644 index 0000000..e75313b --- /dev/null +++ b/Documentation/Advanced-Troubleshooting-Guide.md @@ -0,0 +1,159 @@ +# Nine. - Advanced Troubleshooting Guide + +**Version:** 1.2.0 +**Last Updated:** November 16, 2026 +**Audience:** Administrators and Power Users + +--- + +This guide is for advanced troubleshooting and installation help, usually when you are working with the Nine development team. +Everyday installation, backup and upgrade steps are in the [Quick Start Guide](Quick-Start-Guide.md) and the +[Database Management Guide](Database-Management-Guide.md). + +The commands below are for **Linux (AppImage)**. Windows versions of the scripts are planned; see [Windows](#windows). + +--- + +## Where the scripts are + +| Where | Folder | +| ----------------------------------------------- | ---------------------------------------------------------------------------- | +| In the release download | The `Utilities` folder, next to the AppImage | +| After running the desktop integration installer | `~/Applications/Nine/Utilities/` (the AppImage is in `~/Applications/Nine/`) | +| Inside the application package (fallback) | `resources/bin/Utilities/` | + +If you no longer have the scripts, you can read them out of the AppImage without unpacking all of it: + +```bash +# Prints the folder where the AppImage is mounted, then waits. Leave it running and copy the files from a second terminal. +./Nine-1.2.0-x86_64.AppImage --appimage-mount +cp /tmp/.mount_Nine-XXXXXX/resources/bin/Utilities/* ~/ +``` + +Press Ctrl+C in the first terminal to unmount. Replace `.mount_Nine-XXXXXX` with the path that was printed. + +--- + +## nine-tool.sh + +`nine-tool.sh` is one entry point for the other scripts. It finds them in its own folder, so keep the scripts together. The examples +below are run from the `Utilities` folder; the release download has the AppImage one level up. + +```bash +chmod +x *.sh # only needed once, if the executable bit was lost +./nine-tool.sh help # list the commands +``` + +| Command | Runs | What it does | +| ----------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `install ` | `install-desktop-integration.sh` | Copies the AppImage to `~/Applications/Nine`, adds Nine to the application launcher, and copies the scripts to `~/Applications/Nine/Utilities` | +| `remove [options]` | `nine-removal.sh` | Removes the launcher entry, icon and AppImages; optionally the data and the saved encryption key | +| `diagnose [AppImage]` | `diagnose-startup.sh` | Starts Nine, times how long startup takes, and reports the database files | +| `verify [AppImage] [options]` | `verify-build.sh` | Starts Nine and checks ports, host-header protection and every outbound connection attempt | + +Options after the command name are passed straight to the script, for example `./nine-tool.sh remove --dry-run`. + +### install + +```bash +./nine-tool.sh install ../Nine-1.2.0-x86_64.AppImage +``` + +Keep the scripts together (the `Utilities` folder already does). The installer copies every script in its folder into +`~/Applications/Nine/Utilities`, so `nine-tool.sh` keeps working from there. The commands find the installed AppImage in +`~/Applications/Nine` without being told. + +### remove + +```bash +./nine-tool.sh remove --dry-run # preview; nothing is changed +./nine-tool.sh remove # launcher entry, icon and AppImages; keeps your data +./nine-tool.sh remove --only Nine-1.2.0-x86_64.AppImage # one AppImage only; keeps everything else +./nine-tool.sh remove --remove-data # also deletes the data folder (all versions) +./nine-tool.sh remove --remove-keychain # also deletes the saved database password +./nine-tool.sh remove --remove-keychain-only # deletes only the saved database password +./nine-tool.sh remove --all # everything: AppImages, data and saved password +``` + +- **Back up first.** Copy your database backups to a location outside `~/.config/Nine`. Removing the data deletes them too. +- Deleting data or the saved password asks you to type `DELETE`. The script will not run while Nine is open. +- The data folder and the saved password are shared by every Nine version on the account. +- `./nine-tool.sh remove --help` lists every option. + +### diagnose + +```bash +./nine-tool.sh diagnose # newest AppImage in ~/Applications/Nine +./nine-tool.sh diagnose /path/to/Nine.AppImage +``` + +It starts Nine, measures how long the .NET backend and the web interface take to come up, lists your database files, and stops the +instance it started. Startup normally takes a few seconds; more than about 20 seconds is worth reporting. The startup log is +written to `/tmp/nine-startup.log`. + +### verify + +```bash +./nine-tool.sh verify /path/to/Nine-1.2.0-x86_64.AppImage # normal run checks +./nine-tool.sh verify /path/to/Nine-1.2.0-x86_64.AppImage --network # also test in an isolated network +``` + +Use it after building or when asked to by the development team. It lists what it needs, then asks before it starts anything: +`strace`, `ss`, `curl` and `python3`, plus `unshare` and `ip` for `--network`. + +It checks that: + +- the web interface and the Electron socket start on loopback only; +- requests with a foreign `Host` header are rejected (400) and loopback hosts are accepted (200); +- a normal run logs no Debug lines; +- every outbound connection attempt is listed; +- with `--network`, no packets leave the machine in an isolated network, and Nine also starts with no network at all. + +The result is a list of PASS, FAIL and WARN lines and a summary. A warning is not a failure. Two warnings are expected today: the +Electron socket accepts a handshake without a token, and the app makes a route check to a Google IPv6 address that sends no data. + +**It starts Nine against your real data folder and only reads. Do not sign in while it runs.** Options: `--network-only`, +`--yes` (skip the prompt) and `--keep` (keep the temporary files). The AppImage is extracted to a temporary folder and run from there +because `strace` cannot follow the normal AppImage mount. + +--- + +## Log files and debug logging + +Nine writes its log to the terminal. Start it from a terminal to see it, and use `tee` to keep a copy: + +```bash +./Nine-1.2.0-x86_64.AppImage 2>&1 | tee ~/nine.log +``` + +To see more detail, set a log level in the environment for that run: + +```bash +Logging__LogLevel__Nine=Debug ./Nine-1.2.0-x86_64.AppImage 2>&1 | tee ~/nine-debug.log +Logging__LogLevel__Default=Debug ./Nine-1.2.0-x86_64.AppImage 2>&1 | tee ~/nine-debug.log +``` + +The first shows Nine's own Debug messages, which appear when you use features that log them (for example unlocking an encrypted +database). The second also shows Debug messages from the framework and is much longer. + +**Review a log before you send it.** Logs can include names and identifiers you entered, such as tenant names and user IDs. + +--- + +## What to send when asking for help + +1. The Nine version (the About page, or the AppImage file name). +2. Your operating system and version. +3. The output of `./nine-tool.sh diagnose`. +4. A log captured as above, after reviewing it. +5. The output of `./nine-tool.sh verify` if the question is about network behavior. + +Do not send your database file or backups unless you were asked to. + +--- + +## Windows + +Windows versions (`nine-tool.ps1`, `nine-removal.ps1`, `install-desktop-integration.ps1`, `diagnose-startup.ps1`) exist only as +placeholders and make no changes. To uninstall the installer version, use **Add or Remove Programs**. Clean-up of the data folder and +the portable version on Windows is still being documented. diff --git a/Documentation/AppImageHub-Submission-Guide.md b/Documentation/AppImageHub-Submission-Guide.md deleted file mode 100644 index 49f01e7..0000000 --- a/Documentation/AppImageHub-Submission-Guide.md +++ /dev/null @@ -1,317 +0,0 @@ -# AppImageHub Submission Guide - -This guide walks through submitting Nine Property Management to AppImageHub for improved discoverability. - -## Prerequisites - -- ✅ v1.0.0 release published on GitHub -- ✅ AppImage built and tested (230MB, ~2s startup) -- ✅ Desktop file created (`aquiis.desktop`) -- ✅ AppStream metadata created (`com.aquiis.propertymanagement.appdata.xml`) -- ⏳ Screenshots needed (4 images) -- ⏳ Fork appimage.github.io repository -- ⏳ Submit pull request - -## Step 1: Capture Screenshots - -Launch the application and capture 4 screenshots (see `Documentation/Screenshots/README.md` for details): - -```bash -# Launch application -~/Applications/Nine-1.0.0.AppImage - -# Capture dashboard (primary screenshot) -gnome-screenshot -w -d 2 -# Save as: Documentation/Screenshots/dashboard.png - -# Navigate to Properties and capture -gnome-screenshot -w -d 2 -# Save as: Documentation/Screenshots/property-management.png - -# Navigate to Leases and capture -gnome-screenshot -w -d 2 -# Save as: Documentation/Screenshots/lease-workflow.png - -# Navigate to Invoices and capture -gnome-screenshot -w -d 2 -# Save as: Documentation/Screenshots/invoice-tracking.png -``` - -**Requirements:** - -- PNG format -- 1920x1080 recommended (minimum 752x423) -- Under 500KB each -- Show actual features, not promotional graphics - -## Step 2: Commit Screenshots to Repository - -Screenshots must be on GitHub before AppImageHub submission: - -```bash -cd ~/Source/Nine - -# Add screenshots -git add Documentation/Screenshots/*.png - -# Commit -git commit -m "Add AppImageHub screenshots for v1.0.0 submission" - -# Follow normal workflow: feature → development → PR to main -``` - -## Step 3: Fork AppImageHub Repository - -1. Visit: https://github.com/AppImage/appimage.github.io -2. Click "Fork" button (top right) -3. Fork to your GitHub account - -## Step 4: Clone Your Fork - -```bash -# Clone your fork -git clone https://github.com/YOUR_USERNAME/appimage.github.io.git ~/appimage.github.io - -cd ~/appimage.github.io - -# Add upstream remote -git remote add upstream https://github.com/AppImage/appimage.github.io.git - -# Fetch latest -git fetch upstream -git checkout master -git merge upstream/master -``` - -## Step 5: Run Preparation Script - -```bash -cd ~/Source/Nine/4-Nine/Assets -./prepare-appimage-hub-submission.sh -``` - -This script will: - -- Create `database/Nine_Property_Management/` directory -- Copy desktop file, icon, and AppStream metadata -- Copy primary screenshot -- Provide next steps - -## Step 6: Verify Files - -```bash -cd ~/appimage.github.io/database/Nine_Property_Management -ls -lh - -# Should see: -# aquiis.desktop -# aquiis.png (512x512 icon) -# com.aquiis.propertymanagement.appdata.xml -# screenshot.png (dashboard screenshot) -``` - -**Verify desktop file:** - -```bash -cat aquiis.desktop -``` - -**Validate AppStream metadata:** - -```bash -appstreamcli validate com.aquiis.propertymanagement.appdata.xml -``` - -## Step 7: Create Branch and Commit - -```bash -cd ~/appimage.github.io - -# Create branch -git checkout -b add-aquiis-property-management - -# Add files -git add database/Nine_Property_Management/ - -# Commit -git commit -m "Add Nine Property Management - -Nine is a property management application for small landlords -managing 1-9 residential rental properties. - -Features: -- Property, tenant, and lease management -- Automated invoicing and payment tracking -- Maintenance request tracking -- Property inspections with PDF reports -- Security deposit investment tracking -- Multi-user support with role-based access - -Homepage: https://github.com/xnodeoncode/nine -License: MIT -AppImage: https://github.com/xnodeoncode/nine/releases/tag/v1.0.0" - -# Push to your fork -git push origin add-aquiis-property-management -``` - -## Step 8: Create Pull Request - -1. Visit: https://github.com/AppImage/appimage.github.io/compare -2. Click "compare across forks" -3. **Base fork**: `AppImage/appimage.github.io`, branch: `master` -4. **Head fork**: `YOUR_USERNAME/appimage.github.io`, branch: `add-aquiis-property-management` -5. Click "Create pull request" - -**PR Title:** - -``` -Add Nine Property Management -``` - -**PR Description:** - -```markdown -## Application Details - -**Name:** Nine Property Management -**Category:** Office, Finance -**License:** MIT -**Homepage:** https://github.com/xnodeoncode/nine -**Download:** https://github.com/xnodeoncode/nine/releases/tag/v1.0.0 - -## Description - -Property management software for small landlords managing 1-9 residential rental properties. Provides professional-grade features including: - -- Complete tenant lifecycle management (prospect → application → lease) -- Automated rent invoicing and payment tracking -- Maintenance request tracking with vendor management -- Property inspections with comprehensive checklists -- Security deposit investment tracking -- Multi-user support with role-based access control - -Built with .NET 10, Blazor Server, and ElectronNET. Standalone desktop application with no server or subscription required. - -## Files Included - -- ✅ `aquiis.desktop` - Desktop entry file -- ✅ `aquiis.png` - Application icon (512x512) -- ✅ `com.aquiis.propertymanagement.appdata.xml` - AppStream metadata -- ✅ `screenshot.png` - Primary screenshot (dashboard) - -## Validation - -AppStream metadata validated with `appstreamcli`: -``` - -appstreamcli validate com.aquiis.propertymanagement.appdata.xml - -``` - -## Testing - -AppImage tested on: -- RHEL 10 (development platform) -- Performance: ~2 second startup -- Size: 230MB (normal compression) - -## Contact - -- **GitHub:** @xnodeoncode -- **Email:** cisguru@outlook.com -``` - -6. Click "Create pull request" - -## Step 9: Respond to Review - -AppImageHub maintainers typically review within 1 week. Common feedback: - -- Screenshot quality or content -- Desktop file formatting -- AppStream metadata completeness -- Icon resolution - -**Be responsive:** - -- Check GitHub notifications daily -- Respond within 24-48 hours -- Make requested changes promptly - -## Step 10: Post-Approval - -Once merged: - -1. **Verify listing**: Visit https://appimage.github.io and search for "Nine" -2. **Update README**: Add AppImageHub badge -3. **Monitor feedback**: Watch for user issues on GitHub -4. **Update listing**: Submit new PR for version updates - -## AppImageHub Badges (Post-Approval) - -Add to README.md: - -```markdown -[![Get it on AppImageHub](https://img.shields.io/badge/AppImageHub-Nine%20Property%20Management-blue.svg)](https://appimage.github.io/Nine_Property_Management/) -``` - -## Maintenance - -For future releases: - -1. **Update AppStream metadata** with new `` entry -2. **Update screenshots** if UI changes significantly -3. **Submit new PR** to appimage.github.io with updates -4. **Maintainers prefer**: Incremental updates over large changes - -## Troubleshooting - -### Validation Errors - -```bash -# Common issues -appstreamcli validate --explain com.aquiis.propertymanagement.appdata.xml -``` - -### Screenshot Not Found - -Ensure screenshots are: - -- Committed to main branch -- Accessible via raw GitHub URLs -- Correct filenames in AppStream metadata - -### Desktop File Issues - -```bash -# Validate desktop file -desktop-file-validate aquiis.desktop -``` - -## Resources - -- **AppImageHub**: https://github.com/AppImage/appimage.github.io -- **AppStream Spec**: https://www.freedesktop.org/software/appstream/docs/ -- **Desktop File Spec**: https://specifications.freedesktop.org/desktop-entry-spec/ -- **AppImage Best Practices**: https://docs.appimage.org/ - -## Timeline - -- **Screenshots**: 30 minutes - 1 hour -- **Fork/Clone**: 5 minutes -- **Preparation**: 10 minutes (automated script) -- **PR Creation**: 15 minutes -- **Review Process**: 3-7 days -- **Total**: ~1 week from start to approval - -## Status - -- [ ] Screenshots captured and committed -- [ ] appimage.github.io forked -- [ ] Preparation script executed -- [ ] Files verified and validated -- [ ] Pull request created -- [ ] Review feedback addressed -- [ ] Approved and merged -- [ ] Listing verified on AppImageHub diff --git a/Documentation/Compatibility-Matrix.md b/Documentation/Compatibility-Matrix.md index 61d4098..741507a 100644 --- a/Documentation/Compatibility-Matrix.md +++ b/Documentation/Compatibility-Matrix.md @@ -1,8 +1,8 @@ -# Nine Compatibility Matrix +# Nine. Compatibility Matrix -**Last Updated:** March 1, 2026 -**Current Release: v1.0.0 -**Next Release: v1.1.0 (planned) +**Last Updated:** November 11, 2026 +**Current Release:** v1.2.0 +**Next Release:** v1.2.1 (in development) --- @@ -10,26 +10,35 @@ This matrix tracks version compatibility across Nine releases, enabling you to: -- ✅ **Verify upgrade/downgrade compatibility** - Check if app versions work with your database -- ✅ **Identify component versions** - Know which dependencies are installed -- ✅ **Plan rollbacks safely** - Understand which versions can coexist -- ✅ **Troubleshoot version mismatches** - Diagnose compatibility issues -- ✅ **Track breaking changes** - See when incompatibilities were introduced +- **Verify upgrade/downgrade compatibility** - Check if app versions work with your database +- **Identify component versions** - Know which dependencies are installed +- **Plan rollbacks safely** - Understand which versions can coexist +- **Troubleshoot version mismatches** - Diagnose compatibility issues +- **Track breaking changes** - See when incompatibilities were introduced -**For detailed release information**, see version-specific Release Notes in `Documentation/vX.X.X/`. +**For detailed release information**, see version-specific [Release Notes](#support--resources). --- -## Nine Version History - -| Release Date | App Version | Database Schema | .NET SDK | ElectronNET | Bootstrap | QuestPDF | Migration Required | Breaking Changes | Status | Download | -| ------------ | ----------- | --------------- | -------- | ----------- | --------- | --------- | ------------------ | ---------------- | ------------------ | ------------------------------------------------------------------ | -| TBD | **1.2.0** | v1.2.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | Yes (v1.1.0→1.2.0) | TBD | **In Development** | - | -| 2026-03-01 | 1.1.2 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | **Current** | [Release](https://github.com/xnodeoncode/nine/releases/tag/v1.1.2) | -| 2026-02-28 | 1.1.1 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Previous | [Release](https://github.com/xnodeoncode/nine/releases/tag/v1.1.1) | -| 2026-02-18 | 1.1.0 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | Yes (v1.0.0→1.1.0) | New tables/cols | Superseded | [Release](https://github.com/xnodeoncode/nine/releases/tag/v1.1.0) | -| 2026-01-29 | 1.0.1 | v1.0.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/nine/releases/tag/v1.0.1) | -| 2026-01-28 | 1.0.0 | v1.0.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/nine/releases/tag/v1.0.0) | +## Version History + +| Release Date | Product | App Version | Database Schema | .NET SDK | ElectronNET | Bootstrap | QuestPDF | Migration Required | Breaking Changes | Status | Download | +| ------------ | ------- | ----------- | --------------- | -------- | ----------- | --------- | --------- | -------------------- | ---------------- | ------------- | ---------------------------------------------------------------------- | +| 2026-11-11 | Nine | **1.2.0** | v1.2.0 | 10.0.1 | Core 0.4.1 | 5.3.3 | 2025.12.1 | Yes (v1.1.0→1.2.0) | New tables/cols | **Current** | [Release](https://github.com/xnodeoncode/Nine/releases/tag/v1.2.0) | +| 2026-04-04 | Nine | 1.1.0 | v1.1.0 | 10.0.1 | Core 0.4.1 | 5.3.3 | 2025.12.1 | Auto (EF migrations) | No | Previous | [Release](https://github.com/xnodeoncode/Nine/releases/tag/v1.1.0) | +| 2026-03-17 | Aquiis | 1.1.3 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Latest Aquiis | [Release](https://github.com/xnodeoncode/Aquiis/releases/tag/v1.1.3) | +| 2026-03-11 | Nine | 1.0.0 | v1.0.0 | 10.0.1 | Core 0.4.1 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/Nine/releases/tag/v1.0.0) | +| 2026-03-02 | Aquiis | 1.1.2 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/Aquiis/releases/tag/v1.1.2) | +| 2026-03-01 | Aquiis | 1.1.1 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/Aquiis/releases/tag/v1.1.1.0) | +| 2026-02-19 | Aquiis | 1.1.0 | v1.1.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | Yes (v1.0.0→1.1.0) | New tables/cols | Superseded | [Release](https://github.com/xnodeoncode/Aquiis/releases/tag/v1.1.0) | +| 2026-01-29 | Aquiis | 1.0.1 | v1.0.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/Aquiis/releases/tag/v1.0.1) | +| 2026-01-28 | Aquiis | 1.0.0 | v1.0.0 | 10.0.1 | 23.6.2 | 5.3.3 | 2025.12.1 | No | No | Superseded | [Release](https://github.com/xnodeoncode/Aquiis/releases/tag/v1.0.0) | + +> **Note:** Nine began as a fork of Aquiis at v1.0.0. Releases listed under the **Product** column as Aquiis were published in the +> [Aquiis repository](https://github.com/xnodeoncode/Aquiis). Check the +> **Database Schema** column when importing data from an Aquiis version into Nine, because the schemas differ between versions. +> Schema versions follow the application's MAJOR.MINOR version (`MAJOR.MINOR.0`), and patch releases never change the schema, +> so app v1.1.x always uses schema v1.1.0. ## Professional Version History @@ -59,26 +68,26 @@ This matrix tracks version compatibility across Nine releases, enabling you to: ### Desktop Integration -| Component | Current Version | Purpose | Upgrade Notes | -| -------------------- | --------------- | ----------------- | ---------------------------------------------------------------- | -| **ElectronNET.API** | 23.6.2 | Desktop framework | Major version changes may require electron.manifest.json updates | -| **electron-builder** | 26.4.0 | Build/packaging | Controls AppImage/exe generation | +| Component | Current Version | Purpose | Upgrade Notes | +| ----------------------- | --------------- | ----------------- | -------------------------------------------------------------------------------------------------------- | +| **ElectronNET Core** | 0.4.1 | Desktop framework | Major version changes may require electron.manifest.json updates | +| ~~**ElectronNET.API**~~ | 23.6.2 | Desktop framework | (deprecated - used in earlier releases) Major version changes may require electron.manifest.json updates | +| **electron-builder** | 26.4.0 | Build/packaging | Controls AppImage/exe generation | ### Database & Storage -| Component | Current Version | Purpose | Upgrade Notes | -| ------------------- | --------------------- | --------------- | ---------------------------------------------- | -| **SQLite** | 3.46.0 | Database engine | Via Microsoft.Data.Sqlite | -| **EF Core** | 10.0.1 | ORM | Breaking changes uncommon in minor versions | -| **Database Schema** | v1.0.0 (Nine) | Data structure | Tracks with app version MAJOR.MINOR milestones | -| | v0.0.0 (Professional) | Data structure | Pre-v1.0.0 rapid iteration phase | +| Component | Current Version | Purpose | Upgrade Notes | +| ------------------- | --------------- | --------------- | ---------------------------------------------- | +| **SQLite** | 3.46.0 | Database engine | Via Microsoft.Data.Sqlite | +| **EF Core** | 10.0.1 | ORM | Breaking changes uncommon in minor versions | +| **Database Schema** | v1.2.0 (Nine) | Data structure | Tracks with app version MAJOR.MINOR milestones | ### UI & Front-end | Component | Current Version | Purpose | Upgrade Notes | | ------------------------- | --------------- | ------------- | ----------------------------- | -| **Bootstrap** | 5.3.3 | CSS framework | Generally backward compatible | -| **Bootstrap Icons** | 1.11.3 | Icon font | Additive changes only | +| **Bootstrap** | 5.3.8 | CSS framework | Generally backward compatible | +| **Bootstrap Icons** | 1.13.1 | Icon font | Additive changes only | | **Material Design Icons** | 7.4.47 | Icon font | Additive changes only | ### Document Generation @@ -87,24 +96,23 @@ This matrix tracks version compatibility across Nine releases, enabling you to: | ------------ | --------------- | -------------- | -------------------------------------------------- | | **QuestPDF** | 2025.12.1 | PDF generation | Annual major versions, breaking changes documented | -### External Services (Optional) - -| Component | Current Version | Purpose | Upgrade Notes | -| ------------ | --------------- | -------------- | -------------------------------------------------- | -| **SendGrid** | 9.29.3 | Email delivery | API key required for email notifications | -| **Twilio** | 7.14.0 | SMS delivery | Account credentials required for SMS notifications | - --- ## Database Schema Versioning **Current Schema:** -- **Nine:** v1.1.0 (current) +- **Nine:** v1.2.0 (current) - **Professional:** v0.0.0 (pre-release) ### Schema Version Strategy +- **v1.2.0** (Nine) + - Added tables for tracking property expenses + - Added columns to support data archiving + - Modified/removed columns to support updates to lease management + - Database filename: `app_v1.2.0.db` + - **v1.1.0** (Nine): Database encryption and sample data features - Added DatabaseSettings table for encryption state tracking - Added IsSampleData column to all entities (30+ tables) @@ -128,18 +136,18 @@ This matrix tracks version compatibility across Nine releases, enabling you to: #### Schema Change Classification -| Change Type | Version | DB File Changes | EF Compatible | Notes | -| ---------------------------------------------------- | ------- | --------------- | ------------- | ------------------------------------------------------------------------------------------------- | -| Add nullable column | PATCH | No | ✅ Yes | Existing rows get NULL automatically | -| Add new table | PATCH | No | ✅ Yes | No impact on existing data | -| Add new index | PATCH | No | ✅ Yes | No impact on existing data | -| Remove column (unused/obsolete) | MINOR | Yes | ✅ Yes | EF generates `DropColumn`; data lost | -| Remove table | MINOR | Yes | ✅ Yes | EF generates `DropTable`; data lost | -| Add non-nullable column with default/backfill | MINOR | Yes | ✅ Yes | EF adds column + default; migration review required | -| Rename column or table | MAJOR | Yes | ⚠️ Partial | EF generates drop+add (data loss); must hand-edit migration to use `RenameColumn` / `RenameTable` | -| Change column type (compatible, e.g. int → bigint) | MAJOR | Yes | ✅ Yes | EF generates `AlterColumn`; verify data integrity | -| Change column type (incompatible, e.g. string → int) | MAJOR | Yes | ❌ No | EF cannot convert data; manual migration script needed | -| Restructure relationship or foreign key | MAJOR | Yes | ⚠️ Partial | May require data migration depending on cardinality | +| Change Type | Version | DB File Changes | EF Compatible | Notes | +| ---------------------------------------------------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | +| Add nullable column | PATCH | No | Yes | Existing rows get NULL automatically | +| Add new table | PATCH | No | Yes | No impact on existing data | +| Add new index | PATCH | No | Yes | No impact on existing data | +| Remove column (unused/obsolete) | MINOR | Yes | Yes | EF generates `DropColumn`; data lost | +| Remove table | MINOR | Yes | Yes | EF generates `DropTable`; data lost | +| Add non-nullable column with default/backfill | MINOR | Yes | Yes | EF adds column + default; migration review required | +| Rename column or table | MAJOR | Yes | Partial | EF generates drop+add (data loss); must hand-edit migration to use `RenameColumn` / `RenameTable` | +| Change column type (compatible, e.g. int → bigint) | MAJOR | Yes | Yes | EF generates `AlterColumn`; verify data integrity | +| Change column type (incompatible, e.g. string → int) | MAJOR | Yes | No | EF cannot convert data; manual migration script needed | +| Restructure relationship or foreign key | MAJOR | Yes | Partial | May require data migration depending on cardinality | > **Rollback note:** PATCH releases share the same DB file across all patch versions. Rolling back from v1.0.3 → v1.0.1 leaves any patch-added columns in place. SQLite ignores unknown columns on reads and leaves them NULL on writes — safe but unsupported. @@ -149,30 +157,32 @@ This matrix tracks version compatibility across Nine releases, enabling you to: ### Rollback Safety -| From Version | To Version | Database Compatible | Safe Rollback | Notes | -| ------------ | ---------- | -------------------- | ------------- | ------------------------------------- | -| v1.1.0 | v1.0.1 | ❌ No (v1.1.0→1.0.0) | ❌ No | v1.0.1 missing DatabaseSettings table | -| v1.0.1 | v1.0.0 | ✅ Yes (v1.0.0) | ✅ Yes | Drop-in replacement | -| v1.1.0 | v1.0.0 | ❌ No (v1.1.0→1.0.0) | ❌ No | v1.0.0 missing DatabaseSettings table | +| From Version | To Version | Database Compatible | Safe Rollback | Notes | +| ------------ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------- | +| v1.1.0 | v1.0.1 | No (v1.1.0→1.0.0) | No | v1.0.1 missing DatabaseSettings table | +| v1.0.1 | v1.0.0 | Yes (v1.0.0) | Yes | Drop-in replacement | +| v1.1.0 | v1.0.0 | No (v1.1.0→1.0.0) | No | v1.0.0 missing DatabaseSettings table | ### Upgrade Compatibility -| From Version | To Version | Migration Type | Breaking Changes | Notes | -| ------------ | ---------- | -------------- | ---------------- | ------------------------------------------------ | -| v1.0.1 | v1.1.0 | Automatic | Schema v1.1.0 | New DatabaseSettings table, IsSampleData columns | -| v1.0.0 | v1.0.1 | None | No | Drop-in replacement | -| v0.3.0 | v0.3.1 | Automatic | Database path | Same migration as Nine | -| v1.x.x | v2.0.0 | Automatic | Schema changes | Future: Major version, backup enforced | +| From Version | To Version | Migration Type | Breaking Changes | Notes | +| ------------ | ---------- | -------------- | ---------------- | ---------------------------------------------------- | +| v1.1.0 | v1.2.0 | Automatic | Schema v1.2.0 | New tables, new columns, dropped columns and indexes | +| v1.0.1 | v1.1.0 | Automatic | Schema v1.1.0 | New DatabaseSettings table, IsSampleData columns | +| v1.0.0 | v1.0.1 | None | No | Drop-in replacement | +| v0.3.0 | v0.3.1 | Automatic | Database path | Same migration as Nine | +| v1.x.x | v2.0.0 | Automatic | Schema changes | Future: Major version, backup enforced | --- ## Breaking Changes Summary -| Version | Breaking Changes | Impact | Migration Strategy | -| ------- | ---------------------- | ----------------------- | ----------------------- | -| v1.1.0 | Schema v1.1.0 required | Cannot run on v1.0.0 DB | Automatic EF migrations | -| v1.0.1 | None | Backward compatible | Drop-in replacement | -| v1.0.0 | Org structure | Pre-release users only | Manual migration | +| Version | Breaking Changes | Impact | Migration Strategy | +| ------- | ---------------------- | ----------------------------------------------------- | ----------------------- | +| v1.2.0 | Schema v1.2.0 required | Application version v1.1.0 cannot run on db v1.2.0 DB | Automatic EF migrations | +| v1.1.0 | Schema v1.1.0 required | Application version v1.1.0 cannot run on db v1.0.0 DB | Automatic EF migrations | +| v1.0.1 | None | Backward compatible | Drop-in replacement | +| v1.0.0 | Org structure | Pre-release users only | Manual migration | **For detailed migration procedures**, see version-specific Release Notes. @@ -180,11 +190,11 @@ This matrix tracks version compatibility across Nine releases, enabling you to: ## Platform Support -| Platform | v1.0.0 | v1.0.1 | v1.1.0 | Notes | -| ----------------------- | ------ | ------ | ------ | ----------------------------------- | -| **Linux (AppImage)** | ✅ | ✅ | ✅ | Ubuntu 20.04+, Debian 11+ tested | -| **Windows 10/11 (x64)** | ✅ | ✅ | ✅ | Portable exe, no installer required | -| **macOS** | ❌ | ❌ | ❌ | Planned for v1.2.0+ | +| Platform | v1.0.0 | v1.0.1 | v1.1.0 | v1.2.0 | Notes | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | +| **Linux (AppImage)** | Yes | Yes | Yes | Yes | Red Hat Enterprise Linux 10 (RHEL 10) tested | +| **Windows 10/11 (x64)** | Yes | Yes | Yes | Yes | Portable exe, Windows Installer, Windows 11 tested | +| **macOS** | No | No | No | No | Currently not supported | --- @@ -192,28 +202,27 @@ This matrix tracks version compatibility across Nine releases, enabling you to: ### Minimum -- **OS:** Linux (Ubuntu 20.04+) or Windows 10 (64-bit) -- **CPU:** 2-core, 1.5 GHz -- **RAM:** 2 GB -- **Disk:** 500 MB (application + data) +- **OS:** Linux (RHEL 10 tested) or Windows 11 (64-bit) +- **CPU:** 4-core, 2.5 GHz +- **RAM:** 8 GB +- **Disk:** 2G MB (application + data) ### Recommended - **CPU:** 4-core, 2.5 GHz -- **RAM:** 4 GB -- **Disk:** 1 GB +- **RAM:** 16 GB +- **Disk:** 4 GB - **Display:** 1920x1080 --- ## Database Schema Compatibility -| App Version | Database Schema | Database File | Forward Compatible | Backward Compatible | Notes | -| ----------- | --------------- | ------------- | ------------------ | ------------------- | ------------------------------- | -| v1.1.0 | v1.1.0 | app_v1.1.0.db | No | No | Requires DatabaseSettings table | -| v1.0.1 | v1.0.0 | app_v1.0.0.db | Yes | Yes | Path: ~/.config/Electron/ | -| v1.0.0 | v1.0.0 | app_v1.0.0.db | Yes | Yes | Path: ~/.config/Electron/ | -| v0.3.0 | v0.0.0 | app_v0.0.0.db | No | No | Pre-release, rapid iteration | +| App Version | Database Schema | Database File | Forward Compatible | Backward Compatible | Notes | +| ----------- | --------------- | ------------- | ------------------- | ------------------- | ----------------------------------------------------------------- | +| v1.2.0 | v1.2.0 | app_v1.2.0.db | Yes (auto-migrated) | No | Path: Linux - ~/.config/Nine/, Windows - ~\APPDATA\Roaming\Nine\ | +| v1.1.0 | v1.1.0 | app_v1.1.0.db | Yes (auto-migrated) | No | Path: Linux - ~/.config/Nine/, Windows - ~\APPDATA\Roaming\Nine\ | +| v1.0.0 | v1.0.0 | app_v1.0.0.db | Yes (auto-migrated) | NO | Path: Linux - ~/.config/Nine/, Windows - ~\APPDATA\Roaming\Nine\ | **Key:** @@ -222,48 +231,42 @@ This matrix tracks version compatibility across Nine releases, enabling you to: --- -## Known Limitations +## Known Limitations (\* Limits enforced by design) -| Limitation | All Versions | Reason | -| ---------------------- | ---------------------- | ---------------------------- | -| **Maximum Properties** | 9 (Nine) | Simple Start tier constraint | -| **Maximum Users** | 3 (1 system + 3 login) | Simplified access control | -| **Organizations** | 1 | Desktop application scope | -| **File Upload Size** | 10 MB per file | Performance management | -| **SQLite Concurrency** | Single writer | SQLite WAL mode limitation | +| Limitation | All Versions | Reason | +| ------------------------- | ---------------------- | ---------------------------- | +| **Maximum Properties** \* | 9 (Nine) | Simple Start tier constraint | +| **Maximum Users** \* | 4 (1 system + 3 login) | Simplified access control | +| **Organizations** \* | 1 | Desktop application scope | +| **File Upload Size** \* | 10 MB per file | Performance management | +| **SQLite Concurrency** | Single writer | SQLite WAL mode limitation | --- ## Third-Party Licenses -| Component | License Type | Eligibility Notes | -| ------------- | --------------------- | ------------------------------------------------------------------ | -| **QuestPDF** | Community (Free) | Free for <$1M revenue, individuals, non-profits, FOSS. Honor-based | -| **.NET** | MIT | Open source, commercial use allowed | -| **Bootstrap** | MIT | Open source, commercial use allowed | -| **Electron** | MIT | Open source, commercial use allowed | -| **SendGrid** | Commercial (Optional) | Requires API key and account | -| **Twilio** | Commercial (Optional) | Requires credentials and account | - -**QuestPDF Community License**: Nine (max 9 properties) qualifies as most users will be under $1M annual revenue. Professional edition users must verify eligibility. +| Component | License Type | Eligibility Notes | +| ------------- | ---------------- | ------------------------------------------------------------------ | +| **QuestPDF** | Community (Free) | Free for <$1M revenue, individuals, non-profits, FOSS. Honor-based | +| **.NET** | MIT | Open source, commercial use allowed | +| **Bootstrap** | MIT | Open source, commercial use allowed | +| **Electron** | MIT | Open source, commercial use allowed | --- ## Support & Resources -### Detailed Release Information +### Release Notes -- **v1.1.0:** [Release Notes](v1.1.0/v1.1.0-Release-Notes.md) - What's new, migration procedures, testing -- **v1.0.1:** [Release Notes](v1.0.1/v1.0.1-Release-Notes.md) - Bug fixes and improvements -- **v1.0.0:** [Release Notes](v1.0.0/v1.0.0-Release-Notes.md) - Initial production release +- **v1.2.0:** [Release Notes](https://github.com/xnodeoncode/Nine/releases/tag/v1.2.0) +- **v1.1.0:** [Release Notes](https://github.com/xnodeoncode/Nine/releases/tag/v1.1.0) +- **v1.0.0:** [Release Notes](https://github.com/xnodeoncode/Nine/releases/tag/v1.0.0) ### Getting Help -- 📧 **Email:** cisguru@outlook.com -- 🐛 **Bug Reports:** [GitHub Issues](https://github.com/xnodeoncode/nine/issues) -- 💡 **Feature Requests:** [GitHub Discussions](https://github.com/xnodeoncode/nine/discussions) -- 📖 **Documentation:** [/Documentation/](https://github.com/xnodeoncode/nine/tree/main/Documentation) -- 🏛️ **Roadmap:** [/Documentation/Roadmap/](https://github.com/xnodeoncode/nine/tree/main/Documentation/Roadmap) +- **Email:** [cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20Compatibility%20Matrix) +- **Bug Reports:** [GitHub Issues](https://github.com/xnodeoncode/Nine/issues) +- **Documentation:** [/Documentation/](https://github.com/xnodeoncode/Nine/tree/main/Documentation) --- @@ -271,6 +274,7 @@ This matrix tracks version compatibility across Nine releases, enabling you to: | Date | Change | Updated By | | ---------- | --------------------------------- | ------------ | +| 2026-11-11 | Updated added v1.2.0 information | Release Team | | 2026-02-01 | Refocused as Compatibility Matrix | Release Team | | 2026-02-01 | Added v1.1.0 compatibility info | Release Team | | 2026-01-29 | Added v1.0.1 entry | Release Team | @@ -279,4 +283,4 @@ This matrix tracks version compatibility across Nine releases, enabling you to: --- **Maintained by:** Nine Development Team -**Document Version:** 2.0 - Compatibility Matrix +**Document Version:** 1.2.0 (version aligned with release version) - Compatibility Matrix diff --git a/Documentation/Database-Era-Migration-Plan.md b/Documentation/Database-Era-Migration-Plan.md deleted file mode 100644 index fa486a6..0000000 --- a/Documentation/Database-Era-Migration-Plan.md +++ /dev/null @@ -1,431 +0,0 @@ -# Database Era Migration Plan - -**Feature Branch:** `app-database-upgrade` -**Target Release:** v1.1.0 -**Author:** CIS Guru -**Created:** March 25, 2026 -**Status:** In Progress - ---- - -## 1. Problem Statement - -Nine v1.1.0 ships with a squashed migration history from its predecessor, Aquiis. The squash replaced the original incremental migration chain (starting with `20260106195859_InitialCreate`) with a clean baseline (`20260128153724_v1_0_0_InitialCreate`). All Aquiis releases (v0.3.0, v1.0.0, v1.1.0) still contain the orginal marker ID in `__EFMigrationsHistory`. When EF Core's `MigrateAsync` runs against such a database, it cannot reconcile the history with the current migration chain and crashes. - -Note on version number overlap: both Aquiis and Nine released a `v1.0.0`, but they are different products on different migration chains. An Aquiis `app_v1.0.0.db` is a pre-squash era database. A Nine `app_v1.0.0.db` is a current-era database. The bridge detects by migration ID content, never by filename. - -A secondary problem: the pre-squash schema is missing five migrations added between January 28 and March 13, 2026. Without these, the current application code will fail on startup (wrong indexes, missing columns, wrong column names). - ---- - -## 2. Scope - -### Feature Scope - -The bridge is implemented in `DatabaseService.cs` — pure .NET code with no platform-specific dependencies. It runs identically on all platforms. - -| In Scope | Out of Scope | -| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| All Aquiis release databases: v0.3.0, v1.0.0, v1.1.0 | Nine databases (current era — bridge is a no-op by design) | -| All platforms: Linux, Windows, macOS | Encrypted (SQLCipher) databases — supported (bridge opens via EF pipeline; `SqlCipherConnectionInterceptor` applies `PRAGMA key` before any bridge SQL runs) | -| Single-SQLite-file deployments (business + identity in one file) | Manual migration tooling | -| Automated bridge on app startup | | - -### Test Coverage (this branch) - -All manual test runs in this branch are on **Linux AppImage only**. The bridge will fire on Windows and macOS in exactly the same way — there is no platform-specific code path — but those scenarios have not been exercised yet. - -| Platform | Tested Here | Notes | -| ---------------- | ----------- | ---------------------- | -| Linux (AppImage) | ✅ | All tests 1–6 | -| Windows | ❌ | Future branch / CI run | -| macOS | ❌ | Future branch / CI run | - ---- - -## 3. Era Definitions - -`DetectEraAsync()` in `DatabaseService.cs` returns one of the following `Era` enum values by inspecting the three known marker IDs in `__EFMigrationsHistory`: - -| `Era` value | Constant | Marker Migration ID | Era Range | Description | -| ---------------- | ---------------------- | ------------------------------------- | ------------------------------------------- | -------------------------------------------------- | -| `Fresh` | — | _(no history table, or table empty)_ | New install | No migrations run yet | -| `Current` | `CurrentEraMarker` | `20260128153724_v1_0_0_InitialCreate` | Nine ≥ v1.0.0 | Squashed baseline — no bridge needed | -| `FirstAncestor` | `FirstAncestorMarker` | `20260106195859_InitialCreate` | All Aquiis releases: v0.3.0, v1.0.0, v1.1.0 | Original incremental chain — bridge required | -| `SecondAncestor` | `SecondAncestorMarker` | _(empty — TODO at next major squash)_ | Not yet defined | Placeholder — bridge method not yet populated | -| `NotSupported` | — | _(history exists, no known marker)_ | > 2 generations behind, or foreign/corrupt | DB backed up; `SchemaNotSupportedException` thrown | - -**Detection logic (`DetectEraAsync`):** - -1. No `__EFMigrationsHistory` table, or table is empty → `Era.Fresh` -2. `SecondAncestorMarker` present (and non-empty) → `Era.SecondAncestor` -3. `FirstAncestorMarker` present → `Era.FirstAncestor` -4. `CurrentEraMarker` present → `Era.Current` -5. History rows exist but no known marker found → `Era.NotSupported` - -**Support policy:** Nine supports the current era plus two generations back. `Era.NotSupported` triggers a database backup followed by `DatabaseExceptions.SchemaNotSupportedException`, directing the user to the import workflow. - -**Updating markers at each major squash:** - -- `CurrentEraMarker` → first migration ID of the new chain -- `FirstAncestorMarker` → previous `CurrentEraMarker` -- `SecondAncestorMarker` → previous `FirstAncestorMarker` -- `ApplyFirstAncestorBridgeAsync()` → new bridge SQL -- `ApplySecondAncestorBridgeAsync()` → previous `ApplyFirstAncestorBridgeAsync()` SQL - ---- - -## 4. Pre-Squash Schema State (Aquiis Era) - -Schema confirmed by inspecting `~/.config/Nine/Backups/app_v0.3.0.db` (Aquiis v0.3.0, 946,176 bytes, 43 tables). Aquiis v1.0.0 and v1.1.0 databases carry the same four migration IDs and the same five missing migrations — the pre-squash chain was never updated after the squash occurred. Nine began at v1.0.0 with the squashed baseline already in place. - -### Migration history (all Aquiis releases: v0.3.0, v1.0.0, v1.1.0) - -| MigrationId | ProductVersion | -| ------------------------------------- | -------------- | -| `20260106195859_InitialCreate` | 10.0.1 | -| `20260128153724_v1_0_0_InitialCreate` | 10.0.1 | -| `20260201231400_AddDatabaseSettings` | 10.0.1 | -| `20260201234216_AddEncryptionSalt` | 10.0.1 | - -### Missing migrations (not yet applied) - -| MigrationId | Applied | -| ----------------------------------------------------- | ------- | -| `20260209120000_FixInvoicePaymentUniqueIndexes` | ❌ | -| `20260212163628_AddIsSampleDataFlag` | ❌ | -| `20260212165047_UpdateExistingSampleDataFlag` | ❌ | -| `20260216205819_ConsolidateOrganizationIdToBaseModel` | ❌ | -| `20260313122831_RenameIsAvailableToIsActive` | ❌ | - -### Key schema differences vs current - -| Table | Column / Index | v0.3.0 state | Current state | -| --------------------- | -------------------------------- | -------------------- | --------------------------------------- | -| `Properties` | `IsAvailable` column | Present | Renamed to `IsActive` | -| `Invoices` | `IX_Invoices_InvoiceNumber` | Single-column UNIQUE | Dropped | -| `Invoices` | `IX_Invoice_OrgId_InvoiceNumber` | Missing | Composite UNIQUE (OrgId, InvoiceNumber) | -| `Invoices` | `IX_Invoices_OrganizationId` | Present | Dropped | -| `Payments` | `IX_Payments_OrganizationId` | Present | Dropped | -| `Payments` | `IX_Payment_OrgId_PaymentNumber` | Missing | Composite UNIQUE (OrgId, PaymentNumber) | -| All ~25 entity tables | `IsSampleData` column | Missing | `INTEGER NOT NULL DEFAULT 0` | - ---- - -## 5. Bridge Implementation - -### 5.1 Location - -``` -2-Nine.Application/Services/DatabaseService.cs - └─ DetectEraAsync() (private) — returns Era enum value - └─ ApplyFirstAncestorBridgeAsync() (private) — Aquiis → Nine v1.x bridge - └─ ApplySecondAncestorBridgeAsync() (private) — placeholder; populate at next squash - └─ BackupUnsupportedDatabaseAsync() (private) — copies DB before NotSupported throw - └─ InitializeAsync() (public) — orchestrates detection, bridging, MigrateAsync - -0-Nine.Core/Exceptions/DatabaseExceptions.cs - └─ DatabaseExceptions.SchemaNotSupportedException — era outside support window; carries BackupPath - └─ DatabaseExceptions.SchemaInvalidException — schema unrecognisable or corrupt - └─ DatabaseExceptions.MigrationException — bridge step failure -``` - -### 5.2 Startup Call Sequence - -``` -InitializeAsync() - │ - ├─ CloseConnection() + ClearAllPools() - │ - ├─ OpenConnectionAsync() (via EF — SqlCipherConnectionInterceptor fires, PRAGMA key applied) - ├─ DetectEraAsync() ← ERA DETECTION - │ ├─ Queries __EFMigrationsHistory for three marker IDs - │ └─ Returns Era enum value - ├─ CloseConnection() + ClearAllPools() - │ - ├─ switch (era) - │ ├─ Era.NotSupported - │ │ ├─ BackupUnsupportedDatabaseAsync() — copies DB file to Backups/ folder - │ │ └─ throw SchemaNotSupportedException(backupPath) - │ │ - │ ├─ Era.SecondAncestor - │ │ └─ ApplySecondAncestorBridgeAsync() ← ERA BRIDGE (placeholder) - │ │ ├─ OpenConnectionAsync() (via EF) - │ │ ├─ BEGIN TRANSACTION - │ │ │ └─ (TODO: bridge SQL at next squash) - │ │ ├─ COMMIT (or ROLLBACK on error) - │ │ └─ CloseConnection() - │ │ - │ ├─ Era.FirstAncestor - │ │ └─ ApplyFirstAncestorBridgeAsync() ← ERA BRIDGE - │ │ ├─ OpenConnectionAsync() (via EF) - │ │ ├─ BEGIN TRANSACTION - │ │ │ ├─ Repair migration history (remove previous-era marker, add identity baseline) - │ │ │ ├─ Fix Invoice/Payment indexes - │ │ │ ├─ Add IsSampleData column to ~25 tables - │ │ │ ├─ Tag existing system-seeded rows (CreatedBy = SystemUser GUID) - │ │ │ ├─ Rename Properties.IsAvailable → IsActive - │ │ │ └─ INSERT 5 missing migration IDs into __EFMigrationsHistory - │ │ ├─ COMMIT (or ROLLBACK on any error — database left intact for retry) - │ │ └─ CloseConnection() - │ │ - │ └─ Era.Fresh / Era.Current → no-op - │ - ├─ ClearAllPools() - │ - ├─ _identityContext.MigrateAsync() (0 pending — history already correct) - │ - ├─ CloseConnection() + ClearAllPools() - │ - └─ _businessContext.MigrateAsync() (any migrations added after bridge point) -``` - -### 5.3 Bridge SQL Steps - -**Step 1 — Repair migration history** - -```sql -DELETE FROM "__EFMigrationsHistory" - WHERE "MigrationId" = '20260106195859_InitialCreate'; - -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20260104205913_InitialCreate', '10.0.1'); -``` - -_Rationale:_ The pre-squash marker is removed. The current-era identity InitialCreate is registered so EF sees zero pending identity migrations (the identity tables already exist in the file). - -**Step 2 — Fix Invoice/Payment indexes** _(migration: FixInvoicePaymentUniqueIndexes)_ - -```sql -DROP INDEX IF EXISTS "IX_Invoices_InvoiceNumber"; -DROP INDEX IF EXISTS "IX_Invoices_OrganizationId"; -DROP INDEX IF EXISTS "IX_Payments_OrganizationId"; -CREATE UNIQUE INDEX "IX_Invoice_OrgId_InvoiceNumber" - ON "Invoices" ("OrganizationId", "InvoiceNumber"); -CREATE UNIQUE INDEX "IX_Payment_OrgId_PaymentNumber" - ON "Payments" ("OrganizationId", "PaymentNumber"); -``` - -_Rationale:_ The v0.3.0 single-column `IX_Invoices_InvoiceNumber` unique constraint is per-database, not per-organisation. In a multi-tenant environment this would prevent two organisations from both using invoice number `INV-001`. The composite indexes enforce uniqueness within an organisation only. - -**Step 3 — Add IsSampleData column** _(migration: AddIsSampleDataFlag)_ - -```sql -ALTER TABLE "" ADD COLUMN "IsSampleData" INTEGER NOT NULL DEFAULT 0; -``` - -Applied to 31 tables: `ApplicationScreenings`, `CalendarEvents`, `CalendarSettings`, `ChecklistItems`, `Checklists`, `ChecklistTemplateItems`, `ChecklistTemplates`, `Documents`, `Inspections`, `Invoices`, `LeaseOffers`, `Leases`, `MaintenanceRequests`, `Notes`, `NotificationPreferences`, `Notifications`, `OrganizationEmailSettings`, `OrganizationSettings`, `OrganizationSMSSettings`, `Payments`, `Properties`, `ProspectiveTenants`, `RentalApplications`, `Repairs`, `SecurityDepositDividends`, `SecurityDepositInvestmentPools`, `SecurityDeposits`, `Tenants`, `Tours`, `UserProfiles`, `WorkflowAuditLogs`. - -_Rationale:_ Allows the UI to filter out system seed/demo data from user-entered records. All pre-existing rows default to `0` (real data) — the next step overrides system-seeded rows. - -**Step 4 — Tag system-seeded rows** _(migration: UpdateExistingSampleDataFlag)_ - -```sql -UPDATE "" SET "IsSampleData" = 1 - WHERE "CreatedBy" = '00000000-0000-0000-0000-000000000001'; -``` - -Applied to: `Properties`, `Tenants`, `Leases`, `Invoices`, `Payments`. - -_Rationale:_ The SystemUser GUID (`00000000-0000-0000-0000-000000000001`) is the seeder identity. Any row it created is demo/sample data. - -**Step 5 — ConsolidateOrganizationIdToBaseModel** _(no-op)_ - -No DDL required. This migration was a code-only refactor (moved `OrganizationId` from child entities into `BaseModel`). The column already existed on all relevant tables. - -**Step 6 — Rename IsAvailable → IsActive** _(migration: RenameIsAvailableToIsActive)_ - -```sql -ALTER TABLE "Properties" RENAME COLUMN "IsAvailable" TO "IsActive"; -``` - -_Rationale:_ `IsAvailable` was renamed to `IsActive` to align with the `Property.IsActive` property name used throughout the codebase and to avoid confusion with the `Property.Status` workflow field (`ApplicationConstants.PropertyStatuses.Available`). - -**Step 7 — Record applied migrations** - -```sql -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20260212163628_AddIsSampleDataFlag', '10.0.1'); -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20260212165047_UpdateExistingSampleDataFlag', '10.0.1'); -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20260216205819_ConsolidateOrganizationIdToBaseModel', '10.0.1'); -INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20260313122831_RenameIsAvailableToIsActive', '10.0.1'); -``` - -After the bridge completes, `__EFMigrationsHistory` contains all current-era IDs. `MigrateAsync` will find 0 pending migrations across both contexts and proceed without schema changes. - -### 5.4 Transaction Safety - -The entire bridge executes inside a single `DbConnection.BeginTransaction()`. If any SQL statement fails, `transaction.Rollback()` is called in the `catch` block, leaving the database in exactly its original state. The next application startup will re-detect the pre-squash marker and retry the bridge from scratch. - -The bridge never partially updates the database. - ---- - -## 6. Feature Impact - -### Modified Files - -| File | Change Type | Purpose | -| ------------------------------------------------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `2-Nine.Application/Services/DatabaseService.cs` | Added methods, modified method | `DetectEraAsync()`, `ApplyFirstAncestorBridgeAsync()`, `ApplySecondAncestorBridgeAsync()`, `BackupUnsupportedDatabaseAsync()` + updated `InitializeAsync()` | -| `0-Nine.Core/Exceptions/DatabaseExceptions.cs` | New file | `SchemaNotSupportedException`, `SchemaInvalidException`, `MigrationException` | -| `0-Nine.Core/Entities/Property.cs` | Property rename | `IsAvailable` → `IsActive` | -| `2-Nine.Application/Services/LeaseService.cs` | Reference update | `IsAvailable` → `IsActive` | -| `2-Nine.Application/Services/PropertyService.cs` | Reference update | `IsAvailable` → `IsActive` | -| `2-Nine.Application/Services/PropertyManagementService.cs` | Reference update | `IsAvailable` → `IsActive` | -| `2-Nine.Application/Services/SampleDataWorkflowService.cs` | Reference update | `IsAvailable` → `IsActive` | -| `1-Nine.Infrastructure/Data/Migrations/20260313122831_RenameIsAvailableToIsActive.cs` | New file | EF migration for current-era DB files | -| `1-Nine.Infrastructure/Data/Migrations/ApplicationDbContextModelSnapshot.cs` | Updated | Reflects `IsActive` column name | -| `4-Nine/appsettings.json` | Config fix | Version/SchemaVersion/DatabaseFileName alignment | - -### Deleted Files - -| File | Reason | -| ---------------------------------------------------- | ------------------------------------------------------- | -| `0-Nine.Core/Entities/DatabaseEraResult.cs` | Dead code — era concept replaced by inline bridge logic | -| `1-Nine.Infrastructure/Services/DatabaseEraState.cs` | Dead code — same reason | - -### Interface Changes - -| Interface | Change | -| ------------------ | ----------------------------------------------------------------- | -| `IDatabaseService` | Removed `CheckEraAsync()` — no longer part of the public contract | - -### Feature Behaviours Changed - -| Feature | Before | After | -| --------------------- | ------------------------------------- | ---------------------------------------- | -| Property availability | `Property.IsAvailable` boolean | `Property.IsActive` boolean | -| Invoice uniqueness | Per-database unique invoice numbers | Per-organisation unique invoice numbers | -| Payment uniqueness | No uniqueness constraint | Per-organisation unique payment numbers | -| Sample data filtering | Not possible | `IsSampleData` flag on all entity tables | -| Pre-squash DB startup | Crash (EF migration history mismatch) | Automatic bridge, then normal startup | - ---- - -## 7. Testing Plan - -### Test Matrix - -| # | Test | Database State | Expected Result | -| --- | -------------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------- | -| 1 | Pre-squash fast-fail guard | Any Aquiis DB without bridge code | App refuses to start with clear error ✅ Done | -| 2 | Nine v1.0.0 → v1.1.0 upgrade | Nine `app_v1.0.0.db` present, `app_v1.1.0.db` absent | File copied, EF migrations applied, app starts ✅ Done | -| 3 | Nine v1.1.0 same-version restart | Nine `app_v1.1.0.db` present, 0 pending migrations | App starts immediately, no migration work ✅ Done | -| 4a | Aquiis v0.3.0 → Nine v1.1.0 era bridge | Aquiis `app_v0.3.0.db` placed as `app_v1.1.0.db` | Bridge fires, all DDL applied, app fully functional 🔴 Pending | -| 4b | Aquiis v1.0.0 → Nine v1.1.0 era bridge | Aquiis `app_v1.0.0.db` picked up by version-skip scan, copied to `app_v1.1.0.db` | Bridge fires, all DDL applied, app fully functional 🔴 Pending | -| 4c | Aquiis v1.1.0 → Nine v1.1.0 era bridge | Aquiis `app_v1.1.0.db` already in place (no copy needed) | Bridge fires, all DDL applied, app fully functional 🔴 Pending | -| 5 | Fresh install | No `.db` file present | EF creates blank DB, seed data applied 🔴 Pending | -| 6 | Same-version restart (post-bridge) | `app_v1.1.0.db` previously bridged | Bridge guard returns early, 0 migrations, fast start 🔴 Pending | - -### Test 4 Setup (Aquiis Era Bridge) - -Run once for each Aquiis source database. The verification checklist is identical for all three. - -**Test 4a — Aquiis v0.3.0 source:** - -```bash -mv ~/.config/Nine/Data/app_v1.1.0.db ~/.config/Nine/Data/app_v1.1.0.db.bak 2>/dev/null || true -cp ~/.config/Nine/Backups/app_v0.3.0.db ~/.config/Nine/Data/app_v1.1.0.db -cd /home/cisguru/Source/Nine/4-Nine && dotnet run --unpacked -``` - -**Test 4b — Aquiis v1.0.0 source** (version-skip scan path — Aquiis `app_v1.0.0.db`, no `app_v1.1.0.db`): - -```bash -mv ~/.config/Nine/Data/app_v1.1.0.db ~/.config/Nine/Data/app_v1.1.0.db.bak 2>/dev/null || true -cp ~/.config/Nine/Backups/app_v1.0.0.db.aquiis ~/.config/Nine/Data/app_v1.0.0.db -cd /home/cisguru/Source/Nine/4-Nine && dotnet run --unpacked -# Program.cs version-skip scan should copy app_v1.0.0.db → app_v1.1.0.db, then bridge fires -``` - -**Test 4c — Aquiis v1.1.0 source** (file already in place, no copy needed): - -```bash -cp ~/.config/Nine/Backups/app_v1.1.0.db.aquiis ~/.config/Nine/Data/app_v1.1.0.db -cd /home/cisguru/Source/Nine/4-Nine && dotnet run --unpacked -# Nine sees app_v1.1.0.db already exists, goes straight to DatabaseService; bridge fires -``` - -**Verification checklist:** - -- [ ] Log line: `First-ancestor era database detected. Applying bridge...` -- [ ] Log line: `Database initialization complete.` -- [ ] App UI loads without errors -- [ ] Properties list shows `IsActive` filter working -- [ ] Invoice and payment records display correctly -- [ ] `IsSampleData` column visible to admin tools (optional) -- [ ] `sqlite3 ~/.config/Nine/Data/app_v1.1.0.db "SELECT MigrationId FROM __EFMigrationsHistory ORDER BY MigrationId"` — shows 8 current-era IDs, no `20260106195859_InitialCreate` - ---- - -## 8. Remaining Work - -| # | Task | Status | Notes | -| --- | ------------------------------------------------------ | ---------- | ----------------------------------------------------------------------------- | -| 1 | `DetectEraAsync()` + era switch in `InitializeAsync()` | ✅ Done | `DatabaseService.cs` — returns `Era` enum; switch drives bridge or backup | -| 2 | `ApplyFirstAncestorBridgeAsync()` | ✅ Done | Aquiis → Nine v1.x bridge SQL | -| 2b | `ApplySecondAncestorBridgeAsync()` | ✅ Done | Placeholder; populate at next major squash | -| 2c | `BackupUnsupportedDatabaseAsync()` | ✅ Done | Copies DB to Backups/ before `SchemaNotSupportedException` is thrown | -| 2d | `DatabaseExceptions.cs` | ✅ Done | `SchemaNotSupportedException`, `SchemaInvalidException`, `MigrationException` | -| 3 | Build verification | 🔴 Pending | `dotnet build Nine.sln` — confirm 0 errors | -| 4 | Run Tests 4–6 | 🔴 Pending | See test matrix above | -| 5 | Commit and merge | 🔴 Pending | `app-database-upgrade` → `phase-0-baseline` | - ---- - -## 9. Future Era Bridges - -This implementation establishes the pattern for all future era bridges. - -### Terminology - -The term "previous" refers to the application version, not the user's data. A user running Nine v1.x has current, active data — it is stored in a schema that predates the current release. The bridge performs a schema transformation only; the data arrives intact on the other side. - -### Marker Rotation at Each Major Squash - -At each major squash (e.g. v1.x → v2.0.0): - -1. The squash produces a new baseline migration ID (e.g. `20270XXX_v2_0_0_InitialCreate`) -2. Rotate the three marker constants in `DatabaseService.cs`: - - `CurrentEraMarker` → new baseline ID - - `FirstAncestorMarker` → previous `CurrentEraMarker` - - `SecondAncestorMarker` → previous `FirstAncestorMarker` -3. Write new `ApplyFirstAncestorBridgeAsync()` SQL for the previous-era → current-era schema transformation -4. Populate `ApplySecondAncestorBridgeAsync()` — see note below -5. `DetectEraAsync()` and the `InitializeAsync()` switch require no structural changes - -### Composing the Second-Ancestor Bridge - -`ApplySecondAncestorBridgeAsync()` cannot simply copy the previous `ApplyFirstAncestorBridgeAsync()` SQL. A database two generations behind must arrive at the **current** schema, not an intermediate one. The method must contain all schema transformations needed to reach the current era directly: - -**Example at v2.0.0:** - -| Detected era | Method called | SQL required | -| -------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `FirstAncestor` (Nine v1.x) | `ApplyFirstAncestorBridgeAsync()` | v1.x schema → v2.x schema | -| `SecondAncestor` (Aquiis v0.3.x) | `ApplySecondAncestorBridgeAsync()` | Aquiis schema → v1.x schema transformations **+** v1.x schema → v2.x schema transformations, as a single transaction | - -The second-ancestor bridge starts from the previous `ApplyFirstAncestorBridgeAsync()` SQL (Aquiis → v1.x) and appends the new `ApplyFirstAncestorBridgeAsync()` SQL (v1.x → v2.x). Both sets of steps run in one transaction — the data is transformed directly from two generations back to current without stopping at an intermediate state. - -### Support Policy - -Nine supports the current era plus two generations back. - -| Era distance | `DetectEraAsync` result | Action | -| -------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------- | -| 0 (current) | `Era.Current` | No-op; `MigrateAsync` handles any pending migrations | -| 1 generation | `Era.FirstAncestor` | `ApplyFirstAncestorBridgeAsync()` transforms schema to current era | -| 2 generations | `Era.SecondAncestor` | `ApplySecondAncestorBridgeAsync()` transforms schema to current era in a single transaction | -| 3+ generations | `Era.NotSupported` | DB backed up to `Backups/`; `DatabaseExceptions.SchemaNotSupportedException` thrown; user directed to import workflow | - ---- - -## 10. Related Documents - -- [Database-Upgrade-Strategy.md](Database-Upgrade-Strategy.md) — Runtime upgrade path (version-skip scan, `PreviousDatabaseFileName` logic) -- [Database-Management-Guide.md](Database-Management-Guide.md) — Operational guidance for database files -- [Compatibility-Matrix.md](Compatibility-Matrix.md) — Supported upgrade paths by version diff --git a/Documentation/Database-Management-Guide.md b/Documentation/Database-Management-Guide.md index f3678ea..8ed354b 100644 --- a/Documentation/Database-Management-Guide.md +++ b/Documentation/Database-Management-Guide.md @@ -1,12 +1,12 @@ -# Nine - Database Management Guide +# Nine. - Database Management Guide -**Version:** 1.0.0 -**Last Updated:** March 1, 2026 +**Version:** 1.2.0 +**Last Updated:** November 16, 2026 **Audience:** Administrators and Power Users --- -## 📖 Table of Contents +## Table of Contents 1. [Overview](#overview) 2. [Database Location & Structure](#database-location--structure) @@ -22,18 +22,17 @@ --- -## 📋 Overview +## Overview Nine uses **SQLite** as its database engine - a lightweight, file-based database that requires no server installation or configuration. This guide covers everything you need to know about managing your database, protecting your data, and recovering from issues. ### What You'll Learn -- ✅ How to back up your database (manual and automatic) -- ✅ How to restore from a backup -- ✅ How to check database health -- ✅ How to troubleshoot common database issues -- ✅ How to optimize database performance -- ✅ Best practices for data protection +- How to back up your database +- How to restore from a backup +- How to check database health +- How to troubleshoot common database issues +- Best practices for data protection ### Why Database Management Matters @@ -42,7 +41,7 @@ Your database contains **all your property management data:** - Properties and tenants - Leases and financial records - Invoices and payments -- Maintenance requests and inspections +- Repairs and inspections - Documents and photos - User accounts and settings @@ -56,26 +55,26 @@ Your database contains **all your property management data:** --- -## 💾 Database Location & Structure +## Database Location & Structure ### Database File Location **Linux:** ```bash -~/.config/Nine/Data/app_v1.0.0.db +~/.config/Nine/app_v1.2.0.db ``` **Windows:** ``` -%APPDATA%\Nine\Data\app_v1.0.0.db +%APPDATA%\Nine\app_v1.2.0.db ``` **Full path examples:** -- **Linux:** `/home/username/.config/Nine/Data/app_v1.0.0.db` -- **Windows:** `C:\Users\YourName\AppData\Roaming\Nine\Data\app_v1.0.0.db` +- **Linux:** `/home/username/.config/Nine/app_v1.2.0.db` +- **Windows:** `C:\Users\YourName\AppData\Roaming\Nine\app_v1.2.0.db` ### Database Structure @@ -94,73 +93,34 @@ The database file is a **single SQLite file** containing: ### Schema Version -Nine v1.0.0 uses schema version `1.0.0`. This tracks the database structure and ensures compatibility. +Nine v1.2.0 uses schema version `1.2.0`. This tracks the database structure and ensures compatibility. **Check your schema version:** -1. Navigate to **Settings** → **Database** +1. Navigate to **Application** 2. View **"Database Information"** panel -3. See \*\*"Schema Version: 1.0.0"" +3. See **"Schema Version: 1.2.0"** -### Auto-Migration System +### Auto-Migration/Upgrade When you upgrade Nine to a new version: 1. Application detects current schema version 2. Compares with required schema version -3. Automatically applies migrations if needed -4. Updates schema version in database -5. Application starts normally +3. Creates a backup of the existing database if needed +4. Automatically applies migrations/upgrade if needed +5. Updates schema version in database +6. Application starts normally +7. All data is preserved **No manual intervention required** - migrations are automatic and seamless! **Version Upgrade Compatibility:** -Not all version upgrades are supported automatically. Check the **[Compatibility Matrix](Compatibility-Matrix.md)** before upgrading to see if your current version can auto-migrate to the target version, or if manual steps are required. - -#### Migration to v1.0.0 - -When upgrading from v1.0.0 to v1.0.0, the following schema changes are automatically applied: - -> **Note:** For complete version compatibility information and upgrade paths, see the **[Compatibility Matrix](Compatibility-Matrix.md)**. - -**New Tables:** - -- **DatabaseSettings** - Tracks encryption state and configuration - - DatabaseEncryptionEnabled (boolean) - - EncryptionChangedOn (datetime) - - Other security settings - -**New Columns:** - -- **IsSampleData** - Boolean flag added to 30+ tables to identify sample/demo data - - Default value: false - - Helps distinguish real data from system-generated examples - -**Index Changes:** - -- **Invoice/Payment unique indexes** - Now composite indexes including OrganizationId - - Ensures multi-tenant data integrity - - Prevents number conflicts across organizations - -**Other Enhancements:** - -- **EncryptionSalt** column added (nullable) for future encryption support - -**Migration Notes:** - -- All changes are additive (no data loss) -- Migration runs automatically on first startup with v1.0.0 -- Backup created automatically before migration -- Typical migration time: 5-15 seconds - -**Important:** v1.0.0 application **requires** v1.0.0 database schema - the DatabaseSettings table is queried on startup. Running v1.0.0 app with v1.0.0 database will result in an error. - -**Version Compatibility:** -See the **[Compatibility Matrix](Compatibility-Matrix.md)** for detailed information about which app versions work with which database versions, and whether automatic migration is available. +Not all version upgrades are supported automatically. Check the **[Compatibility Matrix](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Compatibility-Matrix.md)** before upgrading to see if your current version can auto-migrate to the target version, or if manual steps are required. --- -## 🔐 Backup Procedures +## Backup Procedures ### Why Back Up? @@ -183,20 +143,20 @@ See the **[Compatibility Matrix](Compatibility-Matrix.md)** for detailed informa **Step-by-step:** 1. **Open Nine** -2. **Navigate to:** Settings → Database -3. **Click:** "Backup & Restore" tab -4. **Click:** "Create Backup" button -5. **Wait:** Progress indicator shows backup creation -6. **Confirmation:** "Backup created successfully!" message appears +2. **Navigate to:** Application → Manage Database +3. **Click:** "Create Manual Backup" in the Backup Actions pane +4. **Wait:** A progress indicator shows backup creation +5. **Confirmation:** A "Backup created successfully" message appears and the new file is listed in **Available Backups** **Backup details:** -- **Filename:** `backup_YYYYMMDD_HHMMSS.db` - - Example: `backup_20260218_143022.db` (February 18, 2026 at 2:30:22 PM) -- **Location:** `Data/Backups/` folder - - Linux: `~/.config/Nine/Data/Backups/` - - Windows: `%APPDATA%\Nine\Data\Backups\` +- **Filename:** `Nine_Backup__YYYYMMDD_HHMMSS.db` + - Example: `Nine_Backup_Manual_20260218_143022.db` (February 18, 2026 at 2:30:22 PM) +- **Location:** `Backups/` folder + - Linux: `~/.config/Nine/Backups/` + - Windows: `%APPDATA%\Nine\Backups\` - **Size:** Same as database file (~5-200 MB) +- **Retention:** Nine keeps the **10 most recent** backups and deletes older ones automatically. Copy backups you want to keep elsewhere (see Method 3). **Best practice:** Create a manual backup **before**: @@ -205,90 +165,63 @@ See the **[Compatibility Matrix](Compatibility-Matrix.md)** for detailed informa - Making bulk changes (e.g., deleting multiple records) - Testing new features -### Method 2: Scheduled Automatic Backups (Recommended for Daily Use) - -Set up automatic backups that run on a schedule: +### Method 2: Automatic Backups -**Configuration:** +Nine does **not** run scheduled backups. It creates a backup automatically only at these events: -1. **Navigate to:** Settings → Database → Backup & Restore -2. **Enable:** "Schedule Automatic Backups" toggle (turn ON) -3. **Choose frequency:** - - Daily (recommended) - - Weekly - - Monthly -4. **Set backup time:** - - Default: 2:00 AM (when computer is idle) - - Choose a time when application is running -5. **Set retention policy:** - - Keep backups for: 7 days, 30 days, 90 days, Forever - - Older backups automatically deleted to save space -6. **Click:** "Save Settings" +| Event | Filename contains | +| --------------------------- | ------------------------- | +| Before applying migrations | `PreMigration_Pending` | +| Initial setup | `InitialSetup` | +| Before enabling encryption | `BeforeEncryption` | +| Before disabling encryption | `BeforeDecryption` | +| Before a database reset | `BeforeReset` | -**Important notes:** +To see them, go to **Application → Manage Database** and look in the **Available Backups** list. -- ⚠️ **Computer must be on** for scheduled backups to run -- ⚠️ **Application must be running** (can be minimized) -- ✅ Backups run in background (no interruption to your work) -- ✅ Failed backups logged and retried next scheduled time +### Method 3: External Backup (USB Drive) -**Verify automatic backups are working:** +For **maximum protection**, copy backups to multiple locations. -1. Check the "Last Backup" timestamp in Database settings -2. Browse to `Data/Backups/` folder -3. Verify recent backup files exist -4. Check file dates match your schedule +**Note:** Nine never uploads your backups. Where you store them (USB drive, external disk, cloud storage service) and who can access that storage is your decision and your responsibility. See [Your Responsibilities](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Privacy.md#your-responsibilities) in the Privacy Statement. Consider enabling database encryption (Application → Manage Database → Database Encryption) before copying backups to storage you don't physically control. -### Method 3: External Backup (Cloud or USB Drive) +**Within the application (recommended):** -For **maximum protection**, copy backups to multiple locations: +1. **Navigate to:** Application → Manage Database +2. **Click** **Create Manual Backup** in the **Backup Actions** pane, or use an existing backup in the **Available Backups** list. +3. **Click** **Copy To** next to the backup you want to copy. +4. In the Save dialog, choose a location and click **Save**. -**Cloud storage examples:** +**Note:** If the database is encrypted, you need the password to open the backup. You can create an unencrypted copy if needed: -- Google Drive -- Dropbox -- OneDrive -- iCloud Drive -- Backblaze -- AWS S3 +1. **Navigate to:** Application → Manage Database +2. **Click** **Export Unencrypted Backup** in the **Database Encryption** pane. +3. A new `Nine_Unencrypted_Backup_...db` file appears in the **Available Backups** list. +4. **Click** **Copy To** next to it and save it to your chosen location. -**USB/External drive backup:** +**From the command line (USB/external drive):** **Linux:** ```bash # Copy all backups to USB drive -cp ~/.config/Nine/Data/Backups/*.db /media/usb/NineBackups/ +cp ~/.config/Nine/Backups/*.db /media/usb/NineBackups/ # Or use rsync for incremental backups -rsync -av ~/.config/Nine/Data/Backups/ /media/usb/NineBackups/ +rsync -av ~/.config/Nine/Backups/ /media/usb/NineBackups/ ``` **Windows:** ```powershell -# Copy all backups to USB drive -Copy-Item "$env:APPDATA\Nine\Data\Backups\*.db" "E:\NineBackups\" -Recurse +# Copy all backups to USB drive at drive letter E: +# Replace E: with the actual drive letter for your USB drive. +Copy-Item "$env:APPDATA\Nine\Backups\*.db" "E:\NineBackups\" -Recurse ``` -**Automated cloud sync:** - -Many cloud services offer **folder sync** - configure your cloud client to sync the Backups folder: - -1. Install cloud storage client (e.g., Dropbox, Google Drive) -2. Configure sync for: `Data/Backups/` folder -3. Backups automatically uploaded to cloud -4. Access your backups from anywhere - -**Best practice:** Use the **3-2-1 backup rule**: - -- **3** copies of your data (original + 2 backups) -- **2** different storage types (local SSD + external USB) -- **1** off-site backup (cloud storage) - --- -## 🔄 Restore Procedures +## Restore Procedures ### When to Restore @@ -300,42 +233,23 @@ Restore from backup when: - Migrating to new computer - Testing or training scenarios -### Method 1: Staged Restore (Preview Before Committing) +**Backup from another computer or a USB drive?** On the Manage Database page, click **Upload Backup File** and choose the `.db` file. Nine copies it into the `Backups/` folder and lists it in **Available Backups**, where you can use the methods below. You don't need to copy it into the folder yourself. + +### Method 1: Import (Preview Before Committing) -**Staged restore** lets you preview a backup before fully restoring it: +**Import All Data** lets you preview a backup before importing: **Step-by-step:** -1. **Navigate to:** Settings → Database → Backup & Restore -2. **Click:** "Available Backups" dropdown -3. **Select** a backup from the list: +1. **Navigate to:** Application → Manage Database +2. **Locate** the **Available Backups** pane +3. **Choose** a backup from the list - Shows filename and date - - Example: `backup_20260218_143022.db (Feb 18, 2026 2:30 PM)` -4. **Click:** "Staged Restore" button -5. **Wait:** System creates temporary copy and validates backup -6. **Preview:** Backup information shown: - - Backup date and time - - Database size - - Schema version - - Record counts (properties, tenants, leases) -7. **Decision point:** - - If backup looks correct: **Click "Confirm Restore"** - - If backup is wrong: **Click "Cancel"** (no changes made) - -**What happens during staged restore:** - -1. Backup file copied to staging area (`Data/Staging/`) -2. Backup validated (integrity check) -3. Schema version verified -4. Record counts displayed for review -5. Original database **NOT modified** until you confirm - -**Advantages:** - -- ✅ Safe - preview before committing -- ✅ Verify backup integrity before restore -- ✅ See what data will be restored -- ✅ Can cancel without risk + - Example: `Nine_Backup_Manual_20260218_143022.db` +4. **Click:** "Preview" button to see the records in the database +5. On the Preview Database page, click the tabs at the bottom to preview the data in each table. +6. **Import:** If the data is correct, click **Import All Data**. +7. Importing the data preserves the data that is already in the existing database that is running **including your log-in information**. ### Method 2: Full Restore (Direct Restore with Restart) @@ -343,41 +257,39 @@ Restore from backup when: **Step-by-step:** -1. **Navigate to:** Settings → Database → Backup & Restore -2. **Click:** "Available Backups" dropdown +1. **Navigate to:** Application → Manage Database +2. **Find:** "Available Backups" panel 3. **Select** a backup file -4. **Click:** "Restore from Backup" button +4. **Click:** "Restore" button 5. **Confirmation dialog** appears: ``` - ⚠️ Warning: This will replace your current database + Are you sure you want to restore from ''? - Current database will be backed up automatically before restore. - Application will restart after restore completes. + This will replace your current database and the application will restart automatically. - Are you sure you want to continue? + Current database will be saved as .beforeRestore backup. ``` -6. **Click:** "Yes, Restore" to proceed (or "Cancel" to abort) +6. **Click:** "OK" to proceed (or "Cancel" to abort) 7. **Automatic steps:** - - Current database backed up (safety backup) - - Selected backup validated - - Current database replaced with backup - - Application restarts automatically -8. **Verification:** After restart, check data to ensure correct + - The selected backup is staged for restore + - The application restarts + - On startup, the current database is renamed to `.beforeRestore.` (in the same folder as the database) + - The selected backup is moved into place +8. **Verification:** After restart, check your data **Safety features:** -- ✅ Current database automatically backed up before restore -- ✅ Restore can be undone (restore the safety backup) -- ✅ Validation prevents corrupted backup from being used -- ✅ Application restart ensures clean state +- Current database is kept as a `.beforeRestore` file before it is replaced +- Restore can be undone by renaming that file back to the database name +- Application restart ensures a clean state **Important notes:** -- ⚠️ **All users logged out** during restore -- ⚠️ **Unsaved work will be lost** - save everything first -- ⚠️ **Takes 10-30 seconds** depending on database size +- **All users are disconnected** during restart +- **Unsaved work will be lost** - save everything first +- A restore is a **snapshot**: anything entered after the backup was made is not included ### Method 3: Manual Restore (Advanced Users) @@ -390,16 +302,16 @@ If the application won't start or database UI is unavailable: pkill Nine # Navigate to data directory -cd ~/.config/Nine/Data/ +cd ~/.config/Nine/ # Backup current (corrupted) database -mv app_v1.0.0.db app_v1.0.0.db.corrupted +mv app_v1.2.0.db app_v1.2.0.db.corrupted # Copy backup to main database -cp Backups/backup_20260218_143022.db app_v1.0.0.db +cp Backups/Nine_Backup_Manual_20260218_143022.db app_v1.2.0.db # Restart application -./Nine-1.0.0.AppImage +./Nine-1.2.0-x86_64.AppImage ``` **Windows:** @@ -408,13 +320,13 @@ cp Backups/backup_20260218_143022.db app_v1.0.0.db # Stop the application first (close window or Task Manager) # Navigate to data directory -cd $env:APPDATA\Nine\Data +cd $env:APPDATA\Nine # Backup current (corrupted) database -Move-Item app_v1.0.0.db app_v1.0.0.db.corrupted +Move-Item app_v1.2.0.db app_v1.2.0.db.corrupted # Copy backup to main database -Copy-Item Backups\backup_20260218_143022.db app_v1.0.0.db +Copy-Item Backups\Nine_Backup_Manual_20260218_143022.db app_v1.2.0.db # Restart application (Start Menu or double-click icon) ``` @@ -428,7 +340,7 @@ Copy-Item Backups\backup_20260218_143022.db app_v1.0.0.db --- -## 🔄 Database Reset +## Database Reset ### What is Database Reset? @@ -438,7 +350,7 @@ Copy-Item Backups\backup_20260218_143022.db app_v1.0.0.db - All financial records **deleted** - All documents and photos **deleted** - Organization and user accounts **deleted** -- You will go through New Setup Wizard again +- Nine returns to its first-run state: the home page, where you register a new account ### When to Reset @@ -446,88 +358,79 @@ Reset the database when: - Starting fresh with new data - Training or demonstration scenarios -- Selling/transferring application to someone else - Troubleshooting requires clean slate - Development/testing purposes -**⚠️ Warning: Reset is PERMANENT and cannot be undone!** +** Warning: Reset deletes all data. Only the automatic safety backup can bring it back.** ### Reset Procedure **Step-by-step:** -1. **Navigate to:** Settings → Database → Backup & Restore -2. **Click:** "Advanced" tab -3. **Click:** "Reset Database" button (red button at bottom) -4. **Confirmation dialog** appears: +1. **Navigate to:** Application → Manage Database +2. **Click:** "Reset Database" button in the Backup Actions pane (red button) +3. **Confirmation dialog** appears: ``` - ⚠️ DANGER: Reset Database + WARNING: This will delete the current database and create a new blank one. All data will be lost! - This will DELETE ALL DATA including: - - All properties, tenants, and leases - - All invoices, payments, and financial records - - All maintenance requests and inspections - - All documents and photos - - Organization and user accounts + A backup will be created before deletion. - A backup will be created automatically before reset. - - Type "RESET" to confirm (case-sensitive): - _______ + Are you absolutely sure you want to continue? ``` -5. **Type:** `RESET` (exactly, uppercase) -6. **Click:** "Confirm Reset" -7. **Automatic steps:** - - Current database backed up (safety backup: `pre-reset-backup_20260218_DATE.db`) - - Database reset to empty schema - - Application restarts to New Setup Wizard -8. **Setup:** Go through New Setup Wizard to configure fresh installation +4. **Click:** "OK" to confirm (or "Cancel" to abort) +5. **Automatic steps:** + - Current database backed up (safety backup: `Nine_Backup_BeforeReset_.db`). If the backup fails, the reset is canceled. + - Database deleted + - Application restarts to the home page, where you can create a new account +6. **Setup:** Go through New Account setup to configure the fresh installation **Safety features:** -- ✅ Automatic backup created before reset -- ✅ Typed confirmation required (prevents accidental clicks) -- ✅ Can restore from pre-reset backup if needed +- Automatic backup created before reset +- Reset is canceled if the backup cannot be created +- Can restore from the pre-reset backup if needed **Recovery from reset:** If you reset by mistake, **immediately restore** from the pre-reset backup: -1. Navigate to Backups folder -2. Find: `pre-reset-backup_20260218_143022.db` -3. Use restore procedure (Method 2 or 3 above) +1. Navigate to Application → Manage Database +2. Find `Nine_Backup_BeforeReset_.db` in **Available Backups** +3. Use the restore procedure (Method 1 or 2 above) 4. Your data will be recovered --- -## 🏥 Database Health Checks +## Database Health Checks -### Automatic Health Monitoring +### Automatic Health Checks -Nine monitors database health continuously: +Nine runs an integrity check: -- **On startup** - Integrity check before application loads -- **Every hour** - Background health check via scheduled tasks -- **Before backup** - Verify database is healthy before backup -- **After errors** - Check health if database errors occur +- **On startup** - Before the application loads. If it fails, Nine tries to recover automatically from the most recent valid backup. +- **After migrations** - When a version upgrade applies schema changes. +- **When the Database Settings page opens** - Same check as the manual one below. + +You can also run **Auto-Recover from Corruption** from the Backup Actions pane at any time. ### Manual Health Check **Run a manual health check:** -1. **Navigate to:** Settings → Database → Health & Monitoring -2. **Click:** "Run Health Check" button -3. **Wait:** Health check runs (5-15 seconds) +1. **Navigate to:** Application → Manage Database → Database Health Pane +2. **Click:** "Check Health" button (the check also runs automatically when the page opens) +3. **Wait:** Health check runs (a few seconds) 4. **Results displayed:** ``` - ✅ Database Health Check: PASSED + Database Health Check: PASSED - Database file: app_v1.0.0.db + Database file: app_v1.2.0.db + Location: /home/user/.config/Nine/app_v1.2.0.db File size: 47.3 MB - Schema version: 1.0.0 + Schema version: 1.2.0 Connection status: Connected Integrity check: PASSED @@ -538,64 +441,37 @@ Nine monitors database health continuously: - Invoices: 96 - Payments: 89 - Last backup: February 18, 2026 2:00 AM - Next scheduled backup: February 19, 2026 2:00 AM + Last backup: Wednesday, February 18, 2026 2:00 PM ``` + **Notes:** + - **Location** is the full path of the active database file (on Linux typically under `~/.config/Nine/`, on Windows under `%APPDATA%\Nine\`). + - Record counts are for the active organization only and include records that are not deleted and not archived. The `IsActive` flag is not used. + - **Last backup** is the newest file in the Backups folder, based on the timestamp in the backup file name (falling back to the file's modified time). + ### Health Indicators **Green indicators (healthy):** -- ✅ **Connection status: Connected** - Database accessible -- ✅ **Integrity check: PASSED** - No corruption detected -- ✅ **Schema version: 1.0.0** - Matches application version -- ✅ **File accessible: Yes** - Database file readable and writable +- **Connection status: Connected** - Database accessible +- **Integrity check: PASSED** - No corruption detected +- **Schema version: 1.2.0** - Matches application version **Yellow indicators (warning):** -- ⚠️ **File size large** - Database over 500 MB (consider cleanup) -- ⚠️ **No recent backup** - Last backup over 7 days ago -- ⚠️ **Slow queries** - Database performance degraded +- **File size large** - Database over 500 MB (consider cleanup) +- **No recent backup** - Last backup over 7 days ago, or no backups found **Red indicators (critical):** -- ❌ **Connection failed** - Cannot connect to database -- ❌ **Integrity check: FAILED** - Corruption detected -- ❌ **Schema mismatch** - Version incompatibility -- ❌ **File locked** - Another process using database - -### Database Optimization - -**When to optimize:** - -- Database feels slow -- Search queries take long time -- Application startup is slow -- After bulk data operations (imports, deletions) - -**Run optimization:** - -1. **Navigate to:** Settings → Database → Health & Monitoring -2. **Click:** "Optimize Database" button -3. **Wait:** Optimization runs (30 seconds to 2 minutes) -4. **Automatic steps:** - - VACUUM command (reclaim unused space) - - ANALYZE command (update statistics) - - Index rebuilding - - Cache refresh -5. **Results:** Performance improvements and size reduction - -**Expected results:** - -- **Speed:** Queries 20-50% faster -- **Size:** Database file 10-30% smaller -- **Startup:** Application launches faster - -**Recommendation:** Optimize database quarterly (every 3 months) +- **Connection failed** - Cannot connect to database +- **Integrity check: FAILED** - Corruption detected +- **Schema mismatch** - Version incompatibility +- **File locked** - Another process using the database (reported as a connection failure) --- -## 🔧 Troubleshooting +## Troubleshooting ### Issue 1: Database Locked @@ -628,7 +504,7 @@ Nine monitors database health continuously: - Restart application 2. **Wait for backup to complete:** - - Check if backup is running (Settings → Database) + - Check if backup is running (Application → Manage Database) - Wait 1-2 minutes for backup to finish 3. **Close database tools:** @@ -644,12 +520,12 @@ Nine monitors database health continuously: ```bash # Only if application is definitely closed # Linux - rm ~/.config/Nine/Data/app_v1.0.0.db-wal - rm ~/.config/Nine/Data/app_v1.0.0.db-shm + rm ~/.config/Nine/app_v1.2.0.db-wal + rm ~/.config/Nine/app_v1.2.0.db-shm # Windows - del %APPDATA%\Nine\Data\app_v1.0.0.db-wal - del %APPDATA%\Nine\Data\app_v1.0.0.db-shm + del %APPDATA%\Nine\app_v1.2.0.db-wal + del %APPDATA%\Nine\app_v1.2.0.db-shm ``` ### Issue 2: Database Corruption @@ -671,19 +547,19 @@ Nine monitors database health continuously: **Solutions:** 1. **Restore from backup (recommended):** - - Use most recent backup - - Follow restore procedure above + - Use **Auto-Recover from Corruption** (Application → Manage Database), or restore the most recent backup manually + - Follow the restore procedure above - Verify data after restore 2. **SQLite recovery tool (if no backup):** ```bash # Attempt to dump and rebuild database - sqlite3 app_v1.0.0.db ".dump" | sqlite3 app_v1.0.0_recovered.db + sqlite3 app_v1.2.0.db ".dump" | sqlite3 app_v1.2.0_recovered.db # Replace corrupted database with recovered one - mv app_v1.0.0.db app_v1.0.0.db.corrupted - mv app_v1.0.0_recovered.db app_v1.0.0.db + mv app_v1.2.0.db app_v1.2.0.db.corrupted + mv app_v1.2.0_recovered.db app_v1.2.0.db ``` 3. **Professional data recovery:** @@ -693,10 +569,10 @@ Nine monitors database health continuously: **Prevention:** -- ✅ Enable automatic daily backups -- ✅ Store backups off-site (cloud or USB) -- ✅ Use UPS (uninterruptible power supply) -- ✅ Monitor hard drive health (SMART status) +- Perform backups regularly +- Store backups off-site (USB drive or cloud storage) +- Use UPS (uninterruptible power supply) +- Monitor hard drive health (SMART status) ### Issue 3: Migration Failures @@ -714,10 +590,9 @@ Nine monitors database health continuously: **Solutions:** -1. **Check logs:** - - Navigate to: `Data/Logs/` - - Open most recent log file - - Search for "migration" or "schema" +1. **Check for error details:** + - Nine does not currently write a file-based log; review the terminal/console output if you launched it from a terminal + - Search for "migration" or "schema" in the output - Error details help diagnose issue 2. **Rollback to previous version:** @@ -728,7 +603,7 @@ Nine monitors database health continuously: 3. **Manual schema repair (advanced):** - Requires SQLite knowledge - - Export data, fix schema, reimport + - Export data, fix schema, re-import - Not recommended for non-technical users 4. **Fresh install with data export:** @@ -739,9 +614,9 @@ Nine monitors database health continuously: **Prevention:** -- ✅ **Always backup before updating** -- ✅ Test updates on non-production copy first -- ✅ Wait 1-2 weeks after release before updating (let others test) +- **Always backup before updating** +- Test updates on non-production copy first +- Wait 1-2 weeks after release before updating (let others test) ### Issue 4: Slow Database Performance @@ -761,22 +636,18 @@ Nine monitors database health continuously: **Solutions:** -1. **Optimize database:** - - Settings → Database → Optimize - - Rebuilds indexes and reclaims space - -2. **Cleanup old data:** +1. **Cleanup old data:** - Permanently delete soft-deleted records (advanced feature) - Archive old financial records - Remove unused documents/photos -3. **Check system resources:** +2. **Check system resources:** - Close other applications - Increase RAM if below minimum (2 GB) - Use SSD instead of HDD for data folder -4. **Split database (advanced):** - - Not officially supported in v1.0.0 +3. **Split database (advanced):** + - Not officially supported - Contact support for guidance if needed ### Issue 5: Cannot Find Database File @@ -785,7 +656,7 @@ Nine monitors database health continuously: - Error: "Database file not found" - Application shows empty data -- Fresh installation wizard appears +- The home page asks you to register a new account, as on a first run **Causes:** @@ -799,36 +670,36 @@ Nine monitors database health continuously: ```bash # Linux - ls -la ~/.config/Nine/Data/ + ls -la ~/.config/Nine/ # Windows - dir %APPDATA%\Nine\Data + dir %APPDATA%\Nine ``` 2. **Search for database file:** ```bash # Linux - find ~ -name "app_v1.0.0.db" 2>/dev/null + find ~ -name "app_v1.2.0.db" 2>/dev/null # Windows (PowerShell) - Get-ChildItem -Path C:\ -Filter "app_v1.0.0.db" -Recurse -ErrorAction SilentlyContinue + Get-ChildItem -Path C:\ -Filter "app_v1.2.0.db" -Recurse -ErrorAction SilentlyContinue ``` 3. **Restore from backup:** - If original database lost - Copy backup to correct location - - Rename to `app_v1.0.0.db` + - Rename to `app_v1.2.0.db` 4. **Fix permissions (Linux):** ```bash - chmod 644 ~/.config/Nine/Data/app_v1.0.0.db - chown $USER:$USER ~/.config/Nine/Data/app_v1.0.0.db + chmod 644 ~/.config/Nine/app_v1.2.0.db + chown $USER:$USER ~/.config/Nine/app_v1.2.0.db ``` --- -## 🎓 Advanced Topics +## Advanced Topics ### Database File Format @@ -841,9 +712,9 @@ Nine monitors database health continuously: You may notice these files alongside the database: -- `app_v1.0.0.db` - Main database file -- `app_v1.0.0.db-wal` - Write-Ahead Log (temporary) -- `app_v1.0.0.db-shm` - Shared Memory file (temporary) +- `app_v1.2.0.db` - Main database file +- `app_v1.2.0.db-wal` - Write-Ahead Log (temporary) +- `app_v1.2.0.db-shm` - Shared Memory file (temporary) **WAL benefits:** @@ -873,14 +744,14 @@ SELECT * FROM Properties WHERE IsDeleted = 0; -- Count active leases SELECT COUNT(*) FROM Leases WHERE Status = 'Active'; --- Total rent collected this month -SELECT SUM(Amount) FROM Payments WHERE PaymentDate >= '2026-01-01'; +-- Total rent collected this year +SELECT SUM(Amount) FROM Payments WHERE PaidOn >= '2026-01-01' AND IsDeleted = 0; -- Find overdue invoices -SELECT * FROM Invoices WHERE DueDate < date('now') AND Status = 'Pending'; +SELECT * FROM Invoices WHERE DueOn < date('now') AND Status = 'Pending' AND IsDeleted = 0; ``` -**⚠️ Warning:** +** Warning:** - **Read-only** recommended (SELECT queries only) - **Do NOT** modify data directly (UPDATE, DELETE, INSERT) @@ -903,7 +774,7 @@ SELECT * FROM Properties WHERE IsDeleted = 0; .output financial_summary.csv SELECT l.PropertyId, - p.PropertyName, + p.Address, COUNT(DISTINCT i.Id) as InvoiceCount, SUM(i.Amount) as TotalBilled, SUM(i.AmountPaid) as TotalPaid @@ -911,31 +782,27 @@ FROM Leases l JOIN Properties p ON l.PropertyId = p.Id LEFT JOIN Invoices i ON i.LeaseId = l.Id WHERE l.IsDeleted = 0 -GROUP BY l.PropertyId, p.PropertyName; +GROUP BY l.PropertyId, p.Address; .output stdout ``` ### Database Encryption -SQLite databases are **not encrypted** by default. Nine v1.0.0 includes database encryption options: - -**Option 1: SQLCipher (Included in v1.0.0)** +SQLite databases are **not encrypted** by default. Nine includes database encryption using **SQLCipher**: -SQLCipher provides AES-256 encryption for database files. This is integrated into Nine v1.0.0: +**Option 1: Built-in encryption (SQLCipher)** -- **Enable encryption:** Settings → Database → Security → Enable Database Encryption -- **AES-256 encryption** of entire database file -- **Master password** required to unlock database -- **Encryption state** tracked in DatabaseSettings table -- **Performance impact:** Minimal (2-5% overhead) +- **Enable encryption:** Application → Manage Database → Database Encryption pane → **Enable Database Encryption** +- **AES-256 encryption** of the entire database file +- **Master password** required to unlock the database (cached in your system keychain for convenience) +- **Encryption state** tracked in the DatabaseSettings table +- A backup is created automatically before encryption or decryption (`BeforeEncryption` / `BeforeDecryption`) **Important notes:** -- ⚠️ **Backup before enabling encryption** (encrypted backups require password) -- ⚠️ **Store password safely** - lost password = unrecoverable data -- ✅ Encryption applied to new data immediately -- ✅ Existing data encrypted in background (may take several minutes) -- ✅ Transparent to application once enabled (automatic encryption/decryption) +- **Store your password safely** - a lost password means unrecoverable data +- Encrypted backups require the password. Use **Export Unencrypted Backup** if you need a portable copy (see Backup Procedures, Method 3) +- Transparent to the application once enabled **Option 2: File-system encryption** @@ -948,25 +815,19 @@ SQLCipher provides AES-256 encryption for database files. This is integrated int - VeraCrypt (cross-platform encrypted volumes) - 7-Zip (password-protected archives) -**Recommendation:** Use full-disk encryption (BitLocker, FileVault) for simplicity. +**Recommendation:** Use full-disk encryption (LUKS, BitLocker, FileVault) for simplicity. ### Multi-Computer Sync -Nine is designed as single-computer desktop application. Multi-computer sync is **not officially supported** but possible with caveats: - -**Cloud sync approach:** +Nine is designed as a single-computer desktop application. Multi-computer sync is **not supported**. Do not place the database file in a shared or synced folder. -1. Place database file in synced folder (Dropbox, Google Drive) -2. Configure symlink to synced location -3. Only use on **one computer at a time** (avoid conflicts) +** Risks:** -**⚠️ Risks:** +- Database corruption if two computers write simultaneously +- Sync conflicts if edits are made offline +- Poor performance over a network -- Database corruption if both computers write simultaneously -- Sync conflicts if edits made offline -- Poor performance over network - -**Recommendation:** Use one computer as primary. For multi-computer access, wait for Nine Professional (web-based, v2.0.0). +**Recommendation:** Use one computer as primary. To move your data to another computer, use a backup and **Upload Backup File** (see the FAQ: "How do I migrate to a new computer?"). ### Schema Migrations & Model Optimization @@ -980,13 +841,13 @@ The compiled model lives in `1-Nine.Infrastructure/Data/CompiledModels/` and is **When to regenerate the compiled model:** -| Change | Re-run optimize? | -| ------------------------------------------------- | ---------------- | -| Add / remove entity or property | ✅ Yes | -| Add / modify relationship or index | ✅ Yes | -| Rename entity or property | ✅ Yes | -| Data-only migration (seed data, no schema change) | ❌ No | -| Bug fix with no model changes | ❌ No | +| Change | Re-run optimize? | +| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Add / remove entity or property | Yes | +| Add / modify relationship or index | Yes | +| Rename entity or property | Yes | +| Data-only migration (seed data, no schema change) | No | +| Bug fix with no model changes | No | > **Note:** If the compiled model is stale, EF Core throws an `InvalidOperationException` at startup — the app will not silently use wrong metadata. @@ -1021,26 +882,25 @@ dotnet tool update dotnet-ef -g --- -## 📌 Best Practices +## Best Practices ### Daily Operations -1. **Enable automatic backups** - - Set to daily at 2 AM - - Verify backups run successfully (check Last Backup timestamp) +1. **Back up regularly** + - Nine has no automatic backups. Use **Create Manual Backup** (Application → Manage Database) + - Verify the newest file in **Available Backups** has the date you expect 2. **Monitor database health** - Check health status weekly - Review any warnings/errors 3. **Save work regularly** - - Application auto-saves most changes - Exit normally (don't force quit) ### Weekly Maintenance 1. **Verify backups** - - Check `Data/Backups/` folder + - Check the `Backups/` folder - Verify recent backup files exist - Spot-check a backup (staged restore preview) @@ -1051,35 +911,30 @@ dotnet tool update dotnet-ef -g ### Monthly Maintenance 1. **Copy backups off-site** - - Upload to cloud storage - - Copy to external USB drive - - Test restore from off-site backup + - Copy to an external USB drive or upload to cloud storage + - Test restore from an off-site backup -2. **Review retention policy** - - Delete very old backups if needed - - Keep at least 3 months of backups +2. **Review retention** + - Nine keeps only the 10 most recent backups, so older ones are deleted automatically + - Copy backups you want to keep long-term to external storage ### Quarterly Maintenance -1. **Optimize database** - - Settings → Database → Optimize - - Improves performance - -2. **Test restore procedure** +1. **Test restore procedure** - Practice restoring from backup - Verify you can recover data if needed -3. **Archive old data (optional)** +2. **Archive old data (optional)** - Export old financial records - - Permanently delete soft-deleted records (if feature available) + - Permanently delete records that are no longer needed ### Before Major Updates 1. **Create manual backup** - - Settings → Database → Create Backup + - Application → Manage Database → Create Manual Backup 2. **Copy backup to safe location** - - USB drive or cloud storage + - USB drive or another folder on computer 3. **Document current state** - Note schema version @@ -1091,22 +946,22 @@ dotnet tool update dotnet-ef -g --- -## ❓ FAQ +## FAQ ### Q: How often should I back up my database? **A:** - **Minimum:** Weekly -- **Recommended:** Daily (automatic) -- **Best practice:** Daily automatic + off-site copy weekly +- **Recommended:** Daily (manual; Nine has no scheduled backups) +- **Best practice:** Daily backup + an off-site copy weekly ### Q: Where are backups stored? **A:** -- **Linux:** `~/.config/Nine/Data/Backups/` -- **Windows:** `%APPDATA%\Nine\Data\Backups\` +- **Linux:** `~/.config/Nine/Backups/` +- **Windows:** `%APPDATA%\Nine\Backups\` ### Q: Can I restore a backup from an older version? @@ -1114,7 +969,7 @@ dotnet tool update dotnet-ef -g ### Q: What if I lose all my backups? -**A:** If both the main database and all backups are lost, **data cannot be recovered** unless you have off-site backups (cloud, USB drive). This is why the 3-2-1 backup rule is critical. +**A:** If both the main database and all backups are lost, **data cannot be recovered** unless you have off-site backups (USB drive, cloud storage). This is why the 3-2-1 backup rule is critical. ### Q: Can I access the database while Nine is running? @@ -1124,13 +979,14 @@ dotnet tool update dotnet-ef -g **A:** -1. On old computer: Create backup -2. Copy backup file to new computer (USB drive, cloud) -3. Install Nine on new computer -4. Copy backup to: `Data/Backups/` folder on new computer -5. Restore from backup +1. **Old computer:** Application → Manage Database → **Create Manual Backup**, then **Copy To** next to the new backup and save it to a USB drive or cloud storage. +2. **New computer:** Install Nine. +3. Go to Application → Manage Database and click **Upload Backup File**, then choose the `.db` file (500 MB maximum). Nine copies it into the `Backups/` folder and lists it in **Available Backups** as `Nine_Backup_Uploaded_…`. You don't need to copy files into the folder yourself. +4. Choose how to bring the data in: + - **Restore** - Replaces the new computer's database with the backup, including user accounts. Best for a full migration. + - **Preview → Import All Data** - Brings the records into the existing database and keeps its current accounts, including your log-in. -Or simply copy the entire `Data/` folder to new computer. +**Note:** If the database is encrypted, you need the password on the new computer. Alternatively, use **Export Unencrypted Backup** on the old computer (see Backup Procedures, Method 3). ### Q: Can I use my database on both Windows and Linux? @@ -1138,7 +994,7 @@ Or simply copy the entire `Data/` folder to new computer. ### Q: What happens if my hard drive fails? -**A:** If you have **off-site backups** (cloud, USB), you can recover your data. If not, data is **permanently lost** (professional data recovery may be possible but expensive and not guaranteed). +**A:** If you have **off-site backups** (USB drive, cloud storage), you can recover your data. If not, data is **permanently lost** (professional data recovery may be possible but expensive and not guaranteed). ### Q: Should I backup the WAL files too? @@ -1161,49 +1017,48 @@ Use application UI for all changes. ### Q: Can I have multiple databases? -**A:** Not directly supported in v1.0.0. You can manually swap database files, but only one can be active at a time. For multi-organization use, wait for Nine Professional. +**A:** Not directly supported. You can manually swap database files, but only one can be active at a time. For multi-organization use, wait for Nine Professional. --- -## 📞 Support +## Support Need help with database management? We're here for you! -**Email:** cisguru@outlook.com -**GitHub Issues:** [https://github.com/xnodeoncode/nine/issues](https://github.com/xnodeoncode/nine/issues) +**Email:** [cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20Database%20Management%20Guide) +**GitHub Issues:** [https://github.com/xnodeoncode/Nine/issues](https://github.com/xnodeoncode/Nine/issues) **When contacting support about database issues, include:** 1. **Exact error message** (copy full text) 2. **Steps to reproduce** (what you were doing when error occurred) -3. **Database size** (from Settings → Database) +3. **Database size** (from the Database Health pane, Application → Manage Database) 4. **Last successful backup** (date/time) 5. **Recent changes** (upgrades, bulk operations, etc.) -6. **Log files** (Settings → System → Export Logs) +6. **Console output**, if launched from a terminal --- -## 🎓 Summary +## Summary **Key takeaways:** -✅ **Enable automatic daily backups** - Your insurance policy -✅ **Store backups off-site** - Cloud or USB drive -✅ **Test restore occasionally** - Practice before you need it -✅ **Monitor database health** - Catch issues early -✅ **Optimize quarterly** - Maintain performance -✅ **Backup before major changes** - Always + **Back up regularly** - Your insurance policy + **Store backups off-site** - USB drive or cloud storage + **Test restore occasionally** - Practice before you need it + **Monitor database health** - Catch issues early + **Backup before major changes** - Always **Follow the 3-2-1 backup rule:** - **3** copies of data (original + 2 backups) - **2** different storage types (local + external) -- **1** off-site backup (cloud or remote location) +- **1** off-site backup (for example, an external drive kept elsewhere or cloud storage) -**With good database management practices, your data is safe and your business runs smoothly!** 🏠 +**With good database management practices, your data is safe and your business runs smoothly!** --- -**Document Version:** 1.1 -**Last Updated:** February 18, 2026 +**Document Version:** 1.2.0 +**Last Updated:** November 16, 2026 **Author:** CIS Guru with GitHub Copilot diff --git a/Documentation/Database-Upgrade-Strategy.md b/Documentation/Database-Upgrade-Strategy.md deleted file mode 100644 index 73aa0f0..0000000 --- a/Documentation/Database-Upgrade-Strategy.md +++ /dev/null @@ -1,380 +0,0 @@ -# Nine - Database Upgrade Strategy - -**Version:** 1.1.0-dev -**Last Updated:** March 12, 2026 -**Audience:** Developers, Contributors - ---- - -## Overview - -Nine uses versioned SQLite database files (`app_vX.Y.0.db`) tied to the application's MAJOR.MINOR version. This document describes how the upgrade path works, the known failure mode for version-skipping users, the fix implemented in `app-database-upgrade`, and how to test all upgrade scenarios. - -**This fix ships in v1.1.0** alongside the `app_v1.1.0.db` database file. The normal upgrade path (v1.0.0 → v1.1.0) is covered by `PreviousDatabaseFileName`. The version-skip fallback scan is active in every release from v1.1.0 onward — it protects against any skip at any version boundary (v1.0.0 → v1.2.0, v1.1.0 → v1.3.0, v1.2.0 → v2.0.0, etc.). - ---- - -## Database Versioning Policy - -| App Version | Database File | Schema Version | Notes | -| ----------- | ------------- | -------------- | ---------------------------------- | -| v1.0.0 | app_v1.0.0.db | 1.0.0 | First public release | -| v1.1.0 | app_v1.1.0.db | 1.1.0 | Additive columns only | -| v2.0.0 | app_v2.0.0.db | 2.0.0 | Breaking schema changes | -| v2.0.5 | app_v2.0.0.db | 2.0.0 | PATCH — same DB file | -| v2.1.0 | app_v2.1.0.db | 2.1.0 | New DB file, EF migrations applied | - -**Rules:** - -- MAJOR or MINOR version bump → new `DatabaseFileName` (e.g. `app_v2.1.0.db`) -- PATCH version bump → same `DatabaseFileName`, no DB file change -- `PreviousDatabaseFileName` is set by `bump-version.sh` to the previous file name -- A compiled binary is **version-locked**: it only looks for the filename baked into its `appsettings.json` - -> **App version and schema version are not always in sync.** -> A user running v2.0.5 has app version `2.0.5` but database schema version `2.0.0`. The schema version is anchored to the MAJOR.MINOR milestone at which the schema last changed, not the current app version. PATCH releases carry the same `DatabaseFileName` as their MINOR base — the entire upgrade block is skipped on startup because the target DB file already exists. - ---- - -## Upgrade Path: How It Works - -### Normal upgrade (v1.0.0 → v1.1.0) - -`appsettings.json` in the v1.1.0 binary: - -```json -"DatabaseFileName": "app_v1.1.0.db", -"PreviousDatabaseFileName": "app_v1.0.0.db" -``` - -**Startup sequence (`Program.cs`):** - -1. Target `app_v1.1.0.db` — not found -2. `PreviousDatabaseFileName` = `app_v1.0.0.db` — found -3. **Copy** `app_v1.0.0.db` → `app_v1.1.0.db` -4. EF Core migrations apply the delta to `app_v1.1.0.db` -5. App starts with all user data intact ✅ - -### Version-skip upgrade (any version) - -This scenario can occur at any version boundary. The earliest possible real-world instance is a user on v1.0.0 who skips v1.1.0 and installs v1.2.0 directly. The same logic handles v1.1.0 → v1.3.0, v1.2.0 → v2.0.0, v1.0.0 → v10.0.0, or any other gap. - -Example: user on v1.0.0 installs v1.2.0 directly. - -`appsettings.json` in the v1.2.0 binary: - -```json -"DatabaseFileName": "app_v1.2.0.db", -"PreviousDatabaseFileName": "app_v1.1.0.db" -``` - -**Without the fix (pre-v1.1.0 behaviour):** - -1. Target `app_v1.2.0.db` — not found -2. `PreviousDatabaseFileName` = `app_v1.1.0.db` — **not found** (user skipped v1.1.0) -3. Warning logged; no copy performed -4. EF Core creates **blank** `app_v1.2.0.db` — **user data is lost** ❌ - -**With the fix (shipped in v1.1.0, present in every subsequent release):** - -1. Target `app_v1.2.0.db` — not found -2. `PreviousDatabaseFileName` = `app_v1.1.0.db` — not found -3. **Fallback scan**: glob `app_v*.db` in the config directory, parse each filename as `System.Version`, pick the highest version that is **less than** the target -4. Finds `app_v1.0.0.db`, copies it to `app_v1.2.0.db` -5. EF Core migrations apply the **full delta** from v1.0.0 schema to v1.2.0 schema -6. App starts with all user data intact ✅ - -The same logic handles multi-step skips (e.g. only `app_v1.0.0.db` present when installing v1.4.0) and double-digit versions (v9.x → v10.x) correctly via `System.Version` numeric comparison. - -### Fresh install (no previous DB) - -1. Target `app_vX.Y.0.db` — not found -2. `PreviousDatabaseFileName` is empty (or not found on disk) -3. Scan finds nothing -4. EF Core creates a new blank database -5. Seed data applied ✅ - -### Already upgraded (DB file exists) - -1. Target `app_vX.Y.0.db` — **found** -2. Entire upgrade block is skipped (guarded by `!File.Exists(dbPath)`) -3. EF checks for pending migrations, applies if any ✅ - ---- - -## The Fix: `System.Version` Fallback Scan - -**File:** `4-Nine/Program.cs` - -The existing `else` branch in the upgrade block (which only logged a warning) is replaced with: - -```csharp -else -{ - // Direct predecessor not found — user may have skipped one or more versions. - // Scan for any app_v*.db file in the same directory and use the highest version - // that is older than this binary's target. System.Version ensures correct numeric - // ordering (v10.0 > v9.0, which lexicographic sort would get wrong). - var dbDir = Path.GetDirectoryName(dbPath)!; - var targetVersion = Version.TryParse( - Path.GetFileNameWithoutExtension(dbFileName).Replace("app_v", ""), - out var tv) ? tv : null; - - var bestCandidate = Directory.Exists(dbDir) - ? Directory.GetFiles(dbDir, "app_v*.db") - .Where(f => f != dbPath) - .Select(f => new - { - Path = f, - Version = Version.TryParse( - Path.GetFileNameWithoutExtension(f).Replace("app_v", ""), - out var v) ? v : null - }) - .Where(x => x.Version != null && (targetVersion == null || x.Version < targetVersion)) - .OrderByDescending(x => x.Version) - .Select(x => x.Path) - .FirstOrDefault() - : null; - - if (bestCandidate != null) - { - app.Logger.LogInformation( - "Version skip detected: copying {Found} → {NewFile} (expected {Missing} was absent)", - Path.GetFileName(bestCandidate), dbFileName, previousDbFileName); - Directory.CreateDirectory(Path.GetDirectoryName(dbPath)!); - File.Copy(bestCandidate, dbPath); - } - else - { - app.Logger.LogWarning( - "Version upgrade: no previous database found at {PreviousPath} and no app_v*.db candidates in {DbDir}. " + - "A new empty database will be created.", - previousDbPath, dbDir); - } -} -``` - -**Why `System.Version`?** -Lexicographic string sorting fails at double-digit major versions: -`"app_v10.0.0.db" < "app_v9.0.0.db"` (string sort — wrong) -`Version(10,0,0) > Version(9,0,0)` (`System.Version` — correct) - -**Why `x.Version < targetVersion`?** -Guards against accidentally picking a DB file from a _newer_ version than the current binary — which could only exist if the user manually placed it there (unsupported). - ---- - -## Testing Plan - -### Prerequisites - -All scenarios require a test user data directory. On Linux this is `~/.config/Nine/`. The test steps below create and manipulate files in that directory directly. - -> **Important:** Back up any real production database before running these tests. - ---- - -### Scenario 1: Fresh Install - -**Setup:** Delete `~/.config/Nine/app_v*.db` if any exist. Set `appsettings.json` to `DatabaseFileName: "app_v1.0.0.db"`, `PreviousDatabaseFileName: ""`. - -**Run:** `dotnet run` (or launch AppImage) - -**Expected:** - -- Log: no upgrade messages -- `~/.config/Nine/app_v1.0.0.db` created -- App starts, seed data present, login works - -**Pass criteria:** Fresh DB created, no errors in logs. - ---- - -### Scenario 2: Normal Upgrade (Direct Predecessor) - -**Setup:** - -1. Run Scenario 1 to create `app_v1.0.0.db` with real data -2. Change `appsettings.json` to `DatabaseFileName: "app_v1.1.0.db"`, `PreviousDatabaseFileName: "app_v1.0.0.db"` -3. (Optional) Add a pending EF migration in the `1.1.0` schema to verify migrations apply - -**Run:** `dotnet run` - -**Expected:** - -- Log: `"Version upgrade detected: copying app_v1.0.0.db → app_v1.1.0.db"` -- `app_v1.1.0.db` created -- All data from `app_v1.0.0.db` present in new file -- EF migrations applied (if any pending) -- App starts normally - -**Pass criteria:** Data preserved, no EF errors. - ---- - -### Scenario 3: Version Skip (Missing Predecessor) - -Simulates a user on v1.0.0 who skips v1.1.0 and installs v1.2.0 directly. This is the earliest possible real-world version-skip. - -**Setup:** - -1. Run Scenario 1 to create `app_v1.0.0.db` with real data -2. Do **not** create `app_v1.1.0.db` -3. Change `appsettings.json` to `DatabaseFileName: "app_v1.2.0.db"`, `PreviousDatabaseFileName: "app_v1.1.0.db"` - -**Run:** `dotnet run` - -**Expected:** - -- Log: `"Version skip detected: copying app_v1.0.0.db → app_v1.2.0.db (expected app_v1.1.0.db was absent)"` -- `app_v1.2.0.db` created from `app_v1.0.0.db` -- All data preserved -- EF migrations applied (full delta from v1.0.0 schema to v1.2.0) -- App starts normally - -**Pass criteria:** Data preserved despite skipped version. - ---- - -### Scenario 4: Multi-Version Skip (v1.0.0 → v10.0.0) - -**Setup:** - -1. Create `app_v1.0.0.db` with real data -2. Create a dummy `app_v9.0.0.db` in the config directory (copy of v1.0.0) -3. Change `appsettings.json` to `DatabaseFileName: "app_v10.0.0.db"`, `PreviousDatabaseFileName: "app_v9.9.0.db"` (missing) - -**Run:** `dotnet run` - -**Expected:** - -- Log shows `app_v9.0.0.db` was selected (highest version below v10.0.0) -- `app_v10.0.0.db` created from `app_v9.0.0.db`, NOT `app_v1.0.0.db` -- `System.Version` correctly ranked v9.0.0 > v1.0.0 - -**Pass criteria:** v10 is handled correctly; v9 preferred over v1. - ---- - -### Scenario 5: Already Upgraded (Idempotency) - -**Setup:** - -1. Complete Scenario 2 (v1.1.0 DB exists) -2. Restart the app without changing any config - -**Run:** `dotnet run` - -**Expected:** - -- No copy block executing (guarded by `!File.Exists(dbPath)`) -- No upgrade log messages -- App starts normally from existing DB - -**Pass criteria:** No duplicate copies, no accidental data overwrite. - ---- - -### Scenario 6: No Previous DB, No Candidates - -**Setup:** - -1. Empty `~/.config/Nine/` (no DB files at all) -2. Set `appsettings.json` to `DatabaseFileName: "app_v1.2.0.db"`, `PreviousDatabaseFileName: "app_v1.1.0.db"` - -**Run:** `dotnet run` - -**Expected:** - -- Log: warning that no previous database was found -- EF creates a new blank `app_v1.2.0.db` -- App starts, seed data present - -**Pass criteria:** Clean degradation to fresh install behavior; no crash. - ---- - -## Known Incompatibility: Pre-Squash Databases (Pre-v1.0.0) - -### Background - -Between v0.3.0 and v1.0.0, the EF Core migration history was **squashed**. The many individual incremental migrations were replaced by a single consolidated `InitialCreate` migration that creates the full schema in one step. This means the upgrade path described above **only works for databases created at v1.0.0 or later**. - -### What Happens When a Pre-v1.0.0 Database Is Used - -Despite the version-skip glob scan finding and copying the old file correctly, the migration step fails: - -1. Version-skip glob finds `app_v0.3.0.db` — copied to target ✅ -2. EF inspects `__EFMigrationsHistory` in the copied DB — no `InitialCreate` entry found -3. EF treats `InitialCreate` as **pending** and tries to run it -4. Every `CREATE TABLE` statement fails: `SQLite Error 1: 'table "AspNetRoles" already exists'` -5. App crashes at startup ❌ - -This is correct and expected behaviour. The pre-squash database already has all the tables (built by old individual migrations), but its history table doesn't contain the `InitialCreate` entry that the post-squash code expects. - -### Supported Upgrade Boundary - -| Source DB Version | Target Version | Auto-Upgrade? | -| ------------------- | -------------- | --------------------------------------------- | -| v1.0.0 or later | Any v1.x.x+ | ✅ Supported | -| v0.x.x (pre-v1.0.0) | Any v1.x.x+ | ❌ Not supported (pre-squash incompatibility) | - -**The auto-upgrade path is guaranteed only for v1.0.0+ (post-squash) source databases.** - -### Test Result - -Verified in manual test (`test1.2.log`): running `Nine-1.1.0-x86_64.AppImage` against `app_v0.3.0.db` produces: - -``` -Version skip detected: copying app_v0.3.0.db → app_v1.1.0.db (expected app_v1.0.0.db was absent) -SQLite Error 1: 'table "AspNetRoles" already exists' -``` - -The copy logic is correct; only the migration fails. - -### Recovery Strategy (Backlog) - -Currently a pre-v1.0.0 database causes a crash with no user-friendly recovery path. Planned improvement: - -1. Detect the incompatible schema error during `MigrateAsync()` -2. Present the user with a choice: - - **Start fresh** — create a new blank database (all legacy data lost, app becomes usable immediately) - - **Abort** — exit cleanly, leaving the old database file intact -3. Future: provide a data-import tool to extract records from the old schema and import them into the new one - -_This recovery path is a backlog item and is not part of the v1.1.0 release._ - ---- - -## Merge Plan - -This fix ships as part of **v1.1.0**. The branch workflow: - -``` -phase-0-baseline (base: Phase 18 + original one-step upgrade block) - ↓ branch -app-database-upgrade (this branch: version-skip scan + System.Version fix) - ↓ test Scenarios 1-6 - ↓ merge back to phase-0-baseline - ↓ merge to development - ↓ PR to main - ↓ bump-version.sh → v1.1.0 - sets DatabaseFileName: "app_v1.1.0.db" - sets PreviousDatabaseFileName: "app_v1.0.0.db" -``` - -**Version notes:** - -- `PreviousDatabaseFileName` covers the direct one-step upgrade (v1.0.0 → v1.1.0, v1.1.0 → v1.2.0, etc.) -- The fallback scan covers **any skip at any version boundary** — v1.0.0 → v1.2.0, v1.1.0 → v1.3.0, v1.2.0 → v2.0.0, v1.0.0 → v10.0.0, etc. -- This protection is present in every release from v1.1.0 onward; there is no version at which it "becomes" relevant -- Run all 6 scenarios against `~/.config/Nine/` before merging to `main` - -``` - -**Version notes:** - -- v1.1.0 `PreviousDatabaseFileName` = `app_v1.0.0.db` — covers the direct v1.0.0 → v1.1.0 upgrade path (no skip possible yet, only one prior version exists) -- The fallback scan becomes the safety net for v1.2.0+ when a user could first skip a version -- Once merged to `development`, run Scenarios 1 and 5 against the actual `~/.config/Nine/` directory (with a real v1.0.0 DB backup) before merging to `main` -``` diff --git a/Documentation/Install-Guide.md b/Documentation/Install-Guide.md new file mode 100644 index 0000000..c459b66 --- /dev/null +++ b/Documentation/Install-Guide.md @@ -0,0 +1,95 @@ +# Nine. - Installation Guide + +**Version:** 1.2.0 +**Last Updated:** November 16, 2026 + +--- + +## Windows + +### Installer + +Download `Nine-1.2.0-x64-Setup.exe`. Click to run the installer. The application appears in Start Menu. + +### Portable + +Download `Nine-1.2.0-x64-Portable.exe`. Copy the file to your desired location and double-click to run. + +> **Note:** Although the portable app can run from a USB drive, other removable media, or a network drive, the database is stored on the local hard drive. See the Database Management Guide in the `Documentation` folder for details. + +--- + +## Linux + +### Install + +Download and extract the compressed file that contains the [AppImage for this release](https://github.com/xnodeoncode/Nine/releases/tag/v1.2.0). It extracts to a folder named `Nine-1.2.0-Linux-x86_64` inside the folder you downloaded it to (for example `~/Downloads`). That folder holds `Documentation`, `Install` and this file. The `Install` folder has the AppImage and a `Utilities` folder with install, removal and diagnostic scripts. + +Open a terminal in the extracted folder and make the files executable: + +```bash +cd ~/Downloads/Nine-1.2.0-Linux-x86_64 + +chmod +x Install/Utilities/*.sh +chmod +x Install/Nine-1.2.0-x86_64.AppImage +``` + +**Run Nine without installing it:** + +```bash +./Install/Nine-1.2.0-x86_64.AppImage +``` + +**Or add Nine to your application launcher:** + +```bash +./Install/Utilities/nine-tool.sh install Install/Nine-1.2.0-x86_64.AppImage +``` + +The installer copies the AppImage to `~/Applications/Nine/` (the file you downloaded is left in place) and adds Nine to your application launcher. It also copies the scripts from `Utilities` to `~/Applications/Nine/Utilities/`, so you can use them later to uninstall Nine or to troubleshoot the application. + +--- + +## First Launch + +On first launch you will be prompted to create an account. The first account created is automatically assigned the 'Owner' role with full access within the application. +See the [Quick-Start-Guide.md](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Quick-Start-Guide.md) for a full walk-through. + +**Windows:** Search for **Nine** in the Start Menu. + +**Linux:** Search for **Nine** in your application launcher. + +--- + +## Uninstall + +Back up your database to external storage or a location outside of the application installation folder first. See the [Database Management Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Database-Management-Guide.md). + +**Windows (Installer):** Use **Add or Remove Programs** in Windows Settings. + +**Windows (Portable):** Delete the `Nine-1.2.0-x64-Portable.exe` file. (The database files will still be on your hard drive) + +**Linux:** + +Use the removal script from the `Utilities` folder (a copy is also in `~/Applications/Nine/Utilities/` after installing). It undoes the desktop integration, and can remove the application only, the application and your data, or the application, your data, and the database encryption key. + +```bash +cd ~/Applications/Nine +chmod +x Utilities/*.sh +./Utilities/nine-tool.sh remove --help +``` + +Common uses: + +```bash +cd ~/Applications/Nine +./Utilities/nine-tool.sh remove --dry-run # preview; nothing is changed +./Utilities/nine-tool.sh remove # remove the launcher entry, icon and AppImages; keep your data +./Utilities/nine-tool.sh remove --all # remove everything, including all data and the encryption key (permanent) +``` + +--- + +## Troubleshooting + +For startup timing, build verification and log capture, see [Advanced Troubleshooting Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Advanced-Troubleshooting-Guide.md). diff --git a/Documentation/Privacy.md b/Documentation/Privacy.md new file mode 100644 index 0000000..bc53414 --- /dev/null +++ b/Documentation/Privacy.md @@ -0,0 +1,132 @@ +# Nine. - Privacy Statement + +**Version:** 1.2.0 +**Last Updated:** November 14, 2026 + +--- + +## Summary + +Nine is a desktop application that runs entirely on your computer. All data entered is stored on the local computer. Nine does not transmit or share data with any third party entities, services, or organizations. + +- **All data entered is stored locally** in a database file on the user's computer. Database encryption is optional. +- **Data is not shared.** Nine does not send or share any data stored. The application has no analytics, telemetry, advertising. +- **Local application log.** Application logs are output to a terminal window if the user launches the application via command prompt. +- **Nine does not initiate connections to any server.** It works fully offline. +- **You are in control.** You decide what to enter, back up, export or delete. + +--- + +## What Nine Stores + +Nine stores the information you enter so that you can manage your rental properties. Depending on how you use it, this +can include: + +- Property details and expenses +- Tenant details, such as names, email addresses, phone numbers, dates of birth, identification numbers and emergency + contacts +- Leases, invoices, payments, security deposits, inspections, repairs, checklists, notes and calendar events +- Documents you upload or generate, such as lease and receipt PDFs +- User accounts for the people who sign in to Nine (names, email addresses, and passwords stored as one-way hashes, not as + readable text) +- Application and organization settings + +All of this is stored in a local encrypted (see [Database Encryption](#database-encryption) below) SQLite database file. It is not sent anywhere. + +### Where it is stored + +Nine keeps its data in a folder in your user profile: + +- **Linux:** `~/.config/Nine/` +- **Windows:** `%APPDATA%\Nine\` + +This folder contains the database (`app_vX.Y.Z.db`), the `Backups` folder, and the cookies and cache used by the +application window. The portable Windows version may keep its data with the program instead. + +### Database encryption + +Database encryption is optional. When you turn it on (via the Database Settings page), Nine encrypts the database with a password you +choose, using SQLCipher. The key is kept in your operating system's credential store (the Windows credential store or the +Linux keychain), not in a file. If you lose the password, your data cannot be recovered, so keep it somewhere safe. If you +do not turn encryption on, the database file is not encrypted and is protected only by your computer's own security. + +### Cookies + +Nine uses a small number of cookies inside its own application window for signing in, keeping your session, and protecting +forms from forged requests. They stay on your computer and are not used for tracking. + +--- + +## What Nine Does Not Do + +- It does not collect anything about how you use it, such as usage data, analytics. The only + information it holds is what you enter. +- It does not contain advertising or third-party tracking. +- It does not send crash reports. +- It does not send email or text messages. No email or SMS provider is configured in Nine, and it has no screens for + setting one up. +- It does not check for updates in the background or contact any server. +- It does not sell, rent or share your information. + +--- + +## Network Access + +Nine runs a small web server that the Nine window uses on your computer. It listens on your local machine only +(`localhost`) and is not reachable from other computers. As with any local service, other programs running on your +computer can reach it. The Nine window is set to block its own requests to anything outside your computer. + +Links to external websites, such as release notes and documentation, are handed to your **default web browser**. When you +open one, that is your browser connecting to the website, not Nine, and the website's and your browser's own privacy +practices apply. Email links are handed to your default mail program if one is installed and the privacy practices therein apply. + +--- + +## Backups, Exports and Documents + +Backups, downloaded documents and exports are files on your computer. Nine does not upload them. If you copy them to an +external drive or a cloud storage service, you decide where they go and you are responsible for protecting them. + +--- + +## Your Responsibilities + +If you use Nine to keep information about tenants and applicants, you may have legal obligations for how you collect, store +and protect that information. Nine gives you the tools (local storage, optional encryption, backups, and archive or delete), +but you decide how to use them. Good practice includes: + +- **Turning on database encryption and using a strong password** +- **Keeping your computer's operating system up-to-date and disk protected** +- **Keeping backups in a safe place, and removing ones you no longer need** +- **Archiving or deleting records you no longer need to keep** + +### Removing your data + +To remove all Nine data from a computer, uninstall Nine and then delete its data folder [see above](#where-it-is-stored). Uninstalling the +application may leave that folder in place. Deleting records inside Nine removes them from the database, and deleted records +may still exist in older backups until you delete those too. For more information on how to completely remove Nine from your computer, refer to the [Quick Start Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Quick-Start-Guide.md). + +--- + +## Third-Party Software + +Nine includes third-party components. See [Third-Party Licensing Notices](Third-Party-Licensing-Notices.md), or the +**Third-Party Licenses** page in the application, for the list and their licenses. None of these components is used to send +your information anywhere. + +--- + +## Changes to This Statement + +If a future version of Nine changes how it handles information, for example by adding an optional feature that connects +to the internet, this statement will be updated and the version at the top will change. The statement installed with the +application describes the version you are running. + +--- + +## Contact + +Questions about this statement can be sent to +[cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20Privacy%20Statement). + +This statement is informational and is not legal advice. diff --git a/Documentation/Quick-Start-Guide.md b/Documentation/Quick-Start-Guide.md index bc53f69..8f64921 100644 --- a/Documentation/Quick-Start-Guide.md +++ b/Documentation/Quick-Start-Guide.md @@ -1,765 +1,564 @@ # Nine. - Quick Start Guide -**Version:** 1.0.0 -**Last Updated:** March 1, 2026 +**Version:** 1.2.0 +**Last Updated:** November 12, 2026 **Estimated Time:** 15 minutes --- -## 📖 Welcome! +## Welcome -This guide will help you get started with Nine in just 15 minutes. By the end, you'll have: +This guide gets you from a fresh install to your first invoice and payment. By the end you will have: -- ✅ Installed the application -- ✅ Created your organization -- ✅ Added your first property -- ✅ Added a tenant -- ✅ Created a lease -- ✅ Generated an invoice -- ✅ Recorded a payment -- ✅ Scheduled an inspection +- [Installing the application](#step-1-installation-5-minutes) +- [Create an account and organization](#step-2-create-your-account-and-organization-2-minutes) +- [Add a property](#step-3-add-your-first-property-3-minutes) +- [Add a tenant](#step-4-add-a-tenant-2-minutes) +- [Create a lease](#step-5-create-a-lease-2-minutes) +- [Create an invoice](#step-6-create-an-invoice-1-minute) +- [Record a payment](#step-7-record-a-payment-1-minute) +- [Record a property inspection](#step-8-record-an-inspection-3-minutes) +- [Uninstalling Nine](#uninstalling-nine) -Let's get started! +Let's get started. --- -## 📋 Prerequisites +## Prerequisites Before you begin, ensure you have: - **Operating System:** - - Linux (Ubuntu 20.04+, Debian 11+, Fedora 35+), OR + - Linux, 64-bit (x86_64). Tested on Red Hat Enterprise Linux 10 with GNOME; see [AppImage Requirements](#appimage-requirements), OR - Windows 10/11 (64-bit) - **Hardware:** - - 2 GB RAM minimum (4 GB recommended) - - 500 MB disk space -- **Downloaded:** Nine v1.0.0 installer for your platform + - 8 GB RAM minimum (16 GB recommended) + - 2 GB disk space +- **Download:** [Nine v1.2.0](https://github.com/xnodeoncode/Nine/releases/tag/v1.2.0) for your platform -### Universal Linux Support: +### AppImage Requirements -Nine. is distributed as an AppImage, which runs on all major Linux distributions—including Ubuntu, Debian, Fedora, RedHat, Arch, openSUSE, and more. No installation required: just download, make executable, and run. +**Nine as an AppImage.** The Nine AppImage has been tested on Red Hat Enterprise Linux 10 with the GNOME desktop. No installation is required: download, make executable (using `chmod +x Nine-1.2.0-x86_64.AppImage`), and run. -### Windows Portable Version: +The AppImage format is designed to run on most Linux distributions. The AppImage bundles Nine and its runtime, but it still requires the following on your system: -Nine. is available as a portable Windows executable (.exe). No installation required—just download, extract, and run. All application data is stored locally in the same folder, making it easy to use Nine from a USB drive or move between systems. +- **A 64-bit (x86_64) Linux system with a recent C library (glibc).** +- **FUSE,** which AppImages use to start. Some distributions do not install it by default. If the AppImage will not start, install your distribution's FUSE package, or run it with `./Nine-1.2.0-x86_64.AppImage --appimage-extract-and-run`. +- **A graphical desktop with the common GTK and graphics libraries** that Electron applications use. Most desktop distributions already include them. +- **A Secret Service provider (for example, GNOME Keyring or KWallet)** to store the database password securely. ---- +**Desktop integration script.** The optional `nine-tool.sh` script has been tested on RHEL 10 with GNOME, so not guaranteed to work on all distros. It writes to the standard locations (`~/.local/share/applications` and `~/.local/share/icons`). If it does not work for you, run the AppImage directly. + +### Windows Portable + +**Nine as a portable Windows executable (.exe).** The Nine portable exe file has been tested to run on Windows 11. No installation is required. Download the portable exe file, store it in a location of choice on your Windows 11 computer, and double-click the file to run. -## 🚀 Step 1: Installation (5 minutes) +### Windows Installer -### Linux Installation +**Using Windows Installer.** Nine can be installed using the Windows installer. This adds the application to the Windows Add/Remove programs list of programs and the Windows Start Menu. Optional desktop and task bar shortcuts can be created for ease of access. -**Option A: AppImage (Recommended for most users)** +## Step 1: Installation (5 minutes) + +### Linux Installation Steps + +**Option A: Manual AppImage copy** ```bash # 1. Download the file -# File: Nine-1.0.0-x86_64.AppImage +# File: Nine-1.2.0-x86_64.AppImage # 2. Make it executable -chmod +x Nine-1.0.0-x86_64.AppImage +chmod +x Nine-1.2.0-x86_64.AppImage # 3. Run the application -./Nine-1.0.0-x86_64.AppImage +./Nine-1.2.0-x86_64.AppImage ``` -**Option B: Debian Package (Ubuntu/Debian users)** - -```bash -# 1. Install the package -sudo dpkg -i Nine-1.0.0-amd64.deb - -# 2. Run the application -nine -``` +The application start-up displaying the start-up log in the terminal. -### Windows Installation +**Option B: Desktop Integration Option** -**Option A: NSIS Installer (Recommended)** +Nine can be integrated into your GNOME desktop environment. -1. **Download** `Nine-1.0.0-x64-Setup.exe` -2. **Double-click** the installer -3. **Follow the wizard:** - - Click "Next" to begin - - Accept license agreement - - Choose installation directory (default: `C:\Program Files\Nine\`) - - Create desktop shortcut (recommended) - - Click "Install" -4. **Launch** from Start Menu or Desktop shortcut +1. Download the file: currently Nine-1.2.0-x86_64.AppImage +2. Download the installer script, `install-desktop-integration.sh`, and put it in the same folder as the AppImage. The release also has a `Utilities` folder with the other scripts (`nine-tool.sh`, `nine-removal.sh` and more). If you keep them in the same folder as the installer, it copies them to `~/Applications/Nine/Utilities` so you can use them later to uninstall Nine. +3. Make the files executable -**Option B: Portable Executable (No installation)** +```bash +chmod +x Nine-1.2.0-x86_64.AppImage +chmod +x install-desktop-integration.sh +``` -1. **Download** `Nine-1.0.0-x64-Portable.exe` -2. **Place** in your desired folder (e.g., `C:\Nine\`) -3. **Double-click** to run +4. Execute the script -**✅ Checkpoint:** Application window should open showing the New Setup Wizard. +```bash +./install-desktop-integration.sh Nine-1.2.0-x86_64.AppImage +``` ---- +The install script is expected to: -## 🏢 Step 2: Create Your Organization (2 minutes) +1. Copy the AppImage to the `~/Applications/Nine` directory (it creates the directory if it doesn't exist). The original file is left where it was. +2. Copy every script it finds in its own folder (the installer itself, the removal script, `nine-tool.sh` and the others) to `~/Applications/Nine/Utilities` and make the `.sh` files executable. If the removal script or `nine-tool.sh` is not found next to the installer, it shows a warning and continues. +3. Create a desktop entry file which adds Nine to the Launch Menu. -When you first launch Nine, the **New Setup Wizard** guides you through initial setup. +### Windows Installation Steps -### Organization Setup +**Option A: Installer (recommended)** -**On the "Create Organization" screen:** +1. Download `Nine-1.2.0-x64-Setup.exe` +2. Double-click the installer +3. Follow the wizard (accept the license, choose the installation folder, create a desktop shortcut) +4. Launch Nine from the Start Menu or desktop shortcut -1. **Organization Name:** Enter your business name - - Example: "ABC Property Management" or "John Smith Rentals" -2. **Contact Information:** - - **Phone:** Your business phone number - - **Email:** Your business email address - - **Website:** (Optional) Your website URL +**Option B: Portable executable (no installation)** -3. **Address:** - - Street address - - City, State, ZIP code - - Country +1. Download `Nine-1.2.0-x64-Portable.exe` +2. Place it in the folder you want to run it from (for example `C:\Nine\`) +3. Double-click to run -4. **Click** "Create Organization" +**Checkpoint:** The Nine window opens and shows the **Register** page. -**✅ Checkpoint:** You should see "Organization created successfully!" message. + --- -## 👤 Step 3: Register Your User Account (2 minutes) - -**On the "Register User" screen:** +## Step 2: Create an Account and Organization (2 minutes) -1. **Personal Information:** - - **First Name:** Your first name - - **Last Name:** Your last name +The first time Nine starts, there are no accounts, so the **Register** page shows a single form that creates both your organization and your account. Registration is only available for this first account. -2. **Login Credentials:** - - **Email:** Your email address (becomes your username) - - **Password:** Choose a strong password - - Minimum 8 characters - - Must contain: uppercase, lowercase, number, special character - - **Confirm Password:** Re-enter your password +1. Fill in **Organization Name** (for example "ABC Property Management" or "John Smith Rentals"). +2. Choose your **State**. +3. Enter your **Email** (this is your login), **First Name** and **Last Name**. +4. Enter and confirm a **Password**. It must be at least **12 characters** and include an uppercase letter, a lowercase letter, a number and a special character. +5. Click **Register**. -3. **Role:** Administrator (automatically selected for first user) +You are the organization's owner with full administrative privileges. The account is confirmed automatically; there is no email verification step. -4. **Click** "Register" +**Checkpoint:** You are signed in and see the **Property Management Dashboard**. If not, click Log-In in the left navigation or Sign-In in the center of the page and log in to the application. -**✅ Checkpoint:** You should be logged in and see the Dashboard. +### The Dashboard -### First-Time Dashboard +The left navigation menu contains **Dashboard, Calendar, Properties, Tenants, Leases, Inspections, Repairs, Documents** and **Reports**. Owners and Administrators also see **Application** and **Organization** as two top-most navigation links. -After registration, you'll see the main dashboard with: +The dashboard shows property metrics, **Outstanding Invoices**, **Outstanding Repairs**, **Upcoming Lease Renewals** and **Available Properties**. -- **Navigation menu** on the left -- **Dashboard widgets** showing 0 properties, tenants, leases -- **Welcome message** with quick actions - -**Note:** Your account is automatically confirmed in Nine (no email verification step). + --- -## 🏠 Step 4: Add Your First Property (3 minutes) - -Let's add a rental property to your portfolio. - -### Navigate to Properties - -1. Click **"Property Management"** in the left navigation menu -2. Click **"Properties"** -3. Click **"Add Property"** button (top-right) - -### Enter Property Details - -**Basic Information:** - -- **Property Name:** Give it a friendly name - - Example: "123 Main Street House" -- **Address:** - - **Street Address:** 123 Main Street - - **City:** Anytown - - **State/Province:** CA - - **ZIP/Postal Code:** 12345 - - **Country:** USA - -- **Property Type:** Select from dropdown - - Options: Single Family, Multi-Family, Apartment, Condo, Townhouse - - Choose: **Single Family** +## Step 3: Add Your First Property (3 minutes) -- **Number of Units:** 1 (for single-family home) +1. Click **Properties** in the left menu. +2. Click **Add Property**. +3. Fill in the form: + - **Address** (street address) and optional **Unit Number** + - **City**, **State** and **Postal Code** + - **Property Type:** House, Apartment, Condo, Townhouse, Duplex, Commercial or Other + - **Monthly Rent** + - **Status:** choose **Available** for a property that is ready to rent + - Optional: **Bedrooms**, **Bathrooms**, **Square Feet** and **Description** +4. Click **Create Property**. -**Financial Information:** +**Checkpoint:** The property appears in the property list. -- **Monthly Rent:** $1,500.00 -- **Security Deposit:** $1,500.00 (typically equal to one month's rent) - -**Property Status:** - -- Select: **Available** (ready to rent) - -**Description (Optional):** - -- Enter a brief description of the property -- Example: "Beautiful 3-bedroom, 2-bathroom single-family home with large backyard. Recently renovated kitchen with modern appliances." - -### Save Property - -1. Click **"Save"** button at the bottom -2. You'll be redirected to the property list - -**✅ Checkpoint:** You should see your property in the list with status "Available". - -### Add Property Photo (Optional) - -1. Click on your property name to view details -2. Click **"Upload Photo"** button -3. Select an image file (max 10MB) -4. Photo appears in property profile +You can record expenses for a property from the panel beside the form (or later from the property page). --- -## 👥 Step 5: Add a Tenant (2 minutes) - -Now let's add a tenant who will rent this property. - -### Navigate to Tenants - -1. Click **"Tenant Management"** in left navigation -2. Click **"Tenants"** -3. Click **"Add Tenant"** button +## Step 4: Add a Tenant (2 minutes) -### Enter Tenant Details +1. Click **Tenants** in the left menu. +2. Click **Add Tenant**. +3. Fill in the form: + - **First Name**, **Last Name** and **Email** (required) + - Optional: **Phone Number**, **Date of Birth**, **Identification Number** + - Optional: **Emergency Contact Name** and **Emergency Contact Phone** + - Optional: **Notes** +4. Click **Create Tenant**. -**Personal Information:** - -- **First Name:** Jane -- **Last Name:** Doe -- **Email:** jane.doe@example.com -- **Phone:** (555) 123-4567 - -**Current Address (Optional but Recommended):** - -- Street Address: 456 Oak Avenue -- City: Anytown -- State: CA -- ZIP: 12345 - -**Emergency Contact (Optional):** - -- Name: John Doe (Spouse) -- Relationship: Spouse -- Phone: (555) 123-4568 - -### Save Tenant - -1. Click **"Save"** button -2. You'll be redirected to the tenant list - -**✅ Checkpoint:** You should see Jane Doe in the tenant list. - -**Note:** In a real-world scenario, you'd go through the full prospect-to-tenant journey (application, screening, approval). For this Quick Start, we're creating the tenant directly. +**Checkpoint:** The tenant appears in the tenant list. --- -## 📄 Step 6: Create a Lease (2 minutes) - -Let's create a lease agreement between your property and tenant. - -### Navigate to Leases +## Step 5: Create a Lease (2 minutes) -1. Click **"Lease Management"** in left navigation -2. Click **"Leases"** -3. Click **"Create Lease"** button +1. Click **Leases** in the left menu. +2. Click **Add Lease**. +3. Fill in the form: + - **Property** and **Tenant** (select from the dropdowns) + - **Start Date** and **End Date** (defaulted to current date and 12 months later respectively.) + - **Monthly Rent** and **Security Deposit** + - **Lease Type:** Term, Month-to-Month + - **Status:** new leases default to **Pending**; choose **Active** if the lease is ready to start. + - Optional: **Lease Terms** and **Notes** (add the terms of the lease and any additional notes. Lease term regulations can differ from region to region so enter the text relevant for your state, county, region, etc.) +4. Click **Create Lease**. -### Enter Lease Details +You are taken to the property page. Open the lease from **Leases** to see its details. -**Lease Information:** +**Checkpoint:** The lease appears in the lease list. -- **Property:** Select "123 Main Street House" from dropdown -- **Tenant:** Select "Jane Doe" from dropdown + -**Lease Terms:** +### Generate the Lease PDF (optional) -- **Start Date:** Choose today's date (or desired move-in date) - - Example: February 1, 2026 -- **End Date:** Choose one year from start date - - Example: January 31, 2027 -- **Monthly Rent:** $1,500.00 (pre-filled from property) -- **Security Deposit:** $1,500.00 (pre-filled from property) -- **Due Day:** 1 (rent due on 1st of each month) +1. Open the lease from the lease list. +2. Click **Generate PDF**. +3. Use **View PDF** or **Download PDF**. -**Payment Terms:** +### Lease actions -- **Late Fee Grace Period:** 5 days (rent due 1st, late fee applied on 6th) -- **Late Fee Amount:** $50.00 or 5% of rent -- **Payment Methods Accepted:** Check all that apply - - ☑ Cash - - ☑ Check - - ☑ Credit Card - - ☑ ACH - - ☑ Online Portal - -### Generate Lease - -1. Click **"Generate Lease"** button -2. System creates the lease with status: **Active** -3. Property status automatically changes to: **Occupied** - -**✅ Checkpoint:** You should see the new lease in the lease list with status "Active". - -### View Lease PDF (Optional) - -1. Click on the lease to view details -2. Click **"Download Lease PDF"** button -3. PDF opens showing complete lease agreement with all terms +The lease page also lets you **Edit Lease**, **Create Invoice**, **View Invoices** and **View Documents**, and provides actions for renewals, termination notices, early termination, move-out and converting to month-to-month. --- -## 💰 Step 7: Generate a Rent Invoice (1 minute) - -Let's create the first month's rent invoice. +## Step 6: Create an Invoice (1 minute) -### Navigate to Invoices +Invoices and payments do not appear in the left menu. Start from the lease: -1. Click **"Financial Management"** in left navigation -2. Click **"Invoices"** -3. Click **"Create Invoice"** button +1. Open the lease. +2. Click **Create Invoice** (this opens the invoice form with the lease selected and fields populated by default using lease details). +3. Fill in the form: + - **Invoice Number** and **Invoice Date** (Invoice number is autogenerated and should not be modified. Invoice date defaults to current date, but can be modified as needed.) + - **Due Date** (keep the default, five days from current date or enter a new due date) + - **Lease** (already selected) + - **Description** (for example "First month's rent" or keep the default) + - **Amount** (enter amount or keep the default which is based on the lease agreement) + - **Status:** Pending (A new invoice is pending by default. When a payment is recorded, the invoice's payment status is updated) + - Optional: **Notes** +4. Click **Create Invoice**. -### Enter Invoice Details +You can find all invoices later from the lease's **View Invoices** button, from **Outstanding Invoices** on the dashboard, or from the **Documents** page. -**Invoice Information:** +**Checkpoint:** The invoice shows status **Pending** with your due date. -- **Lease:** Select "Jane Doe - 123 Main Street House" from dropdown -- **Invoice Type:** Rent (from dropdown) -- **Description:** "February 2026 Rent" + -**Financial Details:** - -- **Amount:** $1,500.00 (pre-filled from lease monthly rent) -- **Due Date:** February 1, 2026 -- **Issue Date:** Today's date (auto-filled) +--- -**Status:** +## Step 7: Record a Payment (1 minute) -- **Invoice Status:** Pending (default) +1. Open the invoice. +2. Click **Record Payment**. +3. Fill in the form: + - **Invoice** (already selected) + - **Payment Date** (defaults to current date) + - **Amount** (defaults to the invoice amount. Partial payments may be accepted.) + - **Payment Method:** Online Payment, Debit Card, Credit Card, Check, Cash, Bank Transfer or Other (Online payment is the default) + - Optional: **Notes** +4. Click **Record Payment**. -### Save Invoice +**Checkpoint:** Open the invoice again; it should show the payment. -1. Click **"Save"** button -2. Invoice is created and added to the list + -**✅ Checkpoint:** You should see the invoice with status "Pending" and due date of February 1, 2026. +### Payment receipt (optional) -**Note:** In production, rent invoices are automatically generated monthly by the background task system. For this Quick Start, we're creating one manually. +Open the payment and use **Generate Receipt**, then **View Receipt** or **Download Receipt**. --- -## 🏦 Step 8: Record a Payment (1 minute) - -Now let's record that the tenant paid their rent. +## Step 8: Record an Inspection (3 minutes) -### Navigate to Payments +The **Inspections** page is a routine inspection schedule by property: it shows which properties are scheduled, due soon, overdue or not yet scheduled. When a property is created, a routine inspection is automatically scheduled due within the first 90 days. Completion of an inspections automatically schedules another inspection for 12 months later. In essence, routine inspections are auto-generated and scheduled annually. -1. Stay in **"Financial Management"** -2. Click **"Payments"** -3. Click **"Record Payment"** button +1. Click **Inspections** in the left menu. +2. On the property you want, click the clipboard icon (**Create Inspection**). You can also start from the property's own page. +3. Fill in **Inspection Details:** + - **Inspection Date** + - **Inspection Type:** Routine, Move-In, Move-Out or Maintenance + - **Inspected By** +4. Work through the checklist sections: **Exterior, Interior, Kitchen, Bathroom** and **Systems**. Mark each item as good or not good and add notes for any issues. +5. Set the **Overall Condition** (Excellent, Good, Fair or Poor) and add **General Notes** and **Action Items Required**. +6. Click **Save Inspection**. -### Enter Payment Details +**Checkpoint:** The inspection appears on the property's inspection history. -**Payment Information:** +Open the saved inspection to use **Generate PDF**, then **View PDF** or **Download PDF**. -- **Invoice:** Select "February 2026 Rent - Jane Doe" from dropdown -- **Payment Method:** Check (or select what applies) + -**Financial Details:** +--- -- **Amount:** $1,500.00 (full rent payment) -- **Payment Date:** Today's date (or actual payment date) -- **Payment Reference:** Check #1234 (optional but recommended) +## Congratulations -**Notes (Optional):** +You have completed the Quick Start Guide. You have: -- "Check received and deposited on [date]" +- Installed Nine +- Created your account and organization +- Added a property +- Added a tenant +- Created a lease +- Created an invoice +- Recorded a payment +- Recorded an inspection -### Save Payment +--- -1. Click **"Save"** button -2. Payment is recorded -3. Invoice status automatically updates to: **Paid** -4. Invoice "Amount Paid" field updates to $1,500.00 +## What's Next -**✅ Checkpoint:** When you view the invoice list, the invoice should now show status "Paid" with green indicator. +### Explore more features -### View Payment Receipt (Optional) +- **Properties:** track expenses, upload documents, and mark properties as Under Renovation or Off Market. +- **Repairs:** record and track repair work and costs per property. +- **Calendar:** see events in a monthly calendar or list view. +- **Documents:** find lease PDFs, invoices and receipts in one place. +- **Reports:** Income Statement, Rent Roll, Property Performance and Tax Report. +- **Notifications:** use the notification bell and set your preferences under **Notifications**. +- **Late fees:** configure under **Application** (see Settings below). -1. Click on the payment to view details -2. Click **"Generate Receipt"** button -3. PDF receipt generated showing payment confirmation + --- -## 🔍 Step 9: Schedule an Inspection (1 minute) - -Let's schedule a move-in inspection for the property. +## Uninstalling Nine -### Navigate to Inspections +**IMPORTANT: BEFORE GETTING STARTED CREATE A DATABASE BACKUP AND DOWNLOAD/COPY IT TO A LOCATION OUTSIDE OF THE APPLICATION.** -1. Click **"Maintenance & Inspections"** in left navigation -2. Click **"Inspections"** -3. Click **"Schedule Inspection"** button +An encrypted or an unencrypted backup can be generated and downloaded to the local hard drive, a USB drive, or a cloud storage location. -### Enter Inspection Details +**SEE THE [Database Management Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Database-Management-Guide.md)** -**Inspection Information:** +**BEFORE YOU BEGIN, CLOSE ALL RUNNING INSTANCES OF NINE.** -- **Property:** Select "123 Main Street House" -- **Inspection Type:** Move-In (from dropdown) -- **Inspection Date:** Choose today's date or soon after move-in +### Linux -**Scheduled By:** +You can use the removal script (recommended) or follow the manual steps below it. -- Your name (auto-filled) +#### Using the removal script -**Notes (Optional):** +`nine-removal.sh` is in the `Utilities` folder of the Linux download, next to `install-desktop-integration.sh`. If you used the desktop integration script, it was also copied to `~/Applications/Nine/Utilities`, so you can run it from there. It undoes what the desktop integration script did, and removes your data and encryption key only when you ask it to. -- "Initial move-in inspection before tenant occupancy" +```bash +chmod +x nine-removal.sh -### Save Inspection +# Preview what would be removed; nothing is changed +./nine-removal.sh --dry-run -1. Click **"Schedule"** button -2. Inspection is added to calendar and inspection list +# Remove one version only (Option 1 below); data and encryption key are kept +./nine-removal.sh --only Nine-1.2.0-x86_64.AppImage -**✅ Checkpoint:** You should see the inspection scheduled on the calendar and in the inspection list. +# Remove the launcher entry, icon and AppImages; data and encryption key are kept +./nine-removal.sh -### Complete Inspection (Optional) +# Remove the launcher entry, icon, AppImage and data; encryption key is kept +./nine-removal.sh --remove-data -Later, when you perform the inspection: +# Remove the launcher entry, icon, AppImage and encryption key; data is kept +./nine-removal.sh --remove-keychain -1. Click on the inspection from the list -2. Click **"Start Inspection"** button -3. Go through **26-item checklist:** - - **Exterior** (4 items): Roof, Siding, Windows, Landscaping - - **Interior** (6 items): Walls, Floors, Ceilings, Doors, Closets, Light Fixtures - - **Kitchen** (4 items): Appliances, Cabinets, Countertops, Sink/Plumbing - - **Bathroom** (4 items): Fixtures, Toilet, Sink, Shower/Tub - - **Systems** (8 items): HVAC, Electrical, Plumbing, Water Heater, etc. -4. Mark each item: **Pass** / **Fail** / **Needs Repair** -5. Add notes for any issues found -6. Click **"Complete Inspection"** -7. Click **"Generate PDF Report"** +# Remove the encryption key only; the application, database, and configuration files are kept +./nine-removal.sh --remove-keychain-only ---- +# Remove everything, including all data and the encryption key (Option 2 below) +./nine-removal.sh --all +``` -## 🎉 Congratulations! +- The script asks before it removes anything. Removing the data or the encryption key also requires typing `DELETE`. +- `--all` is the same as `--remove-data --remove-keychain`. Use those two options separately to remove only your data or only the encryption key. +- It will not run while Nine is open. +- It only knows about AppImages in `~/Applications/Nine`. Delete any AppImage stored elsewhere yourself. +- Run `./nine-removal.sh --help` for all options. -**You've successfully completed the Quick Start Guide!** +#### Manual steps -In just 15 minutes, you've learned how to: +Choose the option that matches what you want to remove. -- ✅ Install Nine -- ✅ Create your organization -- ✅ Register your user account -- ✅ Add a property -- ✅ Add a tenant -- ✅ Create a lease -- ✅ Generate a rent invoice -- ✅ Record a payment -- ✅ Schedule an inspection +#### Option 1: Remove one version only ---- +Use this when you keep another version of Nine installed. Your data stays in place. -## 🧭 What's Next? +1. Delete that version's AppImage: in your file manager, right-click it and choose "Delete", "Delete Permanently", or "Move to Trash". If the desktop integration script was used, the AppImages are in `~/Applications/Nine`. From the terminal: -### Explore More Features +```bash +rm ~/Applications/Nine/ # for example Nine-1.2.0-x86_64.AppImage +``` -**Property Management:** +2. If the Nine launcher entry pointed to the version you removed, it no longer works. Run `install-desktop-integration.sh` again with the version you kept to fix it. -- Add up to nine (9) properties -- Upload property documents (certificates, insurance, photos) -- Mark properties as Under Renovation or Off Market -- Track property value and appreciation +**Do not delete `~/.config/Nine` or the keychain entry in this case.** They hold the databases and the database encryption key for **every** version of Nine on this computer. -**Tenant Workflow:** +#### Option 2: Remove Nine completely -- Use the **Prospect-to-Tenant** journey for new tenants: - 1. Add Prospect (inquiry phase) - 2. Schedule Tour - 3. Submit Rental Application - 4. Screen Application (background/credit checks) - 5. Approve/Deny Application - 6. Generate Lease Offer - 7. Tenant Accepts Lease - 8. Automatic Tenant Creation +Use this when you no longer need Nine or any of its data. **This permanently deletes the databases and backups of all versions.** -**Financial Management:** +1. Delete the AppImage files. Delete them in your file manager if they are stored somewhere other than `~/Applications/Nine`. -- Set up **recurring rent invoices** (auto-generated monthly) -- Configure **late fees** (grace period + amount/percentage) -- Generate **financial reports** (income, expenses, payment history) -- Track **security deposits** and annual dividends +2. Open the terminal and run the commands below. -**Maintenance & Inspections:** +```bash +# Remove application support, configuration, resource and database files +# (the default location; it is $XDG_CONFIG_HOME/Nine if that variable is set) +rm -rf ~/.config/Nine -- Create **maintenance requests** from tenants -- Assign requests to vendors -- Track repair costs and completion -- Schedule **routine inspections** (quarterly, semi-annual, annual) -- Generate inspection reports +# RUN THESE COMMANDS IF THE DESKTOP INTEGRATION SCRIPT WAS USED. -**Calendar & Scheduling:** +# Remove all installed releases and the scripts copied to the Utilities folder +rm -rf ~/Applications/Nine -- View all events in **monthly calendar** -- Schedule **property tours** for prospects -- Track **lease expiration dates** -- Set **payment due date reminders** +# Remove the desktop integration entry (GNOME) +rm ~/.local/share/applications/nine.desktop -**Notifications:** +# Remove the desktop icon file +rm ~/.local/share/icons/hicolor/512x512/apps/nine.png -- Configure **email notifications** (SendGrid) -- Enable **SMS alerts** (Twilio) -- Customize **notification preferences** per user -- View **notification history** in Notification Center +# Refresh the desktop database +update-desktop-database ~/.local/share/applications +``` -**Background Automation:** +3. Only if you ever turned on database encryption, remove the stored encryption key. This key is shared by every version of Nine on this account. Run the command only when you no longer need any encrypted database or encrypted backup, because they cannot be opened without it. -- Let the system automatically: - - Apply late fees after grace period - - Send lease expiration warnings (60/30/14 days) - - Calculate and distribute security deposit dividends - - Schedule routine inspections - - Clean up old data +```bash +secret-tool clear key-type database-encryption-Nine-Electron +``` ---- +### Windows -## 📚 Additional Resources +## Additional Resources ### Documentation -- **Release Notes** - What's new in v1.0.0 -- **User Guide** - Comprehensive 10-chapter guide covering all features -- **Administrator Guide** - System configuration and management -- **Database Management Guide** - Backup, restore, troubleshooting +- **[CHANGELOG](https://github.com/xnodeoncode/Nine/blob/main/CHANGELOG.md)** - What's new in each release +- **[Database Management Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Database-Management-Guide.md)** - Backup, restore and troubleshooting +- **[Compatibility Matrix](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Compatibility-Matrix.md)** - Version compatibility and upgrade paths ### Getting Help -**Support Channels:** - -- 📧 **Email Support:** cisguru@outlook.com -- 🐛 **Report Bugs:** [GitHub Issues](https://github.com/xnodeoncode/nine/issues) -- 💡 **Request Features:** [GitHub Discussions](https://github.com/xnodeoncode/nine/discussions) -- 📖 **Documentation:** `/Documentation/v1.0.0/` - -**Community:** - -- Star the project on GitHub -- Contribute to development -- Share feedback and suggestions +- **Email Support:** [cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20Quick%20Start%20Guide) +- **Report Bugs:** [GitHub Issues](https://github.com/xnodeoncode/Nine/issues) +- **Request Features:** [GitHub Discussions](https://github.com/xnodeoncode/Nine/discussions) +- **Documentation:** [Documentation](https://github.com/xnodeoncode/Nine/tree/main/Documentation) --- -## ⚙️ Settings & Configuration - -### Essential Settings to Configure - -**Organization Settings:** - -1. Navigate to **Settings** → **Organization** -2. Update business hours, contact information, logo +## Settings & Configuration -**User Settings:** +**Organization:** click **Organization** in the left menu (administrators) to edit your organization's details. -1. Navigate to **Settings** → **Profile** -2. Update personal information, password, notification preferences +**Your account:** click your name or email in the navigation to open **Account → Manage**. From there you can update your profile and change your password. -**Notification Settings:** +**Notifications:** open **Notifications → Preferences** to choose which in-app notifications you receive. -1. Navigate to **Settings** → **Notifications** -2. Enable/disable email, SMS, in-app notifications -3. Configure SendGrid (email) and Twilio (SMS) API keys if needed +**Application settings:** click **Application** in the left menu. This page includes the **Late Fee Settings:** -**Database Settings:** +- **Enable Late Fees** and **Auto-apply** +- **Grace Period** (days): the default is 5 days. Check the requirements where your property is and change it if they differ. +- **Late Fee Percentage** (and maximum fee) -1. Navigate to **Settings** → **Database** -2. Configure **automatic backups:** - - Enable scheduled backups - - Set backup frequency (daily, weekly, monthly) - - Choose backup time (default: 2 AM) -3. Monitor database health and size +**Database settings:** open the **Database Settings** page from **Application** (see "Backups and the database" below). -**Financial Settings:** +**Inspection scheduling:** the routine inspection interval is set per property on the property's edit page, not in a global setting. -1. Navigate to **Settings** → **Financial** -2. Configure **late fees:** - - Grace period (default: 5 days) - - Late fee amount ($50 or 5% of rent) - - Apply late fees automatically: Yes/No - -**Inspection Settings:** - -1. Navigate to **Settings** → **Inspections** -2. Configure **routine inspection frequency:** - - None, Quarterly, Semi-Annual, Annual -3. Enable auto-scheduling of move-in inspections + --- -## 🔒 Security & Data Protection - -### Best Practices +## Security & Data Protection -**Password Management:** +**Passwords:** use a strong, unique password (Nine requires at least 12 characters). Change it periodically and consider a password manager. -- Use a **strong, unique password** -- Enable **password manager** for secure storage -- Change password periodically +**Session security:** Nine signs you out after **18 minutes of inactivity** and warns you shortly before. Always log out when leaving your computer unattended. -**Data Backups:** +**Database encryption:** database encryption is optional. Turn it on in **Database Settings → Database Encryption**; you create a password that is required to open the database. If encryption is off, the database file is stored unencrypted on your computer. Keep your password somewhere safe; it cannot be recovered. -- Enable **automatic daily backups** -- Store backups in **multiple locations** (local + cloud) -- Test restore process periodically +**Archived and deleted records:** records can be archived and restored, and some can be permanently deleted. The delete confirmation lists the related records that will be affected. -**Session Security:** +**Audit trail:** Nine records who created or changed a record and when. -- Application auto-locks after **18 minutes of inactivity** -- Always **log out** when leaving computer unattended - -**Data Privacy:** - -- All tenant data encrypted at rest -- Soft delete enabled (data recoverable if accidentally deleted) -- Audit trails track all data changes (who, when, what) + --- -## ❓ Common Questions - -### Q: Can I import data from another property management system? +## Common Questions -**A:** Not directly in v1.0.0. You'll need to manually enter your properties, tenants, and leases. Data import features are planned for a future release. +### Can I import data from another property management system? -### Q: What happens when I reach the 9-property limit? +Not directly. Enter your properties, tenants and leases manually, or restore from a Nine backup. -**A:** When you try to add a 10th property, you'll see an upgrade message explaining that Nine is limited to 9 properties. You can either: +### Can I have more than 4 users? -- Remove an inactive property to add a new one -- Upgrade to Nine Professional (future release) for unlimited properties +Nine is limited to 4 accounts per organization: 1 system account and 3 login accounts. -### Q: Can I have more than 3 users? + -**A:** No, Nine is limited to 3 users (1 system account + 2 login users). This is a product-level restriction. For more users, you'll need to upgrade to Nine Professional when available. +### Is my data stored in the cloud? -### Q: Is my data stored in the cloud? +No. Nine stores all data locally on your computer in a SQLite database file. The app does not send your data over the internet. -**A:** No, Nine stores all data **locally on your computer** in a SQLite database file. Your data never leaves your device unless you choose to enable email/SMS notifications or back up to a cloud service. +### Do I need internet access? -### Q: Do I need internet access? +No. Nine works fully offline. Links to external documentation open in your default web browser. -**A:** **No** for core features - the application works completely offline. **Yes** for optional features: +### How do I back up my data? -- Email notifications (SendGrid) -- SMS notifications (Twilio) -- Future online payment processing +Open **Database Settings** and use **Create Manual Backup**. Nine also creates a backup automatically before each database migration and encryption change, and keeps the 10 most recent backups. Use **Download** on a backup to copy it to an external drive or cloud storage. -### Q: How do I back up my data? +### How do I restore a backup? -**A:** Navigate to **Settings** → **Database** → **Backup & Restore**: +In **Database Settings → Available Backups**, use **Restore** on the backup you want (use **Preview** first to look inside it). You can also use **Upload Backup File** to bring in a backup from another location. Nine saves a copy of the current database before restoring. -- Click **"Create Backup"** for manual backup (recommended before major changes) -- Enable **"Schedule Automatic Backups"** for daily/weekly backups -- Backups stored in: `Data/Backups/` folder -- Copy backups to external drive or cloud storage for safety +### Can I run this on a Mac? -### Q: What if I accidentally delete something? +Not in this release. Use a Windows or Linux computer. -**A:** Nine uses **soft delete** - deleted records are marked as deleted but not permanently removed. Contact support for data recovery assistance if needed. +### Is there a mobile app? -### Q: Can I run this on a Mac? +Not yet. -**A:** Not in v1.0.0. macOS support is planned for a future release. For now, use a Windows or Linux computer. - -### Q: Is there a mobile app? - -**A:** Not yet. A mobile companion app (view-only) is planned for a future release. + --- -## 🐛 Troubleshooting +## Troubleshooting ### Application won't start **Windows:** -- Right-click installer → "Run as Administrator" -- Check if antivirus is blocking the application -- Ensure .NET 10 Runtime is installed (bundled with app) +- Right-click the installer and choose "Run as Administrator" +- Check whether antivirus is blocking the application **Linux:** -- Ensure AppImage has execute permissions: `chmod +x Nine*.AppImage` +- Make sure the AppImage is executable: `chmod +x Nine*.AppImage` - Check system logs: `journalctl -xe` -- Verify dependencies installed (usually auto-included) -### Database connection error +### Database error or "Database Locked" -1. Navigate to **Settings** → **Database** -2. Click **"Check Database Health"** -3. If corrupted, click **"Restore from Backup"** -4. If no backup, click **"Reset Database"** (⚠️ loses all data) +- If you enabled encryption, enter your database password on the unlock screen. +- In **Database Settings**, click **Check Health**. +- If the database is corrupted, try **Auto-Recover from Corruption**, or **Restore** a backup. +- As a last resort, **Reset Database (Create New Blank)** creates an empty database (this removes your data from the active database). ### Can't log in -- Verify email and password are correct -- Check Caps Lock is off -- If forgotten password, use **"Reset Password"** link -- If still stuck, check logs in `Data/Logs/` folder - -### Email notifications not working +- Verify your email and password and check Caps Lock. +- After repeated failed attempts the account can be locked temporarily; wait and try again. +- If you forgot your password, work with an administrator who has access to unlock your account. -1. Navigate to **Settings** → **Notifications** -2. Verify SendGrid API key is correct -3. Check SendGrid account is active and not rate-limited -4. View error logs in **Settings** → **System** → **Logs** - -### Application is slow - -- Check database size: **Settings** → **Database** → **Database Size** -- Run database optimization: **Settings** → **Database** → **Optimize** -- Close other applications to free up memory -- Consider hardware upgrade if below minimum specs + --- -## 📞 Support - -Need help? We're here for you! +## Support -**Email:** cisguru@outlook.com -**GitHub:** [https://github.com/xnodeoncode/nine](https://github.com/xnodeoncode/nine) +**Email:** [cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20Quick%20Start%20Guide) +**GitHub:** [https://github.com/xnodeoncode/Nine](https://github.com/xnodeoncode/Nine) -**When contacting support, please include:** +When contacting support, please include: -1. **Version number** (Settings → About) -2. **Operating system** (Windows/Linux) -3. **Description of issue** (what happened vs what you expected) -4. **Steps to reproduce** (how to recreate the problem) -5. **Screenshots** (if applicable) -6. **Log files** (Settings → System → Export Logs) +1. **Version number** (see the **About** page) +2. **Operating system** (Windows or Linux) +3. **What happened** compared with what you expected +4. **Steps to reproduce** the problem +5. **Screenshots**, if applicable --- -## 🎓 Next Steps +## Next Steps -**Ready to dive deeper?** - -1. **Read the User Guide** - Comprehensive 10-chapter guide covering every feature -2. **Configure automation** - Set up late fees, recurring invoices, backups -3. **Explore reports** - Generate financial and operational reports -4. **Customize settings** - Tailor the application to your workflow -5. **Join the community** - Connect with other landlords using Nine - -**Thank you for choosing Nine!** 🏠 - -We hope this Quick Start Guide helped you get up and running quickly. Enjoy managing your properties with confidence! - ---- +1. **Add your remaining properties and tenants.** +2. **Set up late fees** under **Application**. +3. **Explore reports** under **Reports**. +4. **Review Database Settings** and decide whether to enable encryption. -**Document Version:** 1.1 -**Last Updated:** February 18, 2026 -**Author:** CIS Guru with GitHub Copilot +Thank you for choosing Nine. diff --git a/Documentation/Third-Party-Licensing-Notices.md b/Documentation/Third-Party-Licensing-Notices.md new file mode 100644 index 0000000..1bed266 --- /dev/null +++ b/Documentation/Third-Party-Licensing-Notices.md @@ -0,0 +1,179 @@ +# Nine. - Third-Party Licensing Notices + +**Version:** 1.2.0 +**Last Updated:** November 16, 2026 + +--- + +Nine is licensed under the [MIT License](../LICENSE). Nine depends on third-party software that is licensed separately. This document lists those components and their licenses so that people who install, operate, or redistribute Nine can review the terms that apply to them. + +> This document is informational and is not legal advice. License details were taken from package metadata in the local NuGet cache and from the vendors' published terms at the time of writing. Re-check them when dependencies are upgraded. + +_Last reviewed: 2026-11-12 (Nine dependency versions as listed below)._ + +--- + +## Action Required: QuestPDF + +Nine uses **QuestPDF** to generate its PDF documents (leases, lease renewals, invoices, payment receipts, inspections, checklists, and financial reports). QuestPDF is **not** covered by Nine's MIT license. It has its own license terms, and **you are responsible for confirming that you are eligible to use it.** + +| Item | Detail | +| ------------------------- | -------------------------------------------------------------------------------------------- | +| Package / version | `QuestPDF` 2025.12.1 (referenced in `1-Nine.Infrastructure` and `4-Nine`) | +| Vendor | Marcin Ziąbek (QuestPDF), | +| License selection in code | Each PDF generator sets `QuestPDF.Settings.License = LicenseType.Community` | +| Use in Nine | Only for documents Nine itself creates. Nine does not expose general-purpose PDF generation. | + +### Eligibility summary (verify with QuestPDF) + +The QuestPDF Community License is free for: + +- Individuals and organizations with annual gross revenue under **USD 1,000,000** (measured across entities under common control). +- Charitable organizations and qualifying academic institutions. +- Open-source projects distributed under an OSI-approved license. + +A **paid license is required** for: + +- Organizations above the revenue threshold. +- Government and public-sector organizations (other than qualifying academic institutions). +- Publicly traded companies. + +Eligibility is self-certified by the user. See the vendor's current terms: + +- Community License: +- License Selection Guide: +- Pricing and FAQ: + +### Which terms apply to the bundled version + +The QuestPDF license published with a given release governs that release. The package metadata for `QuestPDF 2025.12.1` (file `PackageLicense.md` inside the NuGet package) presents a "Community MIT License" with the same USD 1M small-business / open-source / non-profit selection guide. The vendor's website now publishes a newer Community License that describes itself as a source-available commercial license. When upgrading QuestPDF, read the license shipped with the new version before upgrading. + +### Open question + +It has not been confirmed with QuestPDF whether a business that installs and runs a compiled copy of Nine (without writing code that calls QuestPDF) needs its own QuestPDF license. See the Phase 0 / Option A2 notes in the PDF license plan. Until QuestPDF replies, treat each installer as responsible for their own eligibility. + +### Bundled QuestPDF third-party components + +The QuestPDF package ships additional components under their own licenses (license texts are included in the package's `ExternalDependencyLicenses` and `LatoFont` folders): Skia, HarfBuzz, ICU, FreeType-related libraries, libjpeg-turbo, libpng, libwebp, zlib, expat, qpdf, wuffs, and the Lato font (SIL Open Font License). + +--- + +## Runtime Dependencies (shipped with Nine) + +Licenses below were read from each package's `.nuspec` in the NuGet cache unless noted. + +| Component | Version | License | Notes | +| ---------------------------------------------------- | --------- | ---------- | ----------------------------------------------------------- | +| Microsoft.AspNetCore.Identity.EntityFrameworkCore | 10.0.1 | MIT | Authentication / user management | +| Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore | 10.0.1 | MIT | | +| Microsoft.AspNetCore.Components.Web | 10.0.1 | MIT | Blazor components | +| Microsoft.AspNetCore.SignalR.Client | 10.0.1 | MIT | | +| Microsoft.EntityFrameworkCore | 10.0.1 | MIT | | +| Microsoft.EntityFrameworkCore.Sqlite | 10.0.1 | MIT | | +| Microsoft.Data.Sqlite.Core | 10.0.9 | MIT | | +| Microsoft.Extensions.Logging.Abstractions | 10.0.1 | MIT | | +| Microsoft.Extensions.Options | 10.0.1 | MIT | | +| System.Security.Cryptography.ProtectedData | 9.0.0 | MIT | | +| System.Security.Cryptography.Pkcs | 9.0.21 | MIT | | +| SQLitePCLRaw.bundle_e_sqlcipher | 2.1.11 | Apache-2.0 | SourceGear. Bundles native SQLCipher builds (see below) | +| SendGrid | 9.29.3 | MIT | Email delivery client | +| Twilio | 7.14.0 | MIT | SMS client. License file at the project's GitHub repository | +| ElectronNET.Core / ElectronNET.Core.AspNet | 0.4.1 | MIT | Desktop host | +| QuestPDF | 2025.12.1 | See above | **Action required — see QuestPDF section** | + +### Transitive dependencies (pulled in by the packages above) + +Found with `dotnet list Nine.sln package --include-transitive`; licenses read from each package's `.nuspec` (non-Microsoft packages only). + +| Component | Version | License | Pulled in by | +| ------------------------------------------------------------------------------------------- | --------------- | ---------- | -------------------------------------------------- | +| ElectronNET.Core.API | 0.4.1 | MIT | ElectronNET.Core | +| SocketIOClient, SocketIO.Core, SocketIO.Serializer.Core, SocketIO.Serializer.SystemTextJson | 3.1.2 | MIT | ElectronNET.Core (host/app communication) | +| Newtonsoft.Json | 13.0.1 / 13.0.3 | MIT | SendGrid / Twilio / ElectronNET | +| starkbank-ecdsa | 1.3.3 | MIT | SendGrid | +| SQLitePCLRaw.core, .provider.e_sqlcipher, .lib.e_sqlcipher | 2.1.11 | Apache-2.0 | SQLitePCLRaw.bundle_e_sqlcipher | +| SQLitePCLRaw.bundle_e_sqlite3, .provider.e_sqlite3, .lib.e_sqlite3 | 2.1.11 | Apache-2.0 | Microsoft.EntityFrameworkCore.Sqlite | +| Humanizer.Core | 2.14.1 | MIT | Microsoft.EntityFrameworkCore.Design (design-time) | +| Mono.TextTemplating | 3.0.0 | MIT | Microsoft.EntityFrameworkCore.Design (design-time) | + +Transitive Microsoft packages (`Microsoft.*`, `System.*`) are omitted; they are MIT licensed. Twilio, SendGrid, Newtonsoft.Json (via SendGrid/Twilio) and starkbank-ecdsa will be removed when the SendGrid and Twilio integrations are phased out. + +### SQLCipher (database encryption) + +`SQLitePCLRaw.bundle_e_sqlcipher` includes `SQLitePCLRaw.lib.e_sqlcipher`, which contains platform-specific native builds of **SQLCipher**. The NuGet package notes these are unofficial, unsupported builds. SQLCipher Community Edition is distributed by Zetetic under a BSD-style license that requires its copyright notice and license text to be reproduced in documentation or other materials supplied with binary distributions. **To do:** confirm the exact SQLCipher license text and add it to the notices that ship with binary packages. + +### Electron (desktop builds) + +The desktop build uses ElectronNET.Core to host the application in **Electron** (`ElectronVersion` 30.4.0, `ElectronBuilderVersion` 26.0 in `4-Nine/Nine.csproj`). Electron and electron-builder are MIT licensed. Electron bundles **Chromium** and other third-party components under their own licenses (primarily BSD-style, plus others); these license texts are included in the Electron distribution as `LICENSES.chromium.html` and `LICENSE`. Packaged desktop builds (AppImage, Flatpak, installers) should keep these files. **To do:** confirm they are retained in each packaging target. + +### .NET runtime + +Nine targets .NET 10. The .NET runtime and ASP.NET Core framework are MIT licensed (Microsoft / .NET Foundation). + +--- + +## Front-End Assets + +| Component | Version | License | Source | +| ----------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| Bootstrap | 5.3.3 | MIT | Referenced by the app: `4-Nine/wwwroot/lib/bootstrap/dist/css/` (license header in the CSS file) | +| Bootstrap (libman copy) | 5.3.8 | MIT | `4-Nine/libman.json` restores `bootstrap@5.3.8` into `wwwroot/lib/bootstrap/css/`; not referenced by `App.razor` | +| Bootstrap Icons | 1.13.1 | MIT | Bundled locally via LibMan in `4-Nine/wwwroot/lib/bootstrap-icons` (CSS, woff, woff2 and the MIT `LICENSE`); no CDN request | + +> **Note:** There are two Bootstrap copies with different versions (5.3.3 in `dist/`, used by `App.razor`; 5.3.8 from `libman.json`). Consolidate them so the shipped version is clear. + +> **npm packages:** the repository has no `package.json` or lockfile, so there are no npm dependencies in the codebase itself. Front-end libraries are managed through LibMan (`libman.json`, cdnjs provider) and static files. The desktop build uses npm tooling (Electron, electron-builder) through ElectronNET.Core at build time; those are covered in the Electron section and are not listed by `dotnet list`. + +> **Note:** Bootstrap Icons used to load from the jsDelivr CDN at runtime. It is now bundled locally and the Content-Security-Policy no longer allows `cdn.jsdelivr.net`, so any remaining CDN dependency is blocked rather than silently fetched. + +--- + +## Development and Test Dependencies (not shipped to end users) + +| Component | Version | License | +| ------------------------------------ | ------- | ---------- | +| bUnit | 2.7.2 | MIT | +| AngleSharp | 1.5.0 | MIT | +| xUnit | 2.9.3 | Apache-2.0 | +| xunit.runner.visualstudio | 3.1.4 | Apache-2.0 | +| Microsoft.NET.Test.Sdk | 17.14.1 | MIT | +| coverlet.collector | 6.0.4 | MIT | +| Microsoft.EntityFrameworkCore.Design | 10.0.1 | MIT | +| Microsoft.EntityFrameworkCore.Tools | 10.0.1 | MIT | + +FluentAssertions was removed from the test projects in favor of xUnit `Assert` because FluentAssertions 8.x is under the Xceed commercial license (free for non-commercial use only). + +--- + +## Items to Complete + +- [ ] Hear back from QuestPDF about distributing Nine with QuestPDF and downstream business use (see the PDF license plan). +- [x] Surface the QuestPDF notice in the README and the in-app About page. _Done on `feature/Release-Readiness-1.2.0`._ Still to do: public information pages / website. +- [x] Add the SQLCipher license text to binary distributions. _Done: `4-Nine/wwwroot/licenses/SQLCipher-LICENSE.txt` ships with the app (static web asset under `resources/bin/wwwroot/licenses`). Verify in the rebuilt Linux and Windows packages._ +- [x] Confirm Electron / Chromium license files ship in the Linux AppImage. _Audited 2026-11-12: `LICENSE.electron.txt` and `LICENSES.chromium.html` are present in both `linux-unpacked/` and the extracted AppImage._ +- [ ] Confirm Electron / Chromium license files in any other packaged desktop build (Flatpak, Windows, macOS). _Only the Linux AppImage was found in the publish output._ +- [x] Ship a notices file and Nine's `LICENSE` in every package. _Done: `4-Nine/wwwroot/licenses/` contains `THIRD-PARTY-NOTICES.txt`, `Nine-LICENSE.txt`, the .NET, SQLitePCLRaw, ElectronNET, SocketIOClient, Newtonsoft.Json, SendGrid, Twilio, starkbank-ecdsa, Bootstrap and Bootstrap Icons licenses, and QuestPDF's own license plus its bundled Skia/HarfBuzz/ICU/etc. and Lato font licenses. Verify in the rebuilt packages._ +- [x] Bundle Bootstrap Icons locally instead of using the CDN. _Done on `feature/Bundle-Bootstrap-Icons`; icons confirmed served locally in DevTools._ +- [ ] Re-review this document whenever dependencies change (`dotnet list package` for each project). + +## Where the Shipped License Files Live + +`4-Nine/wwwroot/licenses/` is served by the app (no internet needed) and packaged under `resources/bin/wwwroot/licenses/`. +The in-app page `/licenses` ([Licenses.razor](../4-Nine/Features/Administration/Settings/Pages/Licenses.razor)) lists each component with its version and links to +these files; it is linked from the About page and from Application Settings. The files are a snapshot: they are the licenses that +came with the component versions in this release. **When a component or the .NET runtime is upgraded, verify the license, replace +the file here, and update the version in `Licenses.razor`** (and `THIRD-PARTY-NOTICES.txt`): + +- `questpdf/` is copied from the QuestPDF NuGet package (`PackageLicense.md`, `ExternalDependencyLicenses/`, `LatoFont/OFL.txt`). +- `dotnet/` is copied from the `microsoft.netcore.app.runtime.*` and `microsoft.aspnetcore.app.runtime.*` packages (`LICENSE`, `THIRD-PARTY-NOTICES`). +- The remaining files are the upstream license files for each package (see `THIRD-PARTY-NOTICES.txt`). + +## How to Refresh This List + +```bash +dotnet list Nine.sln package --include-transitive +``` + +For each package, read the `license` element in its `.nuspec` under `~/.nuget/packages///`, and review any `LICENSE` / `ExternalDependencyLicenses` files in the package. + +`dotnet list` only covers NuGet packages. Also check `4-Nine/libman.json` (LibMan front-end libraries), the static files under `wwwroot/`, any external URLs in `4-Nine/Shared/App.razor`, and the Electron / electron-builder versions in `4-Nine/Nine.csproj`. diff --git a/Documentation/images/icons/LICENSE b/Documentation/images/icons/LICENSE new file mode 100644 index 0000000..f952439 --- /dev/null +++ b/Documentation/images/icons/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019-2024 The Bootstrap Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Documentation/images/icons/alarm.svg b/Documentation/images/icons/alarm.svg new file mode 100644 index 0000000..523abf3 --- /dev/null +++ b/Documentation/images/icons/alarm.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/archive.svg b/Documentation/images/icons/archive.svg new file mode 100644 index 0000000..9317b5c --- /dev/null +++ b/Documentation/images/icons/archive.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/arrow-repeat.svg b/Documentation/images/icons/arrow-repeat.svg new file mode 100644 index 0000000..cb371e4 --- /dev/null +++ b/Documentation/images/icons/arrow-repeat.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/bar-chart.svg b/Documentation/images/icons/bar-chart.svg new file mode 100644 index 0000000..c15cd9d --- /dev/null +++ b/Documentation/images/icons/bar-chart.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/bell.svg b/Documentation/images/icons/bell.svg new file mode 100644 index 0000000..e472b02 --- /dev/null +++ b/Documentation/images/icons/bell.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/book.svg b/Documentation/images/icons/book.svg new file mode 100644 index 0000000..30a5d15 --- /dev/null +++ b/Documentation/images/icons/book.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/bug.svg b/Documentation/images/icons/bug.svg new file mode 100644 index 0000000..c3c8b66 --- /dev/null +++ b/Documentation/images/icons/bug.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/buildings.svg b/Documentation/images/icons/buildings.svg new file mode 100644 index 0000000..60a7178 --- /dev/null +++ b/Documentation/images/icons/buildings.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/calendar-check.svg b/Documentation/images/icons/calendar-check.svg new file mode 100644 index 0000000..2f33af9 --- /dev/null +++ b/Documentation/images/icons/calendar-check.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/check-circle-fill.svg b/Documentation/images/icons/check-circle-fill.svg new file mode 100644 index 0000000..9f87b83 --- /dev/null +++ b/Documentation/images/icons/check-circle-fill.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/clipboard-check.svg b/Documentation/images/icons/clipboard-check.svg new file mode 100644 index 0000000..a470968 --- /dev/null +++ b/Documentation/images/icons/clipboard-check.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Documentation/images/icons/credit-card.svg b/Documentation/images/icons/credit-card.svg new file mode 100644 index 0000000..31357e1 --- /dev/null +++ b/Documentation/images/icons/credit-card.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/database.svg b/Documentation/images/icons/database.svg new file mode 100644 index 0000000..0ba58e4 --- /dev/null +++ b/Documentation/images/icons/database.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/envelope.svg b/Documentation/images/icons/envelope.svg new file mode 100644 index 0000000..0e4b783 --- /dev/null +++ b/Documentation/images/icons/envelope.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/exclamation-triangle-fill.svg b/Documentation/images/icons/exclamation-triangle-fill.svg new file mode 100644 index 0000000..44d40e9 --- /dev/null +++ b/Documentation/images/icons/exclamation-triangle-fill.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/file-earmark-pdf.svg b/Documentation/images/icons/file-earmark-pdf.svg new file mode 100644 index 0000000..1007a6f --- /dev/null +++ b/Documentation/images/icons/file-earmark-pdf.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/file-earmark-text.svg b/Documentation/images/icons/file-earmark-text.svg new file mode 100644 index 0000000..e1093c6 --- /dev/null +++ b/Documentation/images/icons/file-earmark-text.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/gear.svg b/Documentation/images/icons/gear.svg new file mode 100644 index 0000000..2acf189 --- /dev/null +++ b/Documentation/images/icons/gear.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/globe.svg b/Documentation/images/icons/globe.svg new file mode 100644 index 0000000..2bdd35f --- /dev/null +++ b/Documentation/images/icons/globe.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/graph-up.svg b/Documentation/images/icons/graph-up.svg new file mode 100644 index 0000000..fbed6da --- /dev/null +++ b/Documentation/images/icons/graph-up.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/heart-fill.svg b/Documentation/images/icons/heart-fill.svg new file mode 100644 index 0000000..7946805 --- /dev/null +++ b/Documentation/images/icons/heart-fill.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/house.svg b/Documentation/images/icons/house.svg new file mode 100644 index 0000000..0241836 --- /dev/null +++ b/Documentation/images/icons/house.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/journal-text.svg b/Documentation/images/icons/journal-text.svg new file mode 100644 index 0000000..336b0fd --- /dev/null +++ b/Documentation/images/icons/journal-text.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Documentation/images/icons/key.svg b/Documentation/images/icons/key.svg new file mode 100644 index 0000000..d50950f --- /dev/null +++ b/Documentation/images/icons/key.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/lightbulb.svg b/Documentation/images/icons/lightbulb.svg new file mode 100644 index 0000000..6731d35 --- /dev/null +++ b/Documentation/images/icons/lightbulb.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/lock.svg b/Documentation/images/icons/lock.svg new file mode 100644 index 0000000..4e0c238 --- /dev/null +++ b/Documentation/images/icons/lock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/people.svg b/Documentation/images/icons/people.svg new file mode 100644 index 0000000..db5ecd5 --- /dev/null +++ b/Documentation/images/icons/people.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/receipt.svg b/Documentation/images/icons/receipt.svg new file mode 100644 index 0000000..2f756ce --- /dev/null +++ b/Documentation/images/icons/receipt.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/rocket-takeoff.svg b/Documentation/images/icons/rocket-takeoff.svg new file mode 100644 index 0000000..b842ad7 --- /dev/null +++ b/Documentation/images/icons/rocket-takeoff.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Documentation/images/icons/search.svg b/Documentation/images/icons/search.svg new file mode 100644 index 0000000..0de1f42 --- /dev/null +++ b/Documentation/images/icons/search.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/shield-lock.svg b/Documentation/images/icons/shield-lock.svg new file mode 100644 index 0000000..c35a05d --- /dev/null +++ b/Documentation/images/icons/shield-lock.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Documentation/images/icons/sliders.svg b/Documentation/images/icons/sliders.svg new file mode 100644 index 0000000..d60f2fb --- /dev/null +++ b/Documentation/images/icons/sliders.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/table.svg b/Documentation/images/icons/table.svg new file mode 100644 index 0000000..1bc9309 --- /dev/null +++ b/Documentation/images/icons/table.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/wrench.svg b/Documentation/images/icons/wrench.svg new file mode 100644 index 0000000..292f97b --- /dev/null +++ b/Documentation/images/icons/wrench.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Documentation/images/icons/x-circle-fill.svg b/Documentation/images/icons/x-circle-fill.svg new file mode 100644 index 0000000..0aa99c4 --- /dev/null +++ b/Documentation/images/icons/x-circle-fill.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Nine.sln b/Nine.sln index dd2dae1..3c888ab 100644 --- a/Nine.sln +++ b/Nine.sln @@ -23,8 +23,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nine.Application.Tests", "6 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nine.Shared.UI.Tests", "6-Tests\Nine.Shared.UI.Tests\Nine.Shared.UI.Tests.csproj", "{6BBB590E-E57A-405F-A04F-F3B45379BF89}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nine.Tests", "6-Tests\Nine.Tests\Nine.Tests.csproj", "{81401A51-BBA1-4B6B-8771-9C26A7B5356E}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,30 +45,6 @@ Global {C69B6EFE-BB20-41DE-8CBA-044207EBDCE1}.Release|x64.Build.0 = Release|x64 {C69B6EFE-BB20-41DE-8CBA-044207EBDCE1}.Release|x86.ActiveCfg = Release|x86 {C69B6EFE-BB20-41DE-8CBA-044207EBDCE1}.Release|x86.Build.0 = Release|x86 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Debug|x64.ActiveCfg = Debug|x64 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Debug|x64.Build.0 = Debug|x64 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Debug|x86.ActiveCfg = Debug|x86 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Debug|x86.Build.0 = Debug|x86 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Release|Any CPU.Build.0 = Release|Any CPU - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Release|x64.ActiveCfg = Release|x64 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Release|x64.Build.0 = Release|x64 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Release|x86.ActiveCfg = Release|x86 - {F51BA704-3BAC-F36D-5724-511615D4CBE5}.Release|x86.Build.0 = Release|x86 - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Debug|x64.ActiveCfg = Debug|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Debug|x64.Build.0 = Debug|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Debug|x86.ActiveCfg = Debug|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Debug|x86.Build.0 = Debug|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Release|Any CPU.Build.0 = Release|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Release|x64.ActiveCfg = Release|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Release|x64.Build.0 = Release|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Release|x86.ActiveCfg = Release|Any CPU - {81401A51-BBA1-4B6B-8771-9C26A7B5356E}.Release|x86.Build.0 = Release|Any CPU {B67A2BC8-38CE-4065-B11F-4B485B888371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B67A2BC8-38CE-4065-B11F-4B485B888371}.Debug|Any CPU.Build.0 = Debug|Any CPU {B67A2BC8-38CE-4065-B11F-4B485B888371}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -107,6 +81,18 @@ Global {7C8B4A14-86DE-4D02-8780-3E87395FE585}.Release|x64.Build.0 = Release|Any CPU {7C8B4A14-86DE-4D02-8780-3E87395FE585}.Release|x86.ActiveCfg = Release|Any CPU {7C8B4A14-86DE-4D02-8780-3E87395FE585}.Release|x86.Build.0 = Release|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x64.ActiveCfg = Debug|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x64.Build.0 = Debug|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x86.ActiveCfg = Debug|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x86.Build.0 = Debug|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|Any CPU.Build.0 = Release|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x64.ActiveCfg = Release|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x64.Build.0 = Release|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x86.ActiveCfg = Release|Any CPU + {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x86.Build.0 = Release|Any CPU {A6D698AA-AB46-4F20-A3A8-B87C35E73132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A6D698AA-AB46-4F20-A3A8-B87C35E73132}.Debug|Any CPU.Build.0 = Debug|Any CPU {A6D698AA-AB46-4F20-A3A8-B87C35E73132}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -143,18 +129,6 @@ Global {167542BB-B021-43F2-ACAB-B035796581A4}.Release|x64.Build.0 = Release|Any CPU {167542BB-B021-43F2-ACAB-B035796581A4}.Release|x86.ActiveCfg = Release|Any CPU {167542BB-B021-43F2-ACAB-B035796581A4}.Release|x86.Build.0 = Release|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x64.ActiveCfg = Debug|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x64.Build.0 = Debug|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x86.ActiveCfg = Debug|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Debug|x86.Build.0 = Debug|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|Any CPU.Build.0 = Release|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x64.ActiveCfg = Release|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x64.Build.0 = Release|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x86.ActiveCfg = Release|Any CPU - {5716100E-5D5F-4F69-A6D4-3CD930EA7C3C}.Release|x86.Build.0 = Release|Any CPU {6BBB590E-E57A-405F-A04F-F3B45379BF89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6BBB590E-E57A-405F-A04F-F3B45379BF89}.Debug|Any CPU.Build.0 = Debug|Any CPU {6BBB590E-E57A-405F-A04F-F3B45379BF89}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/README.md b/README.md index aeedc37..64dc6f2 100644 --- a/README.md +++ b/README.md @@ -1,283 +1,161 @@ # Nine. -[![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/xnodeoncode/nine/releases) +[![Version](https://img.shields.io/badge/version-1.2.0-blue.svg)](https://github.com/xnodeoncode/Nine/releases) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![.NET](https://img.shields.io/badge/.NET-10.0-purple.svg)](https://dotnet.microsoft.com/) -[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows-lightgrey.svg)](#installation) +[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows-lightgrey.svg)](#download) [![Website](https://img.shields.io/badge/website-nineapp.co-blue.svg)](https://nineapp.co/) --- -**Nine.** is a desktop application for real estate investors, property managers, and landlords managing up to nine residential rental properties. - -Built with ASP.NET Core 10 and Blazor Server, wrapped in Electron for a native desktop experience. +**Nine.** is a desktop application for property managers and landlords managing up to nine residential rental properties. **Perfect for:** - Independent property managers and landlords - Property owners who self-manage their rentals -- New Real Estate investors building their portfolio -- Anyone seeking focused, no-subscription, property management software +- Anyone seeking focused, no-subscription property management software -## ✨ Key Features +## Key Features ### Property Management -- 📋 Manage up to 9 residential properties -- 🏡 Property profiles with photos and documents -- 🔍 Track property status (Available, Occupied, Under Renovation) -- 📊 Portfolio overview and analytics +- Manage up to 9 residential properties +- Property profiles and documents +- Track property status (Available, Occupied, Under Renovation) +- Portfolio overview and analytics ### Tenant Management -- Track tenants and leases +- Track tenants and leases ### Lease Management -- 📄 Digital lease creation and management -- 💰 Security deposit tracking +- Digital lease creation and management ### Financial Management -- 🧾 Generate invoices for active leases -- 💳 Payment tracking by multiple methods -- ⏰ Automatic late fee application after grace period -- 📈 Financial reports and payment history +- Generate invoices for active leases +- Payment tracking by multiple methods +- Automatic late fee application after grace period +- Financial reports and payment history ### Maintenance & Inspections -- 🔧 Capture repair services and costs -- ✅ Comprehensive 26-item inspection checklist -- 📅 Scheduled routine inspections -- 📄 PDF inspection reports +- Capture repair services and costs +- Comprehensive inspection checklist +- Scheduled routine inspections +- PDF inspection reports ### Notifications & Automation -- 🔔 In-app notifications -- ⏰ Automatic late fees and lease expiration warnings -- 📅 Background tasks for scheduling and cleanup -- 🎯 Configurable notification preferences +- In-app notifications +- Lease expiration warnings +- Background tasks for scheduling and cleanup +- Configurable notification preferences ### Database & Security -- 💾 SQLite file-based database (no server required) -- 🔒 Database encryption at rest (SQLCipher AES-256) -- 🔑 OS keychain integration for password management -- 🔄 Automatic schema migrations -- 📦 Manual and scheduled backups -- ♻️ Staged restore with preview -- 🔐 Content Security Policy (CSP) headers +- SQLite file-based database (no server required) +- Database encryption at rest (SQLCipher AES-256) +- OS keychain integration for password management +- Automatic database migrations on upgrades +- On-demand database backups --- -## 📥 Download +## Download -**Latest Release: v1.0.0** +**Latest Release: v1.2.0** -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20AppImage-blue.svg?style=for-the-badge&logo=linux)](https://github.com/xnodeoncode/nine/releases/download/v1.0.0/Nine-1.0.0-x86_64.AppImage) -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20Setup-blue.svg?style=for-the-badge&logo=windows)](https://github.com/xnodeoncode/nine/releases/download/v1.0.0/Nine-1.0.0-x64-Setup.exe) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20AppImage-blue.svg?style=for-the-badge&logo=linux)](https://github.com/xnodeoncode/Nine/releases/download/v1.2.0/Nine-1.2.0-x86_64.AppImage) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20Setup-blue.svg?style=for-the-badge&logo=windows)](https://github.com/xnodeoncode/Nine/releases/download/v1.2.0/Nine-1.2.0-x64-Setup.exe) -**All Downloads:** [View v1.0.0 Release](https://github.com/xnodeoncode/nine/releases/tag/v1.0.0) +**All Downloads:** [View v1.2.0 Release](https://github.com/xnodeoncode/Nine/releases/tag/v1.2.0) --- -## 🚀 Quick Start - -### Installation - -#### Linux (AppImage) - -```bash -# Download from releases page or use wget -wget https://github.com/xnodeoncode/nine/releases/download/v1.0.0/Nine-1.0.0-x86_64.AppImage - -# Make executable -chmod +x Nine-1.0.0-x86_64.AppImage - -# Option 1: Desktop integration (recommended) -wget https://github.com/xnodeoncode/nine/releases/download/v1.0.0/install-desktop-integration.sh -chmod +x install-desktop-integration.sh -./install-desktop-integration.sh Nine-1.0.0-x86_64.AppImage - -# Option 2: Run directly -./Nine-1.0.0-x86_64.AppImage -``` - -#### Windows (Installer or Portable) - -**Option A: Installer (Recommended)** - -1. **Download** `Nine-1.0.0-x64-Setup.exe` from the [releases page](https://github.com/xnodeoncode/nine/releases/tag/v1.0.0) -2. **Run installer** and follow the setup wizard -3. **Launch** from Start Menu or Desktop shortcut - -**Option B: Portable Executable** +## Getting Started -1. **Download** `Nine-1.0.0-x64-Portable.exe` from the [releases page](https://github.com/xnodeoncode/nine/releases/tag/v1.0.0) -2. **Move to permanent location** (e.g., `C:\Program Files\Nine\`) - - ⚠️ Database and settings are stored relative to the .exe location -3. **Double-click** to run - -**Note:** Windows SmartScreen warning may appear (app is unsigned). Click **"More info"** → **"Run anyway"**. - -### First Run - -1. **Setup Wizard** guides you through initial configuration -2. Create your **organization** (business name and contact info) -3. Register your **first user account** -4. Start managing properties! - -**New to Nine?** Follow the **[Quick Start Guide](Documentation/Quick-Start-Guide.md)** for a 15-minute walkthrough. +**New to Nine?** Follow the **[Quick Start Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Quick-Start-Guide.md)** for a walkthrough on downloading, installing, and getting started with the app. --- -## 📋 System Requirements - -| | Minimum | Recommended | -| ----------- | --------------------------------------------- | --------------- | -| **OS** | Linux (Ubuntu 20.04+) or Windows 10/11 64-bit | Same | -| **CPU** | 2-core, 1.5 GHz | 4-core, 2.5 GHz | -| **RAM** | 2 GB | 4 GB | -| **Disk** | 500 MB | 1 GB | -| **Display** | 1280x800 | 1920x1080 | +## System Requirements -Nine is distributed as an **AppImage** on Linux (runs on all major distros — no installation required) and a **self-contained .exe** on Windows. All dependencies are bundled. +| | Minimum | Recommended | +| ----------- | ----------------------------- | --------------- | +| **OS** | Linux or Windows 10/11 64-bit | Same | +| **CPU** | 2-core, 1.5 GHz | 4-core, 2.5 GHz | +| **RAM** | 8 GB | 16 GB | +| **Disk** | 2 GB | 4 GB | +| **Display** | 1280x800 | 1920x1080 | -Optional: SendGrid (email) and Twilio (SMS) accounts for notifications. +Nine. is distributed as an **AppImage** on Linux (no installation required) and a **self-contained, portable .exe** on Windows. Nine is tested on RHEL 10 with GNOME; see [AppImage Requirements](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Quick-Start-Guide.md#appimage-requirements) for what your Linux system needs to provide. --- -## 📚 Documentation +## Documentation -- 🚀 **[Quick Start Guide](Documentation/Quick-Start-Guide.md)** — Get up and running in 15 minutes -- 💾 **[Database Management Guide](Documentation/Database-Management-Guide.md)** — Backup, restore, troubleshooting -- 📊 **[Compatibility Matrix](Documentation/Compatibility-Matrix.md)** — Version compatibility and upgrade paths -- 📝 **[Copilot Instructions](.github/copilot-instructions.md)** — Architecture and development guidelines -- 🔄 **[CHANGELOG](CHANGELOG.md)** — Version history +- **[Quick Start Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Quick-Start-Guide.md)** — Get up and running in 15 minutes +- **[Database Management Guide](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Database-Management-Guide.md)** — Backup, restore, troubleshooting +- **[Compatibility Matrix](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Compatibility-Matrix.md)** — Version compatibility and upgrade paths +- **[Privacy Statement](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Privacy.md)** — What Nine stores and what it does not collect --- -## ⚠️ Application Limits +## Application Limits Nine. is intentionally constrained for an optimal user experience: | Items | Limit | Reason | | ----------------- | ------------------------------ | ------------------------------------- | | **Properties** | Maximum 9 | Focused workflows — it's our identity | -| **Users** | Maximum 3 (1 system + 2 login) | Simplified access control | +| **Users** | Maximum 4 (1 system + 3 login) | Simplified access control | | **Organizations** | 1 | Desktop application scope | | **File uploads** | 10 MB per file | Performance management | --- -## 🛠️ Technology Stack +## Technology Stack - **Framework:** ASP.NET Core 10.0 + Blazor Server -- **Desktop:** ElectronNET 23.6.2 +- **Desktop:** ElectronNET.Core 0.4.1 - **Database:** SQLite with SQLCipher AES-256 encryption -- **PDF Generation:** QuestPDF (Community License) -- **UI:** Bootstrap 5.3, Material Design Icons - ---- - -## 🏗️ Project Structure - -``` -Nine/ -├── 0-Nine.Core/ # Domain entities and interfaces -├── 1-Nine.Infrastructure/ # Data access and external services -├── 2-Nine.Application/ # Business logic and services -├── 3-Nine.Shared.UI/ # Shared Blazor components -├── 4-Nine/ # Desktop application (Electron host) -└── 6-Tests/ # Unit and integration tests -``` - ---- - -## 🧪 Testing - -```bash -dotnet test Nine.sln -``` +- **PDF Generation:** QuestPDF, used under its own license (not Nine's MIT license) — see [Third-Party Licenses](#third-party-licenses) +- **UI:** Bootstrap 5.3, Bootstrap Icons --- -## 🤝 Contributing - -1. **Fork** the repository -2. **Create a feature branch** from `development`: - `git checkout -b feature/your-feature` -3. Read **[copilot-instructions.md](.github/copilot-instructions.md)** for architecture guidelines -4. Make changes, write tests, ensure build passes -5. **Submit a pull request** to `development` - -**Branch strategy:** - -``` -main (protected, production-ready) - ↑ Pull Request -development (integration testing) - ↑ Direct merge -feature/your-feature -``` - -**Build and run:** - -```bash -dotnet build Nine.sln - -cd 4-Nine && dotnet watch -``` - ---- +## License -## 📊 Versioning +Copyright © 2026 CIS Guru. Licensed under the **MIT License** — see [LICENSE](https://github.com/xnodeoncode/Nine/blob/main/LICENSE) for details. -[Semantic Versioning](https://semver.org/): +### Third-Party Licenses -- **MAJOR** = breaking/schema changes -- **MINOR** = new features -- **PATCH** = bug fixes - -**Current version:** 1.0.0 · **Database schema:** 1.0.0 - ---- - -## 🗺️ Roadmap - -### v1.0.0 (March 2026) ✅ - -- ✅ Complete property, tenant, and lease management -- ✅ Automated invoicing and payment tracking -- ✅ Maintenance request tracking with vendor management -- ✅ Comprehensive 26-item inspections with PDF reports -- ✅ Security deposit investment tracking with dividends -- ✅ Multi-user support with role-based access control -- ✅ Database encryption at rest (SQLCipher AES-256) -- ✅ Linux AppImage + Windows installer - -### v1.1.0 (Q2 2026) - -- 🎯 Windows/macOS keychain integration -- 🎯 Rate limiting and antiforgery tokens -- 🎯 Code signing for Windows -- 🎯 Calendar refactoring - ---- +Nine. includes third-party components that are licensed separately. The full list, with the license text for each +component, is in [Documentation/Third-Party-Licensing-Notices.md](https://github.com/xnodeoncode/Nine/blob/main/Documentation/Third-Party-Licensing-Notices.md), and the +license texts are also installed with the application (see the About page, "Third-Party Licenses"). -## 📜 License +**QuestPDF (PDF generation).** Nine. uses [QuestPDF](https://www.questpdf.com) to generate its PDF documents (leases, +invoices, receipts, inspections, checklists and reports). QuestPDF is not covered by Nine's MIT license and has its own +[license terms](https://www.questpdf.com/license/community.html). In summary, QuestPDF is free for organizations and +individuals with annual gross revenue under USD 1,000,000, for charitable and qualifying academic organizations, and for +open-source projects. Government and public-sector organizations and publicly traded companies require a paid QuestPDF +license. -Copyright © 2026 CIS Guru. Licensed under the **MIT License** — see [LICENSE](LICENSE) for details. +**You are responsible for confirming that you are eligible to use QuestPDF before installing or operating Nine.** If you +are not eligible, obtain a license from QuestPDF or do not use Nine. This notice is informational and is not legal advice. --- -## 📞 Support +## Support -- 🌐 **Website:** [nineapp.co](https://nineapp.co/) -- 🐛 **Bug Reports:** [GitHub Issues](https://github.com/xnodeoncode/nine/issues) -- 💡 **Feature Requests:** [GitHub Discussions](https://github.com/xnodeoncode/nine/discussions) -- 🔒 **Security Issues:** cisguru@outlook.com (private) +- **Website:** [nineapp.co](https://nineapp.co/) +- **Bug Reports:** [GitHub Issues](https://github.com/xnodeoncode/Nine/issues) +- **Feature Requests:** [GitHub Discussions](https://github.com/xnodeoncode/Nine/discussions) +- **Other Questions:** [cisguru@outlook.com](mailto:cisguru@outlook.com?subject=Nine%20Support%20-%20README) (private) --- -**Start with Nine.** 🏠 +**Start with Nine.** diff --git a/bump-version.sh b/bump-version.sh index 7f561ae..c208223 100755 --- a/bump-version.sh +++ b/bump-version.sh @@ -18,6 +18,7 @@ for arg in "$@"; do done CSPROJ_FILE="4-Nine/Nine.csproj" APPSETTINGS_FILE="4-Nine/appsettings.json" +ELECTRON_BUILDER_FILE="4-Nine/Properties/electron-builder.json" # Colors for output RED='\033[0;31m' @@ -90,6 +91,15 @@ sed -i "s|$CURRENT_VERSION|$CURRENT_VERSION|