fix(CurrentRecipePointer): 🐛 Fix cache recipe
Remove continue last opened version
This commit is contained in:
parent
4219c1cb43
commit
2b8745679f
16 changed files with 481 additions and 174 deletions
64
client/package-lock.json
generated
64
client/package-lock.json
generated
|
|
@ -22,6 +22,7 @@
|
|||
"jwt-decode": "^3.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"rxjs": "~7.8.0",
|
||||
"socket.io-client": "^4.7.5",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.13.0"
|
||||
},
|
||||
|
|
@ -4069,8 +4070,7 @@
|
|||
"node_modules/@socket.io/component-emitter": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
|
||||
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg=="
|
||||
},
|
||||
"node_modules/@tootallnate/once": {
|
||||
"version": "1.1.2",
|
||||
|
|
@ -6174,7 +6174,6 @@
|
|||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
|
|
@ -6488,11 +6487,42 @@
|
|||
"node": ">=10.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-client": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz",
|
||||
"integrity": "sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1",
|
||||
"engine.io-parser": "~5.2.1",
|
||||
"ws": "~8.11.0",
|
||||
"xmlhttprequest-ssl": "~2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-client/node_modules/ws": {
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-parser": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz",
|
||||
"integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
|
|
@ -9508,8 +9538,7 @@
|
|||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/multicast-dns": {
|
||||
"version": "7.2.5",
|
||||
|
|
@ -11818,11 +11847,24 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-client": {
|
||||
"version": "4.7.5",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.5.tgz",
|
||||
"integrity": "sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.2",
|
||||
"engine.io-client": "~6.5.2",
|
||||
"socket.io-parser": "~4.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-parser": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
|
||||
"integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1"
|
||||
|
|
@ -13465,6 +13507,14 @@
|
|||
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/xmlhttprequest-ssl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
|
||||
"integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
"jwt-decode": "^3.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"rxjs": "~7.8.0",
|
||||
"socket.io-client": "^4.7.5",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.13.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { RecipeService } from '../services/recipe.service';
|
|||
import { AsyncStorage } from 'src/app/shared/helpers/asyncStorage';
|
||||
import { MergeComponent } from "../../features/merge/merge.component";
|
||||
import { Debugger } from 'src/app/shared/helpers/debugger';
|
||||
// import { SocketIOService } from 'src/app/shared/services/websocket.service';
|
||||
|
||||
interface MenuItem {
|
||||
name: string;
|
||||
|
|
@ -70,7 +71,8 @@ export class LayoutComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
private _userService: UserService,
|
||||
private _router: ActivatedRoute,
|
||||
private _httpClient: HttpClient,
|
||||
private _recipeService: RecipeService
|
||||
private _recipeService: RecipeService,
|
||||
// private _socket: SocketIOService
|
||||
) {
|
||||
this.debugger = new Debugger(this._recipeService.shareHttpClient());
|
||||
}
|
||||
|
|
@ -168,6 +170,7 @@ export class LayoutComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
logout() {
|
||||
this.exit$.next();
|
||||
this.exit$.complete();
|
||||
// this._socket.leaveRoom(this._userService.getCurrentUser()!.name, "recipe:response");
|
||||
this._userService.logout();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import { RecipeMetaData } from 'src/app/shared/types/recipe';
|
|||
import { getCountryMapSwitcher } from 'src/app/shared/helpers/recipe';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AsyncStorage } from 'src/app/shared/helpers/asyncStorage';
|
||||
import { SocketIOService } from 'src/app/shared/services/websocket.service';
|
||||
import { UserService } from './user.service';
|
||||
|
||||
type RecipeOverviewParams = {
|
||||
filename: string;
|
||||
|
|
@ -49,10 +51,14 @@ export class RecipeService {
|
|||
|
||||
constructor(
|
||||
private _httpClient: HttpClient,
|
||||
private _route: ActivatedRoute
|
||||
) {}
|
||||
private _route: ActivatedRoute,
|
||||
private _user: UserService,
|
||||
// private _socket: SocketIOService
|
||||
) {
|
||||
// this._socket.checkIn(this._user.getCurrentUser()!.name, 'recipe:response');
|
||||
}
|
||||
|
||||
shareHttpClient(){
|
||||
shareHttpClient() {
|
||||
return this._httpClient;
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +68,26 @@ export class RecipeService {
|
|||
filename: this.getCurrentFile(),
|
||||
}
|
||||
): Observable<RecipesDashboard> {
|
||||
// test socket service
|
||||
|
||||
// this._socket.getPayload(`${this._user.getCurrentUser()!.name}:recipe:response:cache`)?.subscribe({
|
||||
// next: (c: any)=> {
|
||||
// console.log("cache from server", c);
|
||||
// }
|
||||
// });
|
||||
|
||||
// this._socket.sendTopic('recipe:dashboard', {
|
||||
// room: 'recipe:response',
|
||||
// topic: 'recipe:dashboard',
|
||||
// user: this._user.getCurrentUser()!.name,
|
||||
// country: params.country,
|
||||
// filename: params.filename,
|
||||
// });
|
||||
|
||||
// return this._socket.getPayload(
|
||||
// `recipe:dashboard:${this._user.getCurrentUser()!.name}:payload`
|
||||
// )!;
|
||||
|
||||
return this._httpClient.get<RecipesDashboard>(
|
||||
environment.api + '/recipes/dashboard',
|
||||
{
|
||||
|
|
@ -85,6 +111,20 @@ export class RecipeService {
|
|||
search: '',
|
||||
}
|
||||
): Promise<Observable<RecipeOverviewList>> {
|
||||
|
||||
console.log("overview: ", params);
|
||||
|
||||
// this._socket.sendTopic('recipe:overview', {
|
||||
// room: 'recipe:response',
|
||||
// topic: 'recipe:overview',
|
||||
// user: this._user.getCurrentUser()!.name,
|
||||
// ...params
|
||||
// });
|
||||
|
||||
// return this._socket.getPayload(
|
||||
// `recipe:overview:${this._user.getCurrentUser()!.name}:payload`
|
||||
// )!;
|
||||
|
||||
return this._httpClient.get<RecipeOverviewList>(
|
||||
environment.api + '/recipes/overview',
|
||||
{
|
||||
|
|
@ -240,7 +280,7 @@ export class RecipeService {
|
|||
});
|
||||
}
|
||||
|
||||
upgradeRecipe(country: string, filename: string, ctx: any){
|
||||
upgradeRecipe(country: string, filename: string, ctx: any) {
|
||||
return this._httpClient.post<any>(
|
||||
environment.api + ('/recipes/upgrade/' + country + '/' + filename),
|
||||
ctx,
|
||||
|
|
@ -316,29 +356,27 @@ export class RecipeService {
|
|||
country: string,
|
||||
filename: string
|
||||
): Observable<any> {
|
||||
|
||||
console.log("try get patches", country, filename);
|
||||
console.log('try get patches', country, filename);
|
||||
|
||||
return this._httpClient.get<any>(
|
||||
environment.api + '/recipes/patch/get/' + country + '/' + filename ,
|
||||
environment.api + '/recipes/patch/get/' + country + '/' + filename,
|
||||
{ withCredentials: true, responseType: 'json' }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
async sortRecipe(
|
||||
country: string,
|
||||
filename: string,
|
||||
sortKey: string,
|
||||
ascending: boolean
|
||||
): Promise<Observable<any>> {
|
||||
return this._httpClient.post<any>(
|
||||
environment.api + '/recipes/sort/' + country + '/' + filename ,
|
||||
JSON.stringify({
|
||||
"sortKey": sortKey,
|
||||
"ascending": ascending
|
||||
}),
|
||||
{ withCredentials: true, responseType: 'json' }
|
||||
);
|
||||
}
|
||||
): Promise<Observable<any>> {
|
||||
return this._httpClient.post<any>(
|
||||
environment.api + '/recipes/sort/' + country + '/' + filename,
|
||||
JSON.stringify({
|
||||
sortKey: sortKey,
|
||||
ascending: ascending,
|
||||
}),
|
||||
{ withCredentials: true, responseType: 'json' }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import { copy, transformToTSV } from 'src/app/shared/helpers/copy';
|
|||
import { getCountryMapSwitcher } from 'src/app/shared/helpers/recipe';
|
||||
import { AsyncStorage } from 'src/app/shared/helpers/asyncStorage';
|
||||
import { NotFoundHandler } from 'src/app/shared/helpers/notFoundHandler';
|
||||
import { SocketIOService } from 'src/app/shared/services/websocket.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-recipes',
|
||||
|
|
@ -121,15 +122,15 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
),
|
||||
materialIds: this.selectMaterialFilter || [],
|
||||
})
|
||||
).subscribe(({ result, hasMore, totalCount }) => {
|
||||
).subscribe((p: any) => {
|
||||
// console.log("result in scroll", result);
|
||||
if (this.recipeOverviewList) {
|
||||
this.recipeOverviewList = this.recipeOverviewList.concat(result);
|
||||
this.recipeOverviewList = this.recipeOverviewList.concat(p.result);
|
||||
} else {
|
||||
this.recipeOverviewList = result;
|
||||
this.recipeOverviewList = p.result;
|
||||
}
|
||||
this.offset += 10;
|
||||
this.isHasMore = hasMore;
|
||||
this.offset += 10;
|
||||
this.isHasMore = p.hasMore;
|
||||
this.isLoadMore = false;
|
||||
});
|
||||
}
|
||||
|
|
@ -144,7 +145,8 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
private _toppingService: ToppingService,
|
||||
private route: ActivatedRoute,
|
||||
private _userService: UserService,
|
||||
private _router: Router
|
||||
private _router: Router,
|
||||
// private _socket: SocketIOService
|
||||
) {}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
|
|
@ -175,7 +177,7 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
country: await this._recipeService.getCurrentCountry(this.department!),
|
||||
})
|
||||
.pipe(
|
||||
finalize(async () => {
|
||||
finalize(async () => {
|
||||
(
|
||||
await this._recipeService.getRecipeOverview({
|
||||
offset: this.offset,
|
||||
|
|
@ -196,7 +198,7 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
})
|
||||
);
|
||||
|
||||
// : Lag assigned
|
||||
// : Lag assigned
|
||||
|
||||
this.recipesDashboard$.subscribe(async (data) => {
|
||||
this.currentVersion = data.configNumber;
|
||||
|
|
@ -212,7 +214,7 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
);
|
||||
await AsyncStorage.setItem('currentRecipeFile', data.filename);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
console.log('ngAfterViewInit::department', this.department);
|
||||
console.log('::CurrentFile', this._recipeService.getCurrentFile());
|
||||
|
|
@ -235,43 +237,11 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
);
|
||||
|
||||
// check material detail
|
||||
console.log('first material', this.materialDetail![0]);
|
||||
// console.log('first material', this.materialDetail![0]);
|
||||
});
|
||||
|
||||
// end of FIXME
|
||||
|
||||
// this._recipeService
|
||||
// .getSavedTmp(
|
||||
// await this._recipeService.getCurrentCountry(this.department),
|
||||
// this._recipeService.getCurrentFile()
|
||||
// )
|
||||
// .subscribe({
|
||||
// next: (files: any) => {
|
||||
// console.log('Obtain saves: ', typeof files, files);
|
||||
// this.showSaveNoti = false;
|
||||
// if (files != undefined && typeof files === 'object') {
|
||||
// if (files.files != null) {
|
||||
// console.log(
|
||||
// 'Obtain saves object: ',
|
||||
// files.files[0],
|
||||
// typeof files
|
||||
// );
|
||||
// this.savedTmpfiles = files.files;
|
||||
// } else {
|
||||
// this.showSaveNoti = false;
|
||||
// this.savedTmpfiles = [];
|
||||
// console.log(this.showSaveNoti, this.savedTmpfiles);
|
||||
// }
|
||||
// // let svf = (document.getElementById('select_savefile_modal') as HTMLInputElement)!.checked;
|
||||
// // console.log("isSavedModalOpened",svf)
|
||||
// } else {
|
||||
// this.showSaveNoti = false;
|
||||
// this.savedTmpfiles = [];
|
||||
// console.log(this.showSaveNoti, this.savedTmpfiles);
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
|
||||
(await this._materialService.getMaterialCodes())
|
||||
.pipe(
|
||||
map((mat) =>
|
||||
|
|
@ -540,10 +510,7 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
// end of Recipe Version selection
|
||||
|
||||
async openJsonTab() {
|
||||
|
||||
let country = await this._recipeService.getCurrentCountry(
|
||||
this.department
|
||||
);
|
||||
let country = await this._recipeService.getCurrentCountry(this.department);
|
||||
|
||||
window.open(
|
||||
environment.api +
|
||||
|
|
@ -644,20 +611,20 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
// save toggle for each header
|
||||
|
||||
// get header if saved
|
||||
let headerToggle = await AsyncStorage.getItem("sort_"+header);
|
||||
let headerToggle = await AsyncStorage.getItem('sort_' + header);
|
||||
let toggleAscend = true;
|
||||
if(headerToggle == null || headerToggle == undefined){
|
||||
await AsyncStorage.setItem("sort_"+header, "true");
|
||||
} else if(headerToggle == "true") {
|
||||
if (headerToggle == null || headerToggle == undefined) {
|
||||
await AsyncStorage.setItem('sort_' + header, 'true');
|
||||
} else if (headerToggle == 'true') {
|
||||
toggleAscend = false;
|
||||
await AsyncStorage.setItem("sort_"+header, "false");
|
||||
} else if(headerToggle == "false"){
|
||||
await AsyncStorage.setItem('sort_' + header, 'false');
|
||||
} else if (headerToggle == 'false') {
|
||||
toggleAscend = true;
|
||||
await AsyncStorage.setItem("sort_"+header, "true");
|
||||
await AsyncStorage.setItem('sort_' + header, 'true');
|
||||
}
|
||||
|
||||
//
|
||||
console.log("sort ", headerToggle, " to ", header);
|
||||
console.log('sort ', headerToggle, ' to ', header);
|
||||
|
||||
// send to server [/recipe/sort]
|
||||
(
|
||||
|
|
@ -668,14 +635,26 @@ export class RecipesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
toggleAscend
|
||||
)
|
||||
).subscribe({
|
||||
|
||||
next: (data: any) => {
|
||||
if(data.status == 'OK'){
|
||||
if (data.status == 'OK') {
|
||||
console.log(data.result);
|
||||
// alert("refresh ... ");
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// for debug
|
||||
asJsonString = (data: any) => {
|
||||
return JSON.stringify(data);
|
||||
};
|
||||
|
||||
// make unique set array
|
||||
filterMakeUnique(arr: any[], filterBy: string){
|
||||
return arr.filter((recipe: any, index) => {
|
||||
return index === arr.findIndex(a => a[filterBy] === recipe[filterBy]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,62 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable, filter, share } from 'rxjs';
|
||||
import { WebSocketSubject, webSocket } from 'rxjs/webSocket';
|
||||
import { Observable } from 'rxjs';
|
||||
import {io} from 'socket.io-client';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WebsocketService {
|
||||
export class SocketIOService {
|
||||
|
||||
private subject!: WebSocketSubject<unknown>;
|
||||
private res: any;
|
||||
private socket = io("http://localhost:3000");
|
||||
private isConnected = false;
|
||||
|
||||
constructor() {}
|
||||
|
||||
public connect(url: string){
|
||||
this.subject = webSocket(url);
|
||||
checkIn(user: string, room: string){
|
||||
|
||||
this.subject.subscribe({
|
||||
next: (msg: any) => {
|
||||
// console.log("message", msg);
|
||||
this.res = msg;
|
||||
console.log("res set =",this.res);
|
||||
},
|
||||
error: (err: any) => {
|
||||
console.error(err);
|
||||
},
|
||||
complete: () => {
|
||||
console.log('complete');
|
||||
}
|
||||
})
|
||||
let obs = new Observable<any>(observer => {
|
||||
this.socket.on('connect', () => {
|
||||
console.log("connected to ", user, room);
|
||||
this.isConnected = true;
|
||||
this.socket.emit('subscribe', {
|
||||
room: room,
|
||||
user: user
|
||||
});
|
||||
observer.next({connect: this.isConnected});
|
||||
});
|
||||
});
|
||||
|
||||
return obs;
|
||||
}
|
||||
|
||||
public listenTo<T>(topic: string): Observable<T> {
|
||||
return this.subject.pipe(
|
||||
filter((msg: any) => msg.topic === topic),
|
||||
share()
|
||||
);
|
||||
onConnection = () => this.isConnected;
|
||||
|
||||
leaveRoom(user: string, room: string){
|
||||
this.socket.emit("unsubscribe", {
|
||||
user: user,
|
||||
room: room
|
||||
});
|
||||
}
|
||||
|
||||
public data = this.subject.pipe(
|
||||
share()
|
||||
);
|
||||
getPayload(topic: string){
|
||||
let obs = new Observable<any>(observer => {
|
||||
this.socket.on(topic, (payload: any) => {
|
||||
console.log("getPayload", topic, payload);
|
||||
observer.next(payload);
|
||||
});
|
||||
});
|
||||
|
||||
public send(url: any){
|
||||
this.subject.next(url);
|
||||
return obs;
|
||||
// if(this.isConnected){
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
|
||||
sendTopic(topic: string, args: any){
|
||||
// if(this.isConnected){
|
||||
|
||||
// }
|
||||
console.log("sending to topic", topic, args);
|
||||
this.socket.emit(topic, args);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,44 @@
|
|||
[
|
||||
{
|
||||
"name": "Thailand",
|
||||
"short": "tha",
|
||||
"permissions": 1
|
||||
},
|
||||
{
|
||||
"name": "Malaysia",
|
||||
"short": "mys",
|
||||
"permissions": 2
|
||||
},
|
||||
{
|
||||
"name": "Australia",
|
||||
"short": "aus",
|
||||
"permissions": 4
|
||||
},
|
||||
{
|
||||
"name": "Alpha3",
|
||||
"short": "alpha-3",
|
||||
"permissions": 8
|
||||
},
|
||||
{
|
||||
"ignore": true,
|
||||
"name": "New Country in full name",
|
||||
"short": "Short name",
|
||||
"permissions": "use number after 128, do not use 16 and 128"
|
||||
},
|
||||
{
|
||||
"name": "Thailand",
|
||||
"short": "tha",
|
||||
"permissions": 1,
|
||||
"dir": "tha"
|
||||
},
|
||||
{
|
||||
"name": "Malaysia",
|
||||
"short": "mys",
|
||||
"permissions": 2,
|
||||
"dir": "mys"
|
||||
},
|
||||
{
|
||||
"name": "Australia",
|
||||
"short": "aus",
|
||||
"permissions": 4,
|
||||
"dir": "aus"
|
||||
},
|
||||
{
|
||||
"name": "Alpha3",
|
||||
"short": "alpha-3",
|
||||
"permissions": 8,
|
||||
"dir": "alpha-3"
|
||||
},
|
||||
{
|
||||
"name": "UAE Dubai",
|
||||
"short": "uae-dubai",
|
||||
"permissions": 256,
|
||||
"dir": "dubai"
|
||||
},
|
||||
{
|
||||
"name": "Counter Cafe",
|
||||
"short": "counter",
|
||||
"permissions": 512,
|
||||
"dir": "counter"
|
||||
}
|
||||
]
|
||||
|
|
@ -874,7 +874,7 @@ func (d *Data) SetValuesToToppingGroupList(base_topping_group_list []models.Topp
|
|||
}
|
||||
|
||||
func (d *Data) GetMaterialSetting(countryID, filename string) []models.MaterialSetting {
|
||||
result := make([]models.MaterialSetting, 0)
|
||||
// result := make([]models.MaterialSetting, 0)
|
||||
|
||||
if countryID == "" {
|
||||
// copy(result, d.currentRecipe[countryID].MaterialSetting)
|
||||
|
|
@ -888,12 +888,12 @@ func (d *Data) GetMaterialSetting(countryID, filename string) []models.MaterialS
|
|||
return d.CurrentRecipe[countryID].MaterialSetting
|
||||
}
|
||||
|
||||
if recipe, ok := d.recipeMap[filename]; ok {
|
||||
copy(result, recipe.Recipe[countryID].MaterialSetting)
|
||||
d.CurrentFile[countryID] = filename
|
||||
// d.CurrentCountryID[countryID] = countryID
|
||||
return d.CurrentRecipe[countryID].MaterialSetting
|
||||
}
|
||||
// if recipe, ok := d.recipeMap[filename]; ok {
|
||||
// copy(result, recipe.Recipe[countryID].MaterialSetting)
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// // d.CurrentCountryID[countryID] = countryID
|
||||
// return d.CurrentRecipe[countryID].MaterialSetting
|
||||
// }
|
||||
}
|
||||
|
||||
if filename == "default" {
|
||||
|
|
@ -952,11 +952,11 @@ func (d *Data) GetAllToppingGroups(countryID, filename string) []models.ToppingG
|
|||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingGroup
|
||||
}
|
||||
if _, ok := d.recipeMap[countryID]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
// if _, ok := d.recipeMap[countryID]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingGroup
|
||||
}
|
||||
// return d.CurrentRecipe[countryID].Topping.ToppingGroup
|
||||
// }
|
||||
}
|
||||
|
||||
if filename == "default" {
|
||||
|
|
@ -1002,10 +1002,10 @@ func (d *Data) GetToppingsList(countryID, filename string) []models.ToppingList
|
|||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingList
|
||||
}
|
||||
if _, ok := d.recipeMap[countryID]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
return d.CurrentRecipe[countryID].Topping.ToppingList
|
||||
}
|
||||
// if _, ok := d.recipeMap[countryID]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// return d.CurrentRecipe[countryID].Topping.ToppingList
|
||||
// }
|
||||
}
|
||||
|
||||
if filename == "default" {
|
||||
|
|
@ -1040,10 +1040,12 @@ func (d *Data) GetMaterialCode(ids []uint64, countryID, filename string) []model
|
|||
|
||||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
result = d.CurrentRecipe[countryID].MaterialCode
|
||||
} else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
return recipe.Recipe[countryID].MaterialCode
|
||||
} else {
|
||||
// else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// return recipe.Recipe[countryID].MaterialCode
|
||||
// }
|
||||
// else {
|
||||
|
||||
if filename == "default" {
|
||||
filename = d.CurrentFile[countryID]
|
||||
|
|
@ -1111,10 +1113,11 @@ func (d *Data) GetToppings(countryID, filename string) models.Topping {
|
|||
|
||||
if filename == "" || filename == d.CurrentFile[countryID] {
|
||||
return d.CurrentRecipe[countryID].Topping
|
||||
} else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
d.CurrentFile[countryID] = filename
|
||||
return recipe.Recipe[countryID].Topping
|
||||
}
|
||||
// else if recipe, ok := d.recipeMap[filename]; ok {
|
||||
// d.CurrentFile[countryID] = filename
|
||||
// return recipe.Recipe[countryID].Topping
|
||||
// }
|
||||
|
||||
// if filename == "default" {
|
||||
// filename = d.CurrentFile[countryID]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/png"
|
||||
"time"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
|
@ -81,7 +84,7 @@ func (r *RedisCli) GetKeyTo(source string, dest interface{}) error {
|
|||
err = json.NewDecoder(bytes.NewBufferString(saved)).Decode(dest)
|
||||
|
||||
if err != nil {
|
||||
// //fmt.Println("GET error ", err)
|
||||
fmt.Println("GET error ", err)
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
@ -136,6 +139,41 @@ func (r *RedisCli) SetKeyTimeout(key string, value interface{}, timeout int) err
|
|||
return err
|
||||
}
|
||||
|
||||
func (r *RedisCli) SetImageToCache(key string, value image.Image) error {
|
||||
if err := r.HealthCheck(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mValue, err := json.Marshal(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = r.Client.Set(context.Background(), key, mValue, time.Duration(3600)*time.Second).Err()
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *RedisCli) GetCacheImage(key string) (image.Image, error) {
|
||||
if err := r.HealthCheck(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result, err := r.Client.Get(context.Background(), key).Result()
|
||||
if err != nil {
|
||||
fmt.Println("GetCacheImage", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cacheImg, err := png.Decode(bytes.NewBufferString(result))
|
||||
if err != nil {
|
||||
fmt.Println("GetCacheImage.Decode", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Println("Cache image return OK!")
|
||||
return cacheImg, nil
|
||||
|
||||
}
|
||||
|
||||
func (r *RedisCli) KeyList() ([]string, error) {
|
||||
// if cannot pass healthcheck, return err
|
||||
if err := r.HealthCheck(); err != nil {
|
||||
|
|
|
|||
49
server/data/socket-client.go
Normal file
49
server/data/socket-client.go
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package data
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// type SocketCli struct {
|
||||
// Client *socketio.Client
|
||||
// }
|
||||
|
||||
func NewSocketCli(user, response_room string) *map[string]interface{} {
|
||||
|
||||
ticketUrl := "http://localhost:3001"
|
||||
|
||||
ticketForm := map[string]string{
|
||||
"user": user,
|
||||
"response_room": response_room,
|
||||
}
|
||||
|
||||
ticketByte, _ := json.Marshal(ticketForm)
|
||||
|
||||
req, err := http.NewRequest("POST", ticketUrl, bytes.NewBuffer(ticketByte))
|
||||
if err != nil {
|
||||
fmt.Println("create request fail: ", err)
|
||||
}
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{}
|
||||
result, err := client.Do(req)
|
||||
if err != nil {
|
||||
fmt.Println("request fail: ", err)
|
||||
}
|
||||
defer result.Body.Close()
|
||||
|
||||
bill := &map[string]interface{}{}
|
||||
decodeErr := json.NewDecoder(result.Body).Decode(bill)
|
||||
if decodeErr != nil {
|
||||
fmt.Println("decode request error: ", decodeErr)
|
||||
}
|
||||
|
||||
if result.StatusCode != http.StatusCreated {
|
||||
fmt.Println("not expected status: ", result.Status)
|
||||
}
|
||||
|
||||
return bill
|
||||
}
|
||||
|
|
@ -15,12 +15,21 @@ require (
|
|||
|
||||
require (
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 // indirect
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
|
||||
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/gomodule/redigo v1.9.2 // indirect
|
||||
github.com/googollee/go-socket.io v1.8.0-rc.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.1 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/prometheus/client_model v0.5.0 // indirect
|
||||
github.com/prometheus/common v0.45.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/redis/go-redis/v9 v9.4.0 // indirect
|
||||
)
|
||||
|
||||
|
|
@ -33,7 +42,7 @@ require (
|
|||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
golang.org/x/crypto v0.15.0 // indirect
|
||||
golang.org/x/crypto v0.22.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
|
||||
google.golang.org/grpc v1.59.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
|
|
@ -47,6 +56,7 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||
github.com/prometheus/client_golang v1.18.0
|
||||
github.com/spf13/afero v1.9.5 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
|
|
@ -55,8 +65,8 @@ require (
|
|||
github.com/subosito/gotenv v1.4.2 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0
|
||||
golang.org/x/net v0.18.0 // indirect
|
||||
golang.org/x/sys v0.14.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ github.com/Acconut/go-httptest-recorder v1.0.0/go.mod h1:CwQyhTH1kq/gLyWiRieo7c0
|
|||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 h1:y4B3+GPxKlrigF1ha5FFErxK+sr6sWxQovRMzwMhejo=
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
|
|
@ -81,6 +83,10 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
|
|||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
|
|
@ -113,6 +119,11 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
|
|||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/gomodule/redigo v1.8.4 h1:Z5JUg94HMTR1XpwBaSH4vq3+PNSIykBLxMdglbw10gg=
|
||||
github.com/gomodule/redigo v1.8.4/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
|
||||
github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE=
|
||||
github.com/gomodule/redigo v1.9.2 h1:HrutZBLhSIU8abiSfW8pj8mPhOyMYjZT/wcA4/L9L9s=
|
||||
github.com/gomodule/redigo v1.9.2/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
|
|
@ -126,6 +137,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
|
|
@ -154,6 +166,15 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m
|
|||
github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas=
|
||||
github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/googollee/go-socket.io v1.7.0 h1:ODcQSAvVIPvKozXtUGuJDV3pLwdpBLDs1Uoq/QHIlY8=
|
||||
github.com/googollee/go-socket.io v1.7.0/go.mod h1:0vGP8/dXR9SZUMMD4+xxaGo/lohOw3YWMh2WRiWeKxg=
|
||||
github.com/googollee/go-socket.io v1.8.0-rc.1 h1:Y5DV+pKDw2KFBtdEyxBp8mSuuU4XS3eHGNb2E3bLACI=
|
||||
github.com/googollee/go-socket.io v1.8.0-rc.1/go.mod h1:oZhC7XylbziHxXhVdXvz6qQB0/jmNc4V3d9jgaEBKHI=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
|
|
@ -180,6 +201,9 @@ github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3v
|
|||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI=
|
||||
github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
|
||||
|
|
@ -191,7 +215,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
|||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
|
||||
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
|
||||
github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI=
|
||||
github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM=
|
||||
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
|
||||
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
|
||||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||
github.com/redis/go-redis/v9 v9.4.0 h1:Yzoz33UZw9I/mFhx4MNrB6Fk+XHO1VukNcCa1+lwyKk=
|
||||
github.com/redis/go-redis/v9 v9.4.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
|
|
@ -217,6 +249,7 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
|
|
@ -228,6 +261,7 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
|
|
@ -248,9 +282,13 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
|
||||
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
|
||||
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
|
||||
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
|
|
@ -263,6 +301,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
|
|||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
|
||||
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
|
|
@ -286,6 +326,9 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
|
||||
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
|
@ -319,8 +362,12 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
|
||||
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
|
|
@ -342,6 +389,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
||||
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
@ -379,10 +427,19 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
@ -391,6 +448,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
|
@ -443,6 +501,8 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
|
|||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
@ -560,6 +620,7 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST
|
|||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
|||
|
|
@ -140,8 +140,23 @@ type CountryNamePerms struct {
|
|||
func LoadCountrySettingsWithPermissions() []CountryNamePerms {
|
||||
res := make([]CountryNamePerms, 0)
|
||||
|
||||
path, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
fmt.Println(path)
|
||||
|
||||
files, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
fmt.Println(file.Name(), file.IsDir())
|
||||
}
|
||||
|
||||
// read file country.settings.json
|
||||
content, err := os.Open("country.settings.json")
|
||||
content, err := os.Open("./country.settings.json")
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("country.settings.json not found"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package routers
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/png"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -15,6 +16,7 @@ import (
|
|||
"recipe-manager/services/logger"
|
||||
"recipe-manager/services/recipe"
|
||||
"recipe-manager/services/sheet"
|
||||
"recipe-manager/services/user"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
|
@ -31,6 +33,7 @@ type RecipeRouter struct {
|
|||
recipeService recipe.RecipeService
|
||||
taoLogger *logger.TaoLogger
|
||||
cache_db *data.RedisCli
|
||||
userService user.UserService
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -38,13 +41,14 @@ var (
|
|||
updateMutex = sync.Mutex{}
|
||||
)
|
||||
|
||||
func NewRecipeRouter(data *data.Data, recipeService recipe.RecipeService, sheetService sheet.SheetService, taoLogger *logger.TaoLogger, cache *data.RedisCli) *RecipeRouter {
|
||||
func NewRecipeRouter(data *data.Data, recipeService recipe.RecipeService, sheetService sheet.SheetService, taoLogger *logger.TaoLogger, cache *data.RedisCli, userService user.UserService) *RecipeRouter {
|
||||
return &RecipeRouter{
|
||||
data,
|
||||
sheetService,
|
||||
recipeService,
|
||||
taoLogger,
|
||||
cache,
|
||||
userService,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,6 +218,12 @@ func (rr *RecipeRouter) Route(r chi.Router) {
|
|||
// ====================== Handler =================================
|
||||
|
||||
func (rr *RecipeRouter) dashBoard(w http.ResponseWriter, r *http.Request) {
|
||||
// test socket
|
||||
// u := r.Context().Value("user").(*models.User)
|
||||
// // rr.taoLogger.Log.Debug("SockConn", zap.Any("Socket", rr.socket), zap.Any("user", u))
|
||||
// userNewSocket := data.NewSocketCli(u.Name, "recipe:response")
|
||||
// rr.taoLogger.Log.Debug("SockConn", zap.Any("Socket", userNewSocket))
|
||||
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
|
||||
country := r.URL.Query().Get("country")
|
||||
|
|
@ -802,22 +812,40 @@ func (rr *RecipeRouter) getImageOfProductCode(w http.ResponseWriter, r *http.Req
|
|||
return
|
||||
}
|
||||
|
||||
// read image
|
||||
imgFile, err := os.Open(fullPath)
|
||||
// TODO: get from cache
|
||||
var imgResult image.Image
|
||||
// try cache
|
||||
img, err := rr.cache_db.GetCacheImage(fullPath)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
defer imgFile.Close()
|
||||
// read image
|
||||
imgFile, err := os.Open(fullPath)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
defer imgFile.Close()
|
||||
|
||||
thisImage, err := png.Decode(imgFile)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
thisImage, err := png.Decode(imgFile)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
imgResult = thisImage
|
||||
|
||||
// set cache
|
||||
err = rr.cache_db.SetImageToCache(fullPath, thisImage)
|
||||
if err != nil {
|
||||
rr.taoLogger.Log.Debug("CacheImage.SetError", zap.Any("error", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
imgResult = img
|
||||
rr.taoLogger.Log.Debug("CacheImage.OK", zap.Any("status", imgResult))
|
||||
}
|
||||
|
||||
// write image
|
||||
png.Encode(w, thisImage)
|
||||
png.Encode(w, imgResult)
|
||||
}
|
||||
|
||||
func APIhandler(w http.ResponseWriter, r *http.Request) bool {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ func (s *Server) createHandler() {
|
|||
}
|
||||
|
||||
// Recipe Router
|
||||
rr := routers.NewRecipeRouter(s.data, recipeService, sheetService, s.taoLogger, s.cache_db)
|
||||
rr := routers.NewRecipeRouter(s.data, recipeService, sheetService, s.taoLogger, s.cache_db, userService)
|
||||
rr.Route(r)
|
||||
|
||||
// Material Router
|
||||
|
|
|
|||
|
|
@ -204,6 +204,8 @@ func (rs *recipeService) GetRecipeDashboard(request *contracts.RecipeDashboardRe
|
|||
return contracts.RecipeDashboardResponse{}, fmt.Errorf("country name: %s not found", request.Country)
|
||||
}
|
||||
|
||||
// TODO: validate if filename exist in that country
|
||||
|
||||
recipe := rs.db.GetRecipe(countryID, request.Filename)
|
||||
|
||||
// recheck if filename is `default`
|
||||
|
|
@ -314,7 +316,6 @@ func (rs *recipeService) GetRecipeOverview(request *contracts.RecipeOverviewRequ
|
|||
|
||||
// do sorting
|
||||
|
||||
|
||||
} else if result.TotalCount > request.Skip {
|
||||
result.Result = result.Result[request.Skip:]
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue