Skip to content

Instantly share code, notes, and snippets.

View hoangsetup's full-sized avatar
🎯
Work until you no longer have to represent yourself.!

Hoang Dinh hoangsetup

🎯
Work until you no longer have to represent yourself.!
View GitHub Profile
package io.codetheworld.tinycrm
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.telephony.TelephonyManager
import android.util.Log
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.codetheworld.tinycrm">
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
diff --git a/src/application.ts b/src/application.ts
index e9b2e72..4eb841f 100644
--- a/src/application.ts
+++ b/src/application.ts
@@ -1,4 +1,7 @@
-import express, { Application as ExApplication } from 'express';
+import express, { Application as ExApplication, Handler } from 'express';
+import { controllers } from './controllers';
+import { MetadataKeys } from './utils/metadata.keys';
+import { IRouter } from './utils/decorators/handlers.decorator';
import { Handler, Request } from 'express';
import { CognitoIdentityServiceProvider } from 'aws-sdk';
const identityServiceProvider = new CognitoIdentityServiceProvider({
region: process.env.REGION || 'ap-northeast-1',
});
export interface IUser {
id: string;
email: string;
import express from 'express';
import cognitoUserPoolHelper from './cognito.user.pool.helper';
interface IUserController {
signUp: express.Handler,
signIn: express.Handler,
confirmSignUp: express.Handler,
getProfile: express.Handler,
}
import 'cross-fetch/polyfill';
import { AuthenticationDetails, CognitoUser, CognitoUserAttribute, CognitoUserPool } from 'amazon-cognito-identity-js';
export interface IUserToken {
accessToken: string;
refreshToken: string;
}
class CognitoUserPoolHelper {
public userPool: CognitoUserPool;
import { mocked } from 'ts-jest/utils';
import { Handler } from 'aws-lambda';
import { middyfy } from '@libs/lambda';
jest.mock('@libs/lambda');
describe('hello', () => {
let main;
let mockedMiddyfy: jest.MockedFunction<typeof middyfy>;
import middy from '@middy/core';
import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
import { formatJSONResponse } from './apiGateway';
import { AppError } from './appError';
import MiddlewareFunction = middy.MiddlewareFunction;
export const apiGatewayResponseMiddleware = (options: { enableErrorLogger?: boolean } = {}) => {
const after: MiddlewareFunction<APIGatewayProxyEvent, any> = async (request) => {
import { IProduct } from '../interfaces';
import BasePO from './base.po';
class CartPO extends BasePO {
private readonly $cartItem = '.cart_item';
private readonly $cart = {
$name: '.inventory_item_name',
$price: '.inventory_item_price',
};
import { IProduct } from '../interfaces';
import BasePO from './base.po';
class InventoryPO extends BasePO {
private readonly $productItem = '.inventory_item';
private readonly $addCart = '.btn_inventory';
private readonly $cartCount = '.shopping_cart_badge';
private readonly $product = {
$name: '.inventory_item_name',
$price: '.inventory_item_price',