This file contains 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
model Book { | |
id String @id @default(auto()) @map("_id") @db.ObjectId | |
authors EmbeddedAuthor[] | |
translators EmbeddedAuthor[] | |
createdAt DateTime @default(now()) | |
updatedAt DateTime @updatedAt | |
ISBN String? @unique | |
} | |
This file contains 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
model Character { | |
id String @id @default(auto()) @map("_id") @db.ObjectId | |
books Book[] @relation(fields: [bookIds], references: [id]) | |
bookIds String[] @db.ObjectId | |
createdAt DateTime @default(now()) | |
updatedAt DateTime @updatedAt | |
} | |
model Book { | |
id String @id @default(auto()) @map("_id") @db.ObjectId |
This file contains 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 { | |
Resolver, | |
Query, | |
Mutation, | |
Args, | |
} from '@nestjs/graphql' | |
import { Inject } from '@nestjs/common'; | |
import { Book } from '@prisma/client' | |
import { NewBookInput } from './dto/new-book.input' | |
import { BookStock } from './dto/book-stock.input' |
This file contains 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
function truncateNumber(number: Float, decimalPlaces: Int): Float { | |
const reg = new RegExp("^-?\\d+(?:\\.\\d{0," + decimalPlaces + "})?", "g") | |
const stringedNumber = number.toString().match(reg)[0] | |
const dotIndex = stringedNumber.indexOf(".") | |
const remainingDecimals = decimalPlaces - (stringedNumber.length - dotIndex) + 1 | |
This file contains 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
--- | |
eleventyExcludeFromCollections: true | |
permalink: /robots.txt | |
--- | |
User-agent: * | |
Allow: / | |
Sitemap: {{ site.url }}/sitemap.xml |
This file contains 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
--- | |
permalink: /sitemap.xml | |
eleventyExcludeFromCollections: true | |
--- | |
<?xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
{% for item in collections.all %} | |
<url> | |
<loc>{{ site.url }}{{ item.url }}</loc> | |
<lastmod>{{ item.date | htmlDateString }}</lastmod> |
This file contains 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
from pyspark.sql import SparkSession | |
from pyspark.sql.functions import from_json, to_json, col, unbase64, base64, split, expr | |
from pyspark.sql.types import StructField, StructType, StringType, BooleanType, ArrayType, DateType | |
# TO-DO: create a StructType for the Kafka redis-server topic which has all changes made to Redis - before Spark 3.0.0, schema inference is not automatic | |
redisSchema = StructType( | |
[ | |
StructField("key", StringType()), | |
StructField("existType", StringType()), | |
StructField("Ch", BooleanType()), |
This file contains 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
from pyspark.sql import SparkSession | |
from pyspark.sql.functions import from_json, to_json, col, unbase64, base64, split, expr | |
from pyspark.sql.types import StructField, StructType, StringType, FloatType, BooleanType, ArrayType, DateType | |
# create deposit a kafka message schema StructType including the following JSON elements: | |
# {"accountNumber":"703934969","amount":415.94,"dateAndTime":"Sep 29, 2020, 10:06:23 AM"} | |
# Cast the amount as a FloatType | |
depositMessageSchema = StructType( | |
[ |
This file contains 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
map.on('load', async () => { | |
map.addSource('greenspace_tiles', { | |
type: 'vector', | |
url: `mapbox://${mapboxUsername}.${mapID}` | |
}); | |
map.addLayer({ | |
id: 'greenspaces', | |
type: 'fill', | |
source: 'greenspace_tiles', |
This file contains 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
// node.js express.js server | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const routes = require('./routes.js'); | |
const port = process.env.PORT || 3000; | |
const app = express(); | |
const http = require('http').Server(app); | |
app.use(bodyParser.json()) | |
app.use(bodyParser.urlencoded({ extended: true })) |
NewerOlder