mirror of
https://github.com/edufeed-org/eventstore.git
synced 2025-12-09 16:24:32 +00:00
remove comment
This commit is contained in:
parent
bf1b383e5e
commit
4004c6da63
1 changed files with 0 additions and 99 deletions
|
|
@ -342,105 +342,6 @@ func NostrToAMB(event *nostr.Event) (*AMBMetadata, error) {
|
||||||
return amb, nil
|
return amb, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// // NostrToAMB converts a Nostr event of kind 30142 to AMB metadata
|
|
||||||
// func NostrToAMB(event *nostr.Event) (*AMBMetadata, error) {
|
|
||||||
// eventRaw, _ := eventToStringifiedJSON(event)
|
|
||||||
|
|
||||||
// amb := &AMBMetadata{
|
|
||||||
// Type: "LearningResource",
|
|
||||||
// NostrMetadata: NostrMetadata{
|
|
||||||
// EventID: event.ID,
|
|
||||||
// EventPubKey: event.PubKey,
|
|
||||||
// EventContent: event.Content,
|
|
||||||
// EventCreatedAt: event.CreatedAt,
|
|
||||||
// EventKind: event.Kind,
|
|
||||||
// EventSig: event.Sig,
|
|
||||||
// EventRaw: eventRaw,
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for _, tag := range event.Tags {
|
|
||||||
// if len(tag) < 2 {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // TODO alle Attribute durchgehen für das parsen
|
|
||||||
// switch tag[0] {
|
|
||||||
// case "d":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.ID = event.ID
|
|
||||||
// amb.D = tag[1]
|
|
||||||
// }
|
|
||||||
// case "name":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.Name = tag[1]
|
|
||||||
// }
|
|
||||||
// case "description":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.Description = tag[1]
|
|
||||||
// }
|
|
||||||
// case "creator":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// creator := &Creator{}
|
|
||||||
// creator.Name = tag[1]
|
|
||||||
// if len(tag) >= 3 {
|
|
||||||
// creator.ID = tag[2]
|
|
||||||
// }
|
|
||||||
// if len(tag) >= 4 {
|
|
||||||
// creator.Type = tag[3]
|
|
||||||
// }
|
|
||||||
|
|
||||||
// amb.Creator = append(amb.Creator, creator)
|
|
||||||
// }
|
|
||||||
// case "image":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.Image = tag[1]
|
|
||||||
// }
|
|
||||||
// case "about":
|
|
||||||
// if len(tag) >= 3 {
|
|
||||||
// subject := &About{}
|
|
||||||
// subject.PrefLabel = tag[1]
|
|
||||||
// subject.InLanguage = tag[2]
|
|
||||||
// if len(tag) >= 4 {
|
|
||||||
// subject.ID = tag[3]
|
|
||||||
// }
|
|
||||||
// amb.About = append(amb.About, subject)
|
|
||||||
// }
|
|
||||||
// case "learningResourceType":
|
|
||||||
// if len(tag) >= 3 {
|
|
||||||
// lrt := &LearningResourceType{}
|
|
||||||
// lrt.PrefLabel = tag[1]
|
|
||||||
// lrt.InLanguage = tag[2]
|
|
||||||
// if len(tag) >= 4 {
|
|
||||||
// lrt.ID = tag[3]
|
|
||||||
// }
|
|
||||||
// amb.LearningResourceType = append(amb.LearningResourceType, lrt)
|
|
||||||
// }
|
|
||||||
// case "inLanguage":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.InLanguage = append(amb.InLanguage, tag[1])
|
|
||||||
// }
|
|
||||||
// case "keywords":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.Keywords = tag[1:]
|
|
||||||
// }
|
|
||||||
// case "license":
|
|
||||||
// if len(tag) >= 3 {
|
|
||||||
// amb.License = &License{}
|
|
||||||
// amb.License.ID = tag[1]
|
|
||||||
// amb.License.Name = tag[2]
|
|
||||||
|
|
||||||
// }
|
|
||||||
// case "datePublished":
|
|
||||||
// if len(tag) >= 2 {
|
|
||||||
// amb.DatePublished = tag[1]
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return amb, nil
|
|
||||||
// }
|
|
||||||
|
|
||||||
// converts a stringified JSON event to a nostr.Event
|
// converts a stringified JSON event to a nostr.Event
|
||||||
func StringifiedJSONToNostrEvent(jsonString string) (nostr.Event, error) {
|
func StringifiedJSONToNostrEvent(jsonString string) (nostr.Event, error) {
|
||||||
var event nostr.Event
|
var event nostr.Event
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue