Save changes before submodule conversion
This commit is contained in:
parent
3bd611a8a2
commit
6e2b70c398
40
README.md
Normal file
40
README.md
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
## Meilisync
|
||||
if you use podman make sure to change the host into host.containers.internal
|
||||
something like this
|
||||
|
||||
debug: true
|
||||
plugins:
|
||||
- meilisync.plugin.Plugin
|
||||
progress:
|
||||
type: file
|
||||
source:
|
||||
type: postgres
|
||||
host: host.containers.internal
|
||||
port: 5432
|
||||
user: postgres
|
||||
password: "rawdoggingwings"
|
||||
database: hiling_dev
|
||||
meilisearch:
|
||||
api_url: "http://host.containers.internal:7700"
|
||||
api_key: 12rchaaonetdadaaoenh
|
||||
insert_size: 1000
|
||||
insert_interval: 10
|
||||
sync:
|
||||
- table: locations
|
||||
index: locations
|
||||
plugins:
|
||||
- meilisync.plugin.Plugin
|
||||
full: false
|
||||
fields:
|
||||
id:
|
||||
name:
|
||||
|
||||
|
||||
and for mac apple silicon chip, pull the image first with command `arch=amd64` then podman compose it
|
||||
|
||||
## Requirements
|
||||
Meilisearch v 1.35.1
|
||||
Meilisync
|
||||
Postgresql
|
||||
Redis
|
||||
BIN
api/.DS_Store
vendored
Normal file
BIN
api/.DS_Store
vendored
Normal file
Binary file not shown.
@ -27,6 +27,8 @@ func validationErrorMsg(field string, param string, tag string, typeName string)
|
||||
return fmt.Sprintf("%s character max %s character", field, param)
|
||||
case "required":
|
||||
return fmt.Sprintf("%s is %s", field, tag)
|
||||
case "alphanum":
|
||||
return fmt.Sprintf("%s should be number and alphabet only", field)
|
||||
default:
|
||||
return fmt.Sprintf("%s %s", field, tag)
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jackc/pgx/v5"
|
||||
|
||||
1
api/location_page_visits.go
Normal file
1
api/location_page_visits.go
Normal file
@ -0,0 +1 @@
|
||||
package api
|
||||
@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util/token"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jackc/pgx/v5"
|
||||
|
||||
@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"git.nochill.in/nochill/hiling_go/util/token"
|
||||
"github.com/gin-contrib/cors"
|
||||
@ -45,7 +45,7 @@ func (server *Server) getRoutes() {
|
||||
router := gin.Default()
|
||||
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:5173"},
|
||||
AllowOrigins: []string{"http://localhost:5173", "http://192.168.18.164:5173", "http://192.168.1.13:5173"},
|
||||
AllowCredentials: true,
|
||||
AllowHeaders: []string{"Content-Type", "Content-Length", "Accept-Encoding", "Authorization", "accept", "origin", "Cache-Control", "X-Requested-With", "X-XSRF-TOKEN"},
|
||||
AllowMethods: []string{"POST", "PUT", "GET", "DELETE", "PATCH"},
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
mockdb "git.nochill.in/nochill/hiling_go/db/mock"
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
api "git.nochill.in/nochill/hiling_go/api"
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
mockdb "git.nochill.in/nochill/hiling_go/db/mock"
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"git.nochill.in/nochill/hiling_go/util/token"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -39,10 +39,8 @@ type createUserResponse struct {
|
||||
func (server *Server) createUser(ctx *gin.Context) {
|
||||
var req createUserRequest
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusBadRequest, ValidationErrorResponse(err))
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusBadRequest, ValidationErrorResponse(err))
|
||||
return
|
||||
}
|
||||
|
||||
hashedPassword, err := util.HashPassword(req.Password)
|
||||
|
||||
2
data.ms/VERSION
Executable file → Normal file
2
data.ms/VERSION
Executable file → Normal file
@ -1 +1 @@
|
||||
1.6.0
|
||||
1.35.1
|
||||
BIN
data.ms/auth/data.mdb
Executable file → Normal file
BIN
data.ms/auth/data.mdb
Executable file → Normal file
Binary file not shown.
BIN
data.ms/auth/lock.mdb
Executable file → Normal file
BIN
data.ms/auth/lock.mdb
Executable file → Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
data.ms/instance-uid
Executable file → Normal file
2
data.ms/instance-uid
Executable file → Normal file
@ -1 +1 @@
|
||||
3db8a6fc-efe2-4e2e-a2ca-2de2e6914f2a
|
||||
21c69fed-fb83-47c1-b0f1-55d632914a43
|
||||
BIN
data.ms/tasks/data.mdb
Executable file → Normal file
BIN
data.ms/tasks/data.mdb
Executable file → Normal file
Binary file not shown.
BIN
data.ms/tasks/lock.mdb
Executable file → Normal file
BIN
data.ms/tasks/lock.mdb
Executable file → Normal file
Binary file not shown.
BIN
db/.DS_Store
vendored
Normal file
BIN
db/.DS_Store
vendored
Normal file
Binary file not shown.
1
db/migrations/000011_create_emotes_table.down.sql
Normal file
1
db/migrations/000011_create_emotes_table.down.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS emotes;
|
||||
5
db/migrations/000011_create_emotes_table.up.sql
Normal file
5
db/migrations/000011_create_emotes_table.up.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE emotes (
|
||||
"id" serial primary key not null,
|
||||
"name" varchar not null,
|
||||
"emote_id" varchar not null
|
||||
)
|
||||
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS location_page_visits;
|
||||
@ -0,0 +1,12 @@
|
||||
CREATE TABLE location_page_visits (
|
||||
id SERIAL PRIMARY KEY,
|
||||
location_id INT NOT NULL REFERENCES locations(id),
|
||||
week_key VARCHAR(10) NOT NULL,
|
||||
visit_count BIGINT DEFAULT(0) NOT NULL,
|
||||
is_deleted BOOLEAN,
|
||||
updated_at TIMESTAMP DEFAULT NOW(),
|
||||
|
||||
UNIQUE(location_id, week_key)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_location_page_visits_week_key_visit_count ON location_page_visits(week_key, visit_count DESC);
|
||||
@ -13,7 +13,7 @@ import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
pgtype "github.com/jackc/pgx/v5/pgtype"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -1,4 +1,5 @@
|
||||
#! /bin/bash
|
||||
|
||||
meilisearch --master-key="12rchaaonetdadaaoenh"
|
||||
meilisearch --http-addr 0.0.0.0:7700 --master-key="12rchaaonetdadaaoenh"
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
cp ./db/csv_seeder/* /tmp/
|
||||
|
||||
# SEEDING MAIN DATAABSE
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c '\copy users(id,username,password) FROM '"'/tmp/user.csv'"' DELIMITER '"','"' CSV HEADER;' \
|
||||
-c '\copy regions(id, region_name) FROM '"'/tmp/regions.csv'"' DELIMITER '"','"' CSV HEADER;' \
|
||||
-c '\copy provinces(id, province_name, region_id) FROM '"'/tmp/provinsi.csv'"' DELIMITER '"','"' CSV HEADER;' \
|
||||
@ -14,7 +14,7 @@ sudo -u postgres psql \
|
||||
-d hiling_dev &&
|
||||
|
||||
# SEEDING TEST DATABASE
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c '\copy users(id,username,password) FROM '"'/tmp/user.csv'"' DELIMITER '"','"' CSV HEADER;' \
|
||||
-c '\copy regions(id, region_name) FROM '"'/tmp/regions.csv'"' DELIMITER '"','"' CSV HEADER;' \
|
||||
-c '\copy provinces(id, province_name, region_id) FROM '"'/tmp/provinsi.csv'"' DELIMITER '"','"' CSV HEADER;' \
|
||||
@ -26,33 +26,33 @@ sudo -u postgres psql \
|
||||
-d hiling_dev_test
|
||||
|
||||
# FIXING SEQUENCES AFTER SEEDING
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'locations_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'locations_id_seq'"'))-1 FROM locations))' \
|
||||
-d hiling_dev_test &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'users_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'users_id_seq'"'))-1 FROM users))' \
|
||||
-d hiling_dev_test &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'reviews_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'reviews_id_seq'"'))-1 FROM reviews))' \
|
||||
-d hiling_dev_test &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'images_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'images_id_seq'"'))-1 FROM images))' \
|
||||
-d hiling_dev_test &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'tags_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'tags_id_seq'"'))-1 FROM tags))' \
|
||||
-d hiling_dev_test &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'locations_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'locations_id_seq'"'))-1 FROM locations))' \
|
||||
-d hiling_dev &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'users_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'users_id_seq'"'))-1 FROM users))' \
|
||||
-d hiling_dev &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'reviews_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'reviews_id_seq'"'))-1 FROM reviews))' \
|
||||
-d hiling_dev &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'images_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'images_id_seq'"'))-1 FROM images))' \
|
||||
-d hiling_dev &&
|
||||
sudo -u postgres psql \
|
||||
sudo -u water psql \
|
||||
-c 'SELECT setval('"'tags_id_seq'"',(SELECT GREATEST(MAX(id)+1,nextval('"'tags_id_seq'"'))-1 FROM tags))' \
|
||||
-d hiling_dev
|
||||
2
main.go
2
main.go
@ -5,7 +5,7 @@ import (
|
||||
"log"
|
||||
|
||||
"git.nochill.in/nochill/hiling_go/api"
|
||||
db "git.nochill.in/nochill/hiling_go/db/sqlc"
|
||||
db "git.nochill.in/nochill/hiling_go/db/repository"
|
||||
"git.nochill.in/nochill/hiling_go/util"
|
||||
_ "github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
|
||||
BIN
snapshots/data.ms.snapshot
Normal file
BIN
snapshots/data.ms.snapshot
Normal file
Binary file not shown.
@ -7,7 +7,7 @@ sql:
|
||||
go:
|
||||
package: "db"
|
||||
sql_package: "pgx/v5"
|
||||
out: "./db/sqlc"
|
||||
out: "./db/repository"
|
||||
emit_json_tags: true
|
||||
emit_prepared_queries: false
|
||||
emit_interface: true
|
||||
|
||||
BIN
util/.DS_Store
vendored
Normal file
BIN
util/.DS_Store
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user