Fiszcz/OLX-flats-notificator

View on GitHub
src/config.schema.json

Summary

Maintainability
Test Coverage
{
    "definitions": {},
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "config.json",
    "type": "object",
    "title": "OLX Config Schema",
    "required": [
        "$schema",
        "emailAddress",
        "emailService",
        "emailsReceiver",
        "GoogleMapsKey",
        "filterUrls",
        "checkInterval",
        "composeIteration",
        "sendWorseAdvertisements"
    ],
    "properties": {
        "emailAddress": {
            "type": "string",
            "title": "E-mail address of account for sending notification emails",
            "examples": ["joe.doe@gmail.com"],
            "format": "email",
            "minLength": 1
        },
        "emailPassword": {
            "type": "string",
            "title": "Password to e-mail account for sending notification emails",
            "examples": ["password123"],
            "minLength": 1
        },
        "emailService": {
            "type": "string",
            "title": "Name of email service for email address",
            "examples": ["gmail"],
            "minLength": 1
        },
        "emailsReceiver": {
            "type": "string",
            "title": "Destination e-mail address of notification email",
            "examples": ["joe.doe@gmail.com"],
            "format": "email",
            "minLength": 1
        },
        "GoogleMapsKey": {
            "type": "string",
            "title": "Google Maps Api Key, necessary to check transport connections for found flats",
            "examples": ["KEbwGXPP_GmHzW0mWcnKUZ49yFYQpuX2BuSYCwlM"],
            "minLength": 1
        },
        "transportDestination": {
            "type": "array",
            "title": "Chosen destination, for which we will want to check transport connections",
            "examples": ["European Square 1, Warsaw"],
            "minLength": 1,
            "items": {
                "type": "object",
                "required": ["location", "maxTransportTime"],
                "properties": {
                    "location": {
                        "type": "string",
                        "title": "Location of transport destination",
                        "examples": ["University of Warsaw, Warsaw"],
                        "minLength": 1
                    },
                    "maxTransportTime": {
                        "type": "integer",
                        "title": "Max possible type for transport connection between flat and destination location [in minutes]",
                        "examples": [30],
                        "minimum": 0
                    }
                }
            }
        },
        "maxRent": {
            "type": "number",
            "title": "Max rent costs of flat",
            "examples": [500],
            "minimum": 0
        },
        "maxPriceWithRent": {
            "type": "number",
            "title": "Max price (plus rent) of flat",
            "examples": [3000],
            "exclusiveMinimum": 0
        },
        "departureTime": {
            "type": "object",
            "title": "Chosen departure time of checking transport connections",
            "required": ["weekday", "time"],
            "properties": {
                "weekday": {
                    "type": "string",
                    "title": "Example weekday for departure",
                    "enum": ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
                    "examples": ["tuesday"],
                    "default": "monday"
                },
                "time": {
                    "type": "string",
                    "title": "Example time for departure",
                    "pattern": "^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$",
                    "examples": ["09:30", "23:59"],
                    "default": "12:00"
                }
            }
        },
        "transportMode": {
            "type": "string",
            "title": "The way of transport for which system will calculate time of transport",
            "examples": ["walking"],
            "enum": ["walking", "driving", "bicycling", "transit"],
            "default": "driving"
        },
        "filterUrls": {
            "type": "array",
            "title": "Copied urls of OLX websites with set filters",
            "items": {
                "type": "string",
                "title": "Filter url",
                "examples": [
                    "https://www.olx.pl/nieruchomosci/mieszkania/wynajem/warszawa/?search%5Bfilter_float_price%3Afrom%5D=2000&search%5Bfilter_float_price%3Ato%5D=2500&view=list"
                ],
                "$comment": "Url should not contain information about pagination or gallery view of advertisements",
                "pattern": "^(?!.*(page=|view=gallery)).*$",
                "format": "uri",
                "minLength": 1
            }
        },
        "checkInterval": {
            "type": "integer",
            "title": "Interval time between advertisement checking",
            "examples": [30],
            "minimum": 2,
            "maximum": 1438
        },
        "composeIteration": {
            "type": "boolean",
            "title": "Compose advertisement from one check to one e-mail"
        },
        "sendWorseAdvertisements": {
            "type": "boolean",
            "title": "Send advertisements which do not meet requirements"
        }
    }
}