mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
Add Privacy Policy Module and Controller
This commit is contained in:
@ -413,6 +413,16 @@ export class ControllerRoute {
|
||||
'This endpoint retrieves the terms and conditions for the application.';
|
||||
};
|
||||
};
|
||||
|
||||
static PRIVACY_POLICY = class {
|
||||
public static readonly ROUTE = 'policy';
|
||||
|
||||
static ACTIONS = class {
|
||||
public static readonly FETCH_POLICY_SUMMARY = 'Fetch Privacy Policy';
|
||||
public static readonly FETCH_POLICY_DESCRIPTION =
|
||||
'This endpoint retrieves the privacy policy for the application.';
|
||||
};
|
||||
};
|
||||
static GROUP = class {
|
||||
public static readonly ROUTE = 'group';
|
||||
|
||||
|
37
libs/common/src/constants/privacy-policy.html
Normal file
37
libs/common/src/constants/privacy-policy.html
Normal file
@ -0,0 +1,37 @@
|
||||
<div>
|
||||
<p><strong>Syncrow Mobile Privacy Policy</strong></p>
|
||||
<p>
|
||||
Effective Date: 26/06/2022<br />
|
||||
Updated: 26/06/2022
|
||||
</p>
|
||||
<p>
|
||||
Syncrow and subsidiaries (“we”, “us”, “our”, “Syncrow”) are committed to
|
||||
protecting your privacy. This Privacy Policy (“Policy”) describes our
|
||||
practices in connection with information privacy on Personal Data we process
|
||||
through your individual use of the following services, products, and related
|
||||
mobile applications (collectively, the “Products”):
|
||||
</p>
|
||||
<ul>
|
||||
<li>Syncrow Mobile Application</li>
|
||||
</ul>
|
||||
<p>
|
||||
Before you use our Products, please carefully read through this Policy and
|
||||
understand our purposes and practices of collection, processing of your
|
||||
Personal Data, including how we use, store, share and transfer Personal
|
||||
Data. In the Policy you will also find ways to execute your rights of
|
||||
access, update, delete or protect your Personal Data.
|
||||
</p>
|
||||
<p>
|
||||
When you accept this Policy when you register with your Personal Data, or if
|
||||
you start to use our Products and does not expressly object to the contents
|
||||
of this Policy, we will consider that you fully understand and agree with
|
||||
this Policy. If you have any questions regarding this Policy, please do not
|
||||
hesitate to contact us via:
|
||||
</p>
|
||||
<p>
|
||||
For other branded mobile applications powered by Syncrow, our Clients
|
||||
control all the Personal Data collected through our Products. We collect the
|
||||
information under the direction of our Clients and the processing of such
|
||||
information.
|
||||
</p>
|
||||
</div>
|
@ -27,6 +27,7 @@ import { InviteUserModule } from './invite-user/invite-user.module';
|
||||
import { PermissionModule } from './permission/permission.module';
|
||||
import { RoleModule } from './role/role.module';
|
||||
import { TermsConditionsModule } from './terms-conditions/terms-conditions.module';
|
||||
import { PrivacyPolicyModule } from './privacy-policy/privacy-policy.module';
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
@ -57,6 +58,7 @@ import { TermsConditionsModule } from './terms-conditions/terms-conditions.modul
|
||||
PermissionModule,
|
||||
RoleModule,
|
||||
TermsConditionsModule,
|
||||
PrivacyPolicyModule,
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
|
1
src/privacy-policy/controllers/index.ts
Normal file
1
src/privacy-policy/controllers/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './privacy-policy.controller';
|
29
src/privacy-policy/controllers/privacy-policy.controller.ts
Normal file
29
src/privacy-policy/controllers/privacy-policy.controller.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { Controller, Get, HttpStatus } from '@nestjs/common';
|
||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
||||
import { ControllerRoute } from '@app/common/constants/controller-route'; // Assuming this is where the routes are defined
|
||||
import { PrivacyPolicyService } from '../services';
|
||||
|
||||
@ApiTags('Privacy Policy Module')
|
||||
@Controller({
|
||||
version: EnableDisableStatusEnum.ENABLED,
|
||||
path: ControllerRoute.PRIVACY_POLICY.ROUTE,
|
||||
})
|
||||
export class PrivacyPolicyController {
|
||||
constructor(private readonly privacyPolicyService: PrivacyPolicyService) {}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.PRIVACY_POLICY.ACTIONS.FETCH_POLICY_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.PRIVACY_POLICY.ACTIONS.FETCH_POLICY_DESCRIPTION,
|
||||
})
|
||||
async fetchPrivacyPolicy() {
|
||||
const htmlContent = await this.privacyPolicyService.fetchPrivacyPolicy();
|
||||
return {
|
||||
statusCode: HttpStatus.OK,
|
||||
message: 'Privacy policy fetched successfully',
|
||||
data: htmlContent,
|
||||
};
|
||||
}
|
||||
}
|
12
src/privacy-policy/privacy-policy.module.ts
Normal file
12
src/privacy-policy/privacy-policy.module.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { DeviceRepositoryModule } from '@app/common/modules/device';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { PrivacyPolicyController } from './controllers';
|
||||
import { PrivacyPolicyService } from './services';
|
||||
|
||||
@Module({
|
||||
imports: [ConfigModule, DeviceRepositoryModule],
|
||||
controllers: [PrivacyPolicyController],
|
||||
providers: [PrivacyPolicyService],
|
||||
})
|
||||
export class PrivacyPolicyModule {}
|
1
src/privacy-policy/services/index.ts
Normal file
1
src/privacy-policy/services/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './privacy-policy.service';
|
30
src/privacy-policy/services/privacy-policy.service.ts
Normal file
30
src/privacy-policy/services/privacy-policy.service.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
@Injectable()
|
||||
export class PrivacyPolicyService {
|
||||
async fetchPrivacyPolicy(): Promise<string> {
|
||||
const projectRoot = process.cwd();
|
||||
|
||||
const filePath = path.join(
|
||||
projectRoot,
|
||||
'libs',
|
||||
'common',
|
||||
'src',
|
||||
'constants',
|
||||
'privacy-policy.html',
|
||||
);
|
||||
|
||||
// Ensure the file exists
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`File not found: ${filePath}`);
|
||||
}
|
||||
|
||||
let htmlContent = fs.readFileSync(filePath, 'utf-8');
|
||||
|
||||
htmlContent = htmlContent.replace(/(\r\n|\n|\r)/gm, ''); // Removes newlines
|
||||
|
||||
return htmlContent;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user