mirror of
https://github.com/lus/pasty.git
synced 2023-08-10 21:13:09 +03:00
99504e0bba
* Add documentation notice * Rename the deletion token to modification token * Implement API basics * Implement paste modification endpoint (#10) * Implement paste metadata * Implement report webhook support * Document API * Document paste entity * Update syntax highlighting types (js -> jsonc) * Update migrator
27 lines
650 B
Go
27 lines
650 B
Go
package v1
|
|
|
|
import "github.com/lus/pasty/internal/shared"
|
|
|
|
type legacyPaste struct {
|
|
ID string `json:"id"`
|
|
Content string `json:"content"`
|
|
DeletionToken string `json:"deletionToken,omitempty"`
|
|
Created int64 `json:"created"`
|
|
AutoDelete bool `json:"autoDelete"`
|
|
}
|
|
|
|
func legacyFromModern(paste *shared.Paste) *legacyPaste {
|
|
deletionToken := paste.ModificationToken
|
|
if deletionToken == "" {
|
|
deletionToken = paste.DeletionToken
|
|
}
|
|
|
|
return &legacyPaste{
|
|
ID: paste.ID,
|
|
Content: paste.Content,
|
|
DeletionToken: deletionToken,
|
|
Created: paste.Created,
|
|
AutoDelete: paste.AutoDelete,
|
|
}
|
|
}
|