This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Request, Response } from "express"; | |
import { container } from "tsyringe"; | |
import { CreateNewHistoricEntryUseCase } from "../domain/useCases/CreateNewHistoricEntryUseCase"; | |
class CreateNewHistoricEntryController { | |
async handle(request: Request, response: Response): Promise<Response> { | |
const { beds, activity, crop, variety, resultIndicator, input } = request.body; | |
const useCase = container.resolve(CreateNewHistoricEntryUseCase); | |
const result = await useCase.execute({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@injectable() | |
class CreateNewHistoricEntryUseCase { | |
constructor( | |
@inject("ISisOrgRepository") | |
private sisOrgRepository: ISisOrgRepository | |
) { | |
} | |
async execute(request: IRequest): Promise<IHistoricEntry[]> { | |
const historicEntries: IHistoricEntry[] = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { container } from "tsyringe"; | |
... | |
function setup() { | |
container.registerSingleton<ISisOrgRepository>( | |
"ISisOrgRepository", | |
FirestoreDataSource | |
); | |
} | |
... | |
app.listen(port, () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Router } from "express"; | |
import { CreateNewHistoricEntryController } from "../../controllers/CreateNewHistoricEntryController"; | |
const historyRoutes = Router(); | |
const createNewHistoricEntryController = new CreateNewHistoricEntryController(); | |
historyRoutes.post("/historic", createNewHistoricEntryController.handle); | |
export { historyRoutes }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express, { Request, Response, NextFunction } from "express"; | |
require('express-async-errors'); | |
import { historyRoutes } from "./routes/history.routes"; | |
const app = express(); | |
app.use(express.json()); | |
app.use("/history", historyRoutes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ComposableFunction() { | |
DisposableEffect(Unit) { | |
typingTimer = TypingTimer().apply { | |
setup( | |
baseMessage = welcomingMessage, | |
finishCallback = { showFooter = true }, | |
currentMessageUpdateCallback = { | |
// here if you are using viewbinding it could be textView.text = currentMessage | |
currentMessage = it | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
compileSdk 31 | |
defaultConfig { | |
applicationId "com.matematicasimples" | |
minSdk 23 | |
targetSdk 30 | |
versionCode getVersionCode() | |
versionName getVersionName() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Properties loadProperties(Project rootProject) { | |
def keystoreProperties = new Properties() | |
// load your keystore.properties file into e keystoreProperties object. | |
try { | |
def keystorePropertiesFile = rootProject.file("keystore.properties") | |
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) | |
} catch(FileNotFoundException exception){ | |
println(exception.message) | |
println("-------") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String getVersionName() { | |
String versionName = "$System.env.ANDROID_VERSION_NAME" | |
if (versionName == null || versionName.isEmpty()) { | |
int versionCode = getVersionCode() | |
return "1.0.$versionCode" | |
} else { | |
return versionName | |
} | |
} |