From e2cd24a39fe988964988521a12003d216d7ee15e Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 14 Jan 2022 00:22:34 -0500 Subject: [PATCH] jobs now include direct link --- broker/job.go | 7 +++++-- broker/ntgvision.go | 3 ++- config.json | 3 ++- config/config.go | 9 +++++---- todo.yaml | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/broker/job.go b/broker/job.go index 76d08d4..5c2c21b 100644 --- a/broker/job.go +++ b/broker/job.go @@ -10,6 +10,7 @@ import ( type Job struct { ID string + URI string Pickup JobLocation Dropoff JobLocation Weight int @@ -25,12 +26,13 @@ type JobLocation struct { func (j Job) String() string { return fmt.Sprintf( - `%s => %s (%d miles), Weight:%d, Notes:%s`, + `%s => %s (%d miles), Weight:%d, Notes:%s Link:%s`, j.Pickup.String(), j.Dropoff.String(), j.Miles, j.Weight, j.Meta, + j.URI, ) } @@ -41,7 +43,7 @@ func (j JobLocation) String() string { func (j Job) FormatMultilineText() string { foo := func(client string) string { return fmt.Sprintf( - "--- %s: %s => %s ---\nPickup: %s\nDropoff: %s\nNotes: %d lbs, %d miles, %s", + "--- %s: %s => %s ---\nPickup: %s\nDropoff: %s\nNotes: %d lbs, %d miles, %s\n%s", client, j.Pickup.State, j.Dropoff.State, @@ -50,6 +52,7 @@ func (j Job) FormatMultilineText() string { j.Weight, j.Miles, j.Meta, + j.URI, ) } out := "" diff --git a/broker/ntgvision.go b/broker/ntgvision.go index 1e5c394..ac10a7d 100644 --- a/broker/ntgvision.go +++ b/broker/ntgvision.go @@ -39,7 +39,8 @@ func (ntgJob ntgVisionJob) Job() Job { pickup, _ := time.ParseInLocation("01/02/06", ntgJob.PickupDate, time.Local) dropoff, _ := time.ParseInLocation("01/02/06", ntgJob.DropoffDate, time.Local) return Job{ - ID: fmt.Sprintf("ntg-%d", ntgJob.ID), + ID: fmt.Sprintf("ntg-%d", ntgJob.ID), + URI: fmt.Sprintf(config.Get().Brokers.NTG.LoadPageURIFormat, ntgJob.ID), Pickup: JobLocation{ Date: pickup, City: ntgJob.PickupCity, diff --git a/config.json b/config.json index eaccf1d..cdabebf 100644 --- a/config.json +++ b/config.json @@ -61,7 +61,7 @@ "Matrix": { "ReceiveEnabled": true, "Mock": false, - "Continuation": "602", + "Continuation": "1314", "Homeserver": "https://m.bltrucks.top", "Username": "@bot.m.bltrucks.top", "Token": "mvDWB96KXMF8XhOam8EC5XVdQvSEw0CDeClcSWocBcYkwZX3FPNWZ5uOnQk2EmT1cjpzfeuD7gDYPPjOuyZlI3bE9TE35UjNOlZgi0Tugm25s91iVsbIF6kMZsCIhVMSmEf6w3jxX6wQYOWvmDZ4mu6f5c8wr221EMDcOpEzQV09d1zuBSWgKLBgjqAkYHJZ5dTRIWpEDpPgujhOFZa2ld1HiAOxrJKlIrlfDBN0CUsTlGOGplujDAr4VtpFzNRS", @@ -73,6 +73,7 @@ "Brokers": { "NTG": { "Mock": true, + "LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d", "Token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIzMTAyOSIsInVuaXF1ZV9uYW1lIjoibm9lYXN5cnVuc3RydWNraW5nQGdtYWlsLmNvbSIsImp0aSI6IjFmYzhmNjk1LTQzNTYtNGYzZS05NWY1LWZkNWVjMDJlMDkxNyIsImlhdCI6IjEvMTAvMjAyMiAxMTo1OTozNiBQTSIsIm50Z3ZSb2xlIjoiQ2FycmllckFwcHJvdmVkIiwidXNlckNhcnJpZXJzIjoiMTUzNDIzIiwib3RyVXNlciI6IkZhbHNlIiwibmJmIjoxNjQxODU5MTc2LCJleHAiOjE2NDE5NDE5NzYsImlzcyI6Ik5URyBTZWN1cml0eSBUb2tlbiBTZXJ2aWNlIiwiYXVkIjoiTlRHIn0.kpHOBTtcQhbdloAw7xEjnkzfxf4ToMgidrLCMomZmnmKQHlD_7OQuI8nQiCTHc_ntuGtt8Ui92kwWWUiLwN_2tT2vC7Jy6m9IjwqgbAzsgTLi4jAbIwITD-awiDh4FUKDwGq3XpEjs-i7XM3rI7tTk7jg9QSDId8EF3Pt5fJq6QhztC6y7-JaSFQZLMtkSCAWmOQx_TgKgVoVbgMeiqhHbZ2hhoA7TtpEIIL5Gnfq46t3E18ExdrsO96ZCGQGcBw5x8J1ustq2cwdlFKeg4ULNWAAd1ay1hojRa7jCHs98AcoJ3Nts9-o7yEMuN2rrfpK_nm68nciwFtF-ke1KoiBg", "Username": "noeasyrunstrucking@gmail.com", "Password": "thumper123" diff --git a/config/config.go b/config/config.go index 6b57b05..21e9d64 100644 --- a/config/config.go +++ b/config/config.go @@ -51,10 +51,11 @@ type Config struct { Once bool Brokers struct { NTG struct { - Mock bool - Token string - Username string - Password string + Mock bool + LoadPageURIFormat string + Token string + Username string + Password string } } diff --git a/todo.yaml b/todo.yaml index b860a9e..4d2f667 100644 --- a/todo.yaml +++ b/todo.yaml @@ -1,6 +1,5 @@ todo: - write-as for clients so ma can write to pa by default -- link to view more - continuation is garbo, but I can still do better client side to avoid get-set high level - todo: details from ntg; stophours for pickup, appointmenttime/facitlyhours for dest details: | @@ -22,6 +21,7 @@ todo: - banlist criteria like vendors, brokers, metadata - set up copy for caleb, broc done: +- link to view more - map with to-from line - TO CONFLUENT.RS OR W/E - rm get-set stuff for matrix now that it has continuation