Compare commits

..

3 Commits

Author SHA1 Message Date
490cbf1156 added opinions 2024-04-21 01:53:10 +07:00
da9aa6b87b added workflows 2024-04-20 23:12:26 +07:00
65987354fe removed version 2024-04-20 22:37:38 +07:00
7 changed files with 125 additions and 1 deletions

View File

@@ -7,3 +7,6 @@ sqlite.db
.DS_Store
dist
.env
caddy/data/caddy
caddy/config/caddy
testaction.secret

View File

@@ -0,0 +1,25 @@
name: backend-action
run-name: ${{ gitea.actor }} is building docker image 🚀
on: [push]
jobs:
build-image:
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gitea.cognizata.com
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: gitea.cognizata.com/atapy/sorvor:latest
target: app
- run: echo "🍏 This job's status is ${{ job.status }}."

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ dist
.env
caddy/data/caddy
caddy/config/caddy
testaction.secret

View File

@@ -1,4 +1,3 @@
version: "3"
services:
backend:
restart: always
@@ -43,3 +42,10 @@ services:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
- ./caddy/data/:/data
- ./caddy/config/:/config
sqliteweb:
image: tomdesinto/sqliteweb
ports:
- 8080:8080
volumes:
- ./sqlite.db:/db/sqlite.db
command: sqlite.db

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1713537308,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View File

@@ -0,0 +1,23 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
with pkgs;
{
devShells.default = mkShell {
packages = with pkgs; [
act
];
shellHook = ''
'';
};
}
);
}

View File

@@ -5,6 +5,7 @@ import { z } from "zod";
export const infoRoute = router({
getAllProvinces: publicProcedure.query(getProvinces),
getAllGroups: publicProcedure.query(getGroups),
getAllOpinions: publicProcedure.query(getOpinions),
getAllZones: publicProcedure
.input(z.object({ provice_id: z.number().optional() }))
.query(async ({ input }) => await getZone(input.provice_id)),
@@ -28,3 +29,7 @@ async function getZone(province?: number) {
async function getGroups() {
return await db.query.group.findMany();
}
async function getOpinions() {
return await db.query.opinion.findMany();
}