Skip to content

Instantly share code, notes, and snippets.

View ktutnik's full-sized avatar

Ketut Sandiarsa ktutnik

View GitHub Profile
import { GenericController } from "@plumier/typeorm"
import { Context } from "koa"
export class ProductsController extends GenericController(Product) {
// override save method (POST /path)
save(data: Product, ctx: Context) {
// add your custom logic here
const result = super.save(data, ctx)
// add your custom logic here
User management /api/users
Shop management /api/shops
Shop User management /api/shops/{shopId}/users
Shop Product management /api/shops/{shopsId}/products
Image management /api/images
User Shops list /api/shops
Products list /api/products
Shopping Cart /api/shopping-carts
Shopping Cart Item /api/shopping-carts/{cartId}/items
Shopping Cart Checkout /api/shopping-carts/checkout
@genericController(c => {
// Only Shop Owner can modify and delete the shop data
c.methods("Delete", "Patch", "Put").authorize("ShopOwner")
})
@Entity()
export class Shop extends EntityBase {
@val.required()
@Column()
name: string
@ktutnik
ktutnik / aws-hosting.sh
Last active August 23, 2021 06:40
Shell script to create static website hosting on AWS S3 + CloudFront
#!/bin/bash
set -e
REGION="ap-southeast-1"
if [ -z "$1" ]
then
echo "The bucket name is not specified"
exit 1
@ktutnik
ktutnik / signing-git-commits.md
Created March 31, 2023 09:38 — forked from phortuin/signing-git-commits.md
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg