Shares #109
4 changed files with 9 additions and 0 deletions
|
@ -97,6 +97,10 @@ func (c *Call) ShouldStore() bool {
|
|||
}
|
||||
|
||||
func (c *Call) SetShareURL(baseURL url.URL, shareID string) {
|
||||
if c.AudioURL != nil {
|
||||
return
|
||||
}
|
||||
|
||||
baseURL.Path = fmt.Sprintf("/share/%s/call", shareID)
|
||||
c.AudioURL = common.PtrTo(baseURL.String())
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ func toAddCallParams(call *calls.Call) database.AddCallParams {
|
|||
AudioName: common.NilIfZero(call.AudioName),
|
||||
AudioBlob: call.Audio,
|
||||
AudioType: common.NilIfZero(call.AudioType),
|
||||
AudioUrl: call.AudioURL,
|
||||
Duration: call.Duration.MsInt32Ptr(),
|
||||
Frequency: call.Frequency,
|
||||
Frequencies: call.Frequencies,
|
||||
|
|
|
@ -29,6 +29,9 @@ type Incident struct {
|
|||
func (inc *Incident) SetShareURL(bu url.URL, shareID string) {
|
||||
bu.Path = fmt.Sprintf("/share/%s/call/", shareID)
|
||||
for i := range inc.Calls {
|
||||
if inc.Calls[i].AudioURL != nil {
|
||||
continue
|
||||
}
|
||||
inc.Calls[i].AudioURL = common.PtrTo(bu.String() + inc.Calls[i].ID.String())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,6 +268,7 @@ func fromDBCalls(d []database.GetIncidentCallsRow) []incidents.IncidentCall {
|
|||
ID: v.CallID,
|
||||
AudioName: common.ZeroIfNil(v.AudioName),
|
||||
AudioType: common.ZeroIfNil(v.AudioType),
|
||||
AudioURL: v.AudioUrl,
|
||||
Duration: dur,
|
||||
DateTime: v.CallDate.Time,
|
||||
Frequencies: v.Frequencies,
|
||||
|
|
Loading…
Add table
Reference in a new issue