Fix-ish frontend models, a generator and a generate command

This commit is contained in:
Melody Becker 2024-11-20 16:11:11 +01:00
parent a6291fd098
commit a94a360773
14 changed files with 380 additions and 314 deletions

View file

@ -91,7 +91,7 @@ func main() {
`) `)
outBuilder.WriteString("import Model, { attr } from '@ember-data/model';\n\n") outBuilder.WriteString("import Model, { attr } from '@ember-data/model';\n\n")
outBuilder.WriteString("export default class RoleModel extends Model {\n") outBuilder.WriteString("export default class Role extends Model {\n")
outBuilder.WriteString(` @attr() declare createdAt: Date outBuilder.WriteString(` @attr() declare createdAt: Date
@attr() declare updatedAt: Date @attr() declare updatedAt: Date
@attr() declare name: string @attr() declare name: string
@ -105,7 +105,12 @@ func main() {
outBuilder.WriteString(fNT(n, t)) outBuilder.WriteString(fNT(n, t))
} }
outBuilder.WriteString("}") outBuilder.WriteString("}\n\n")
outBuilder.WriteString(`declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
role: Role
}
}`)
fmt.Fprint(output, outBuilder.String()) fmt.Fprint(output, outBuilder.String())
} }

View file

@ -1,13 +1,13 @@
import Model, { attr, hasMany, type AsyncHasMany } from '@ember-data/model' import Model, { attr, hasMany, type AsyncHasMany } from '@ember-data/model'
import type RemoteServerModel from './remote-server'
import type CustomAccountFieldModel from './custom-account-field' import type CustomAccountFieldModel from './custom-account-field'
import type MediaMetadataModel from './media-metadata' import type MediaMetadataModel from './media-metadata'
import type OriginServer from './origin-server'
export default class AccountModel extends Model { export default class Account extends Model {
@attr declare createdAt: Date @attr declare createdAt: Date
@attr declare updatedAt: Date @attr declare updatedAt: Date
@attr declare username: string @attr declare username: string
@attr declare originServer: RemoteServerModel @attr declare originServer: OriginServer
@attr declare originServerId: number @attr declare originServerId: number
@attr declare displayName: string @attr declare displayName: string
@hasMany('custom-account-field') @hasMany('custom-account-field')
@ -28,3 +28,9 @@ export default class AccountModel extends Model {
@attr declare pronouns: Array<string> @attr declare pronouns: Array<string>
@attr declare roles: Array<string> @attr declare roles: Array<string>
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
account: Account
}
}

View file

@ -1,6 +1,6 @@
import Model, { attr } from '@ember-data/model' import Model, { attr } from '@ember-data/model'
export default class CustomAccountFieldModel extends Model { export default class CustomAccountField extends Model {
@attr declare createdAt: Date @attr declare createdAt: Date
@attr declare updatedAt: Date @attr declare updatedAt: Date
@attr declare key: string @attr declare key: string
@ -8,3 +8,9 @@ export default class CustomAccountFieldModel extends Model {
@attr declare verified?: boolean @attr declare verified?: boolean
@attr declare belongsToId: string @attr declare belongsToId: string
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
customAccountField: CustomAccountField
}
}

View file

@ -1,11 +1,17 @@
import Model, { attr } from '@ember-data/model' import Model, { attr } from '@ember-data/model'
import type MediaMetadataModel from './media-metadata' import type MediaMetadataModel from './media-metadata'
import type RemoteServerModel from './remote-server' import type OriginServer from './origin-server'
export default class EmoteModel extends Model { export default class Emote extends Model {
@attr declare metadataId: string @attr declare metadataId: string
@attr declare metadata: MediaMetadataModel @attr declare metadata: MediaMetadataModel
@attr declare name: string @attr declare name: string
@attr declare serverId: number @attr declare serverId: number
@attr declare server: RemoteServerModel @attr declare server: OriginServer
}
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
emote: Emote
}
} }

View file

@ -1,6 +1,6 @@
import Model, { attr } from '@ember-data/model' import Model, { attr } from '@ember-data/model'
export default class MediaMetadataModel extends Model { export default class MediaMetadata extends Model {
@attr declare createdAt: Date @attr declare createdAt: Date
@attr declare updatedAt: Date @attr declare updatedAt: Date
@attr declare isRemote: boolean @attr declare isRemote: boolean
@ -10,3 +10,9 @@ export default class MediaMetadataModel extends Model {
@attr declare altText: string @attr declare altText: string
@attr declare blurred: boolean @attr declare blurred: boolean
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
mediaMetadata: MediaMetadata
}
}

View file

@ -1,11 +1,11 @@
import Model, { attr, hasMany, type AsyncHasMany } from '@ember-data/model' import Model, { attr, hasMany, type AsyncHasMany } from '@ember-data/model'
import type RemoteServerModel from './remote-server'
import type AccountModel from './account' import type AccountModel from './account'
import type MediaMetadataModel from './media-metadata' import type MediaMetadataModel from './media-metadata'
import type OriginServer from './origin-server'
export default class NoteModel extends Model { export default class Note extends Model {
@attr declare content: string @attr declare content: string
@attr declare originServer: RemoteServerModel @attr declare originServer: OriginServer
@attr declare originServerId: number @attr declare originServerId: number
@attr declare reactionCount: number @attr declare reactionCount: number
@attr declare createdAt: Date @attr declare createdAt: Date
@ -24,3 +24,9 @@ export default class NoteModel extends Model {
@attr declare pingIds?: Array<string> @attr declare pingIds?: Array<string>
@attr declare reactionIds: Array<number> @attr declare reactionIds: Array<number>
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
note: Note
}
}

View file

@ -1,8 +1,14 @@
import Model, { attr } from '@ember-data/model' import Model, { attr } from '@ember-data/model'
export default class RemoteServerModel extends Model { export default class OriginServer extends Model {
@attr() declare serverType: string @attr() declare serverType: string
@attr() declare name: string @attr() declare name: string
@attr() declare iconUrl: string @attr() declare iconUrl: string
@attr() declare isSelf: boolean @attr() declare isSelf: boolean
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
originServer: OriginServer
}
}

View file

@ -1,9 +1,15 @@
import Model, { attr } from '@ember-data/model' import Model, { attr } from '@ember-data/model'
import type EmoteModel from './emote' import type EmoteModel from './emote'
export default class ReactionModel extends Model { export default class Reaction extends Model {
@attr declare noteId: string @attr declare noteId: string
@attr declare reactorId: string @attr declare reactorId: string
@attr declare emoteId: number @attr declare emoteId: number
@attr declare emote: EmoteModel @attr declare emote: EmoteModel
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
reaction: Reaction
}
}

View file

@ -1,6 +1,6 @@
import Model, { attr } from '@ember-data/model' import Model, { attr } from '@ember-data/model'
export default class RelationModel extends Model { export default class Relation extends Model {
@attr declare createdAt: Date @attr declare createdAt: Date
@attr declare updatedAt: Date @attr declare updatedAt: Date
@attr declare fromId: string @attr declare fromId: string
@ -8,3 +8,9 @@ export default class RelationModel extends Model {
@attr declare requested: boolean @attr declare requested: boolean
@attr declare accepted: boolean @attr declare accepted: boolean
} }
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
relation: Relation
}
}

View file

@ -2,7 +2,7 @@
// If you need to refresh the content, run go generate again // If you need to refresh the content, run go generate again
import Model, { attr } from '@ember-data/model'; import Model, { attr } from '@ember-data/model';
export default class RoleModel extends Model { export default class Role extends Model {
@attr() declare createdAt: Date @attr() declare createdAt: Date
@attr() declare updatedAt: Date @attr() declare updatedAt: Date
@attr() declare name: string @attr() declare name: string
@ -10,49 +10,55 @@ export default class RoleModel extends Model {
@attr() declare isUserRole: boolean @attr() declare isUserRole: boolean
@attr() declare isBuiltIn: boolean @attr() declare isBuiltIn: boolean
@attr() declare canSendMedia?: boolean
@attr() declare canSendFollowerOnlyNotes?: boolean
@attr() declare canIncludeLinks?: boolean
@attr() declare hasMentionCountLimit?: boolean
@attr() declare scanCreatedFollowerOnlyNotes?: boolean
@attr() declare canAffectOtherAdmins?: boolean
@attr() declare canConfirmWithheldNotes?: boolean
@attr() declare canSendCustomEmotes?: boolean
@attr() declare scanCreatedLocalNotes?: boolean
@attr() declare canOverwriteDisplayNames?: boolean
@attr() declare canRecoverDeletedNotes?: boolean
@attr() declare canManageAds?: boolean
@attr() declare canFederateBsky?: boolean
@attr() declare autoCwPostsText?: string
@attr() declare scanCreatedPublicNotes?: boolean
@attr() declare withholdNotesForManualApproval?: boolean
@attr() declare canSendReplies?: boolean
@attr() declare autoNsfwMedia?: boolean
@attr() declare canSendCustomReactions?: boolean @attr() declare canSendCustomReactions?: boolean
@attr() declare canSendLocalNotes?: boolean @attr() declare autoCwPostsText?: string
@attr() declare canSendPrivateNotes?: boolean
@attr() declare canFederateFedi?: boolean
@attr() declare withholdNotesBasedOnRegex?: boolean
@attr() declare fullAdmin?: boolean
@attr() declare canSendAnnouncements?: boolean
@attr() declare canQuote?: boolean
@attr() declare canIncludeSurvey?: boolean
@attr() declare canChangeDisplayName?: boolean
@attr() declare blockedUsers?: Array<string>
@attr() declare canMentionOthers?: boolean
@attr() declare autoCwPosts?: boolean
@attr() declare canSendPublicNotes?: boolean
@attr() declare mentionLimit?: number
@attr() declare scanCreatedPrivateNotes?: boolean
@attr() declare withholdNotesRegexes?: Array<string> @attr() declare withholdNotesRegexes?: Array<string>
@attr() declare canAssignRoles?: boolean @attr() declare canAssignRoles?: boolean
@attr() declare canSupressInteractionsBetweenUsers?: boolean @attr() declare canSupressInteractionsBetweenUsers?: boolean
@attr() declare canSendCustomEmotes?: boolean
@attr() declare canOverwriteDisplayNames?: boolean
@attr() declare canManageCustomEmotes?: boolean @attr() declare canManageCustomEmotes?: boolean
@attr() declare canViewDeletedNotes?: boolean
@attr() declare canBoost?: boolean
@attr() declare canSubmitReports?: boolean
@attr() declare canLogin?: boolean
@attr() declare disallowInteractionsWith?: Array<string>
@attr() declare canDeleteNotes?: boolean @attr() declare canDeleteNotes?: boolean
@attr() declare canManageAvatarDecorations?: boolean @attr() declare canManageAvatarDecorations?: boolean
@attr() declare canManageAds?: boolean
@attr() declare blockedUsers?: Array<string>
@attr() declare hasMentionCountLimit?: boolean
@attr() declare disallowInteractionsWith?: Array<string>
@attr() declare withholdNotesBasedOnRegex?: boolean
@attr() declare fullAdmin?: boolean
@attr() declare canSendAnnouncements?: boolean
@attr() declare autoNsfwMedia?: boolean
@attr() declare scanCreatedPublicNotes?: boolean
@attr() declare scanCreatedPrivateNotes?: boolean
@attr() declare canSendFollowerOnlyNotes?: boolean
@attr() declare canSendPrivateNotes?: boolean
@attr() declare canIncludeSurvey?: boolean
@attr() declare canChangeDisplayName?: boolean
@attr() declare canLogin?: boolean
@attr() declare canAffectOtherAdmins?: boolean
@attr() declare autoCwPosts?: boolean
@attr() declare scanCreatedFollowerOnlyNotes?: boolean
@attr() declare canViewDeletedNotes?: boolean
@attr() declare mentionLimit?: number
@attr() declare withholdNotesForManualApproval?: boolean
@attr() declare canConfirmWithheldNotes?: boolean
@attr() declare canSendMedia?: boolean
@attr() declare canSendPublicNotes?: boolean
@attr() declare canSendReplies?: boolean
@attr() declare canQuote?: boolean
@attr() declare canIncludeLinks?: boolean
@attr() declare canRecoverDeletedNotes?: boolean
@attr() declare canMentionOthers?: boolean
@attr() declare scanCreatedLocalNotes?: boolean
@attr() declare canSendLocalNotes?: boolean
@attr() declare canBoost?: boolean
@attr() declare canFederateFedi?: boolean
@attr() declare canFederateBsky?: boolean
@attr() declare canSubmitReports?: boolean
}
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
role: Role
}
} }

View file

@ -4,5 +4,5 @@ package server
import "gitlab.com/mstarongitlab/linstrom/storage" import "gitlab.com/mstarongitlab/linstrom/storage"
func convertRoleStorageToLinstrom(r storage.Role) linstromRole { func convertRoleStorageToLinstrom(r storage.Role) linstromRole {
return linstromRole{Id:r.ID,CreatedAt:r.CreatedAt,UpdatedAt:r.UpdatedAt,Name:r.Name,Priority:r.Priority,IsUserRole:r.IsUserRole,IsBuiltIn:r.IsBuiltIn,CanSendAnnouncements:r.CanSendAnnouncements,CanIncludeSurvey:r.CanIncludeSurvey,CanSubmitReports:r.CanSubmitReports,CanMentionOthers:r.CanMentionOthers,WithholdNotesBasedOnRegex:r.WithholdNotesBasedOnRegex,CanSendMedia:r.CanSendMedia,CanSendLocalNotes:r.CanSendLocalNotes,ScanCreatedFollowerOnlyNotes:r.ScanCreatedFollowerOnlyNotes,CanOverwriteDisplayNames:r.CanOverwriteDisplayNames,CanDeleteNotes:r.CanDeleteNotes,CanSupressInteractionsBetweenUsers:r.CanSupressInteractionsBetweenUsers,CanManageAds:r.CanManageAds,BlockedUsers:r.BlockedUsers,CanLogin:r.CanLogin,AutoCwPosts:r.AutoCwPosts,WithholdNotesRegexes:r.WithholdNotesRegexes,ScanCreatedPublicNotes:r.ScanCreatedPublicNotes,ScanCreatedLocalNotes:r.ScanCreatedLocalNotes,CanAffectOtherAdmins:r.CanAffectOtherAdmins,CanAssignRoles:r.CanAssignRoles,CanSendFollowerOnlyNotes:r.CanSendFollowerOnlyNotes,CanBoost:r.CanBoost,CanFederateBsky:r.CanFederateBsky,HasMentionCountLimit:r.HasMentionCountLimit,DisallowInteractionsWith:r.DisallowInteractionsWith,CanViewDeletedNotes:r.CanViewDeletedNotes,CanSendCustomReactions:r.CanSendCustomReactions,CanSendReplies:r.CanSendReplies,CanIncludeLinks:r.CanIncludeLinks,CanChangeDisplayName:r.CanChangeDisplayName,CanSendPrivateNotes:r.CanSendPrivateNotes,MentionLimit:r.MentionLimit,WithholdNotesForManualApproval:r.WithholdNotesForManualApproval,CanRecoverDeletedNotes:r.CanRecoverDeletedNotes,AutoCwPostsText:r.AutoCwPostsText,ScanCreatedPrivateNotes:r.ScanCreatedPrivateNotes,CanSendCustomEmotes:r.CanSendCustomEmotes,CanSendPublicNotes:r.CanSendPublicNotes,CanQuote:r.CanQuote,CanFederateFedi:r.CanFederateFedi,CanManageAvatarDecorations:r.CanManageAvatarDecorations,AutoNsfwMedia:r.AutoNsfwMedia,FullAdmin:r.FullAdmin,CanConfirmWithheldNotes:r.CanConfirmWithheldNotes,CanManageCustomEmotes:r.CanManageCustomEmotes,} return linstromRole{Id:r.ID,CreatedAt:r.CreatedAt,UpdatedAt:r.UpdatedAt,Name:r.Name,Priority:r.Priority,IsUserRole:r.IsUserRole,IsBuiltIn:r.IsBuiltIn,CanRecoverDeletedNotes:r.CanRecoverDeletedNotes,CanSendFollowerOnlyNotes:r.CanSendFollowerOnlyNotes,CanSendReplies:r.CanSendReplies,AutoNsfwMedia:r.AutoNsfwMedia,WithholdNotesForManualApproval:r.WithholdNotesForManualApproval,CanAffectOtherAdmins:r.CanAffectOtherAdmins,CanAssignRoles:r.CanAssignRoles,CanOverwriteDisplayNames:r.CanOverwriteDisplayNames,CanManageAvatarDecorations:r.CanManageAvatarDecorations,CanSendMedia:r.CanSendMedia,ScanCreatedLocalNotes:r.ScanCreatedLocalNotes,CanSendCustomEmotes:r.CanSendCustomEmotes,CanSendPublicNotes:r.CanSendPublicNotes,CanIncludeSurvey:r.CanIncludeSurvey,AutoCwPostsText:r.AutoCwPostsText,CanManageCustomEmotes:r.CanManageCustomEmotes,CanSendAnnouncements:r.CanSendAnnouncements,CanSendLocalNotes:r.CanSendLocalNotes,CanBoost:r.CanBoost,CanLogin:r.CanLogin,CanMentionOthers:r.CanMentionOthers,CanManageAds:r.CanManageAds,CanQuote:r.CanQuote,CanChangeDisplayName:r.CanChangeDisplayName,CanSubmitReports:r.CanSubmitReports,FullAdmin:r.FullAdmin,CanSendPrivateNotes:r.CanSendPrivateNotes,CanIncludeLinks:r.CanIncludeLinks,CanFederateFedi:r.CanFederateFedi,HasMentionCountLimit:r.HasMentionCountLimit,AutoCwPosts:r.AutoCwPosts,ScanCreatedPublicNotes:r.ScanCreatedPublicNotes,DisallowInteractionsWith:r.DisallowInteractionsWith,CanDeleteNotes:r.CanDeleteNotes,CanConfirmWithheldNotes:r.CanConfirmWithheldNotes,ScanCreatedPrivateNotes:r.ScanCreatedPrivateNotes,WithholdNotesBasedOnRegex:r.WithholdNotesBasedOnRegex,WithholdNotesRegexes:r.WithholdNotesRegexes,CanSupressInteractionsBetweenUsers:r.CanSupressInteractionsBetweenUsers,CanViewDeletedNotes:r.CanViewDeletedNotes,CanSendCustomReactions:r.CanSendCustomReactions,CanFederateBsky:r.CanFederateBsky,BlockedUsers:r.BlockedUsers,MentionLimit:r.MentionLimit,ScanCreatedFollowerOnlyNotes:r.ScanCreatedFollowerOnlyNotes,}
} }

View file

@ -11,49 +11,49 @@ type linstromRole struct {
Priority uint32 `jsonapi:"attr,priority"` Priority uint32 `jsonapi:"attr,priority"`
IsUserRole bool `jsonapi:"attr,is-user-role"` IsUserRole bool `jsonapi:"attr,is-user-role"`
IsBuiltIn bool `jsonapi:"attr,is-built-in"` IsBuiltIn bool `jsonapi:"attr,is-built-in"`
CanQuote *bool `jsonapi:"attr,can-quote"`
CanFederateFedi *bool `jsonapi:"attr,can-federate-fedi"`
DisallowInteractionsWith []string `jsonapi:"attr,disallow-interactions-with"`
WithholdNotesRegexes []string `jsonapi:"attr,withhold-notes-regexes"`
FullAdmin *bool `jsonapi:"attr,full-admin"`
CanViewDeletedNotes *bool `jsonapi:"attr,can-view-deleted-notes"`
CanSendCustomReactions *bool `jsonapi:"attr,can-send-custom-reactions"`
CanSendFollowerOnlyNotes *bool `jsonapi:"attr,can-send-follower-only-notes"`
CanLogin *bool `jsonapi:"attr,can-login"`
AutoCwPostsText *string `jsonapi:"attr,auto-cw-posts-text"`
WithholdNotesForManualApproval *bool `jsonapi:"attr,withhold-notes-for-manual-approval"`
CanDeleteNotes *bool `jsonapi:"attr,can-delete-notes"`
CanSendLocalNotes *bool `jsonapi:"attr,can-send-local-notes"`
CanIncludeLinks *bool `jsonapi:"attr,can-include-links"` CanIncludeLinks *bool `jsonapi:"attr,can-include-links"`
AutoCwPosts *bool `jsonapi:"attr,auto-cw-posts"`
WithholdNotesBasedOnRegex *bool `jsonapi:"attr,withhold-notes-based-on-regex"`
CanAffectOtherAdmins *bool `jsonapi:"attr,can-affect-other-admins"`
CanAssignRoles *bool `jsonapi:"attr,can-assign-roles"`
CanSendMedia *bool `jsonapi:"attr,can-send-media"`
BlockedUsers []string `jsonapi:"attr,blocked-users"`
AutoNsfwMedia *bool `jsonapi:"attr,auto-nsfw-media"`
CanConfirmWithheldNotes *bool `jsonapi:"attr,can-confirm-withheld-notes"`
CanOverwriteDisplayNames *bool `jsonapi:"attr,can-overwrite-display-names"`
CanManageAds *bool `jsonapi:"attr,can-manage-ads"`
CanIncludeSurvey *bool `jsonapi:"attr,can-include-survey"` CanIncludeSurvey *bool `jsonapi:"attr,can-include-survey"`
CanSubmitReports *bool `jsonapi:"attr,can-submit-reports"` CanLogin *bool `jsonapi:"attr,can-login"`
ScanCreatedFollowerOnlyNotes *bool `jsonapi:"attr,scan-created-follower-only-notes"` CanSupressInteractionsBetweenUsers *bool `jsonapi:"attr,can-supress-interactions-between-users"`
CanManageCustomEmotes *bool `jsonapi:"attr,can-manage-custom-emotes"` CanManageCustomEmotes *bool `jsonapi:"attr,can-manage-custom-emotes"`
CanManageAvatarDecorations *bool `jsonapi:"attr,can-manage-avatar-decorations"`
CanSendAnnouncements *bool `jsonapi:"attr,can-send-announcements"` CanSendAnnouncements *bool `jsonapi:"attr,can-send-announcements"`
CanBoost *bool `jsonapi:"attr,can-boost"` CanSendReplies *bool `jsonapi:"attr,can-send-replies"`
ScanCreatedPublicNotes *bool `jsonapi:"attr,scan-created-public-notes"` CanRecoverDeletedNotes *bool `jsonapi:"attr,can-recover-deleted-notes"`
CanMentionOthers *bool `jsonapi:"attr,can-mention-others"`
CanSendFollowerOnlyNotes *bool `jsonapi:"attr,can-send-follower-only-notes"`
CanSendPrivateNotes *bool `jsonapi:"attr,can-send-private-notes"`
HasMentionCountLimit *bool `jsonapi:"attr,has-mention-count-limit"` HasMentionCountLimit *bool `jsonapi:"attr,has-mention-count-limit"`
MentionLimit *uint32 `jsonapi:"attr,mention-limit"` MentionLimit *uint32 `jsonapi:"attr,mention-limit"`
CanSendCustomEmotes *bool `jsonapi:"attr,can-send-custom-emotes"` ScanCreatedFollowerOnlyNotes *bool `jsonapi:"attr,scan-created-follower-only-notes"`
CanChangeDisplayName *bool `jsonapi:"attr,can-change-display-name"` FullAdmin *bool `jsonapi:"attr,full-admin"`
ScanCreatedLocalNotes *bool `jsonapi:"attr,scan-created-local-notes"`
CanSupressInteractionsBetweenUsers *bool `jsonapi:"attr,can-supress-interactions-between-users"`
CanSendReplies *bool `jsonapi:"attr,can-send-replies"`
CanFederateBsky *bool `jsonapi:"attr,can-federate-bsky"`
CanMentionOthers *bool `jsonapi:"attr,can-mention-others"`
ScanCreatedPrivateNotes *bool `jsonapi:"attr,scan-created-private-notes"`
CanRecoverDeletedNotes *bool `jsonapi:"attr,can-recover-deleted-notes"`
CanSendPublicNotes *bool `jsonapi:"attr,can-send-public-notes"` CanSendPublicNotes *bool `jsonapi:"attr,can-send-public-notes"`
CanSendPrivateNotes *bool `jsonapi:"attr,can-send-private-notes"` CanFederateBsky *bool `jsonapi:"attr,can-federate-bsky"`
CanSubmitReports *bool `jsonapi:"attr,can-submit-reports"`
AutoNsfwMedia *bool `jsonapi:"attr,auto-nsfw-media"`
AutoCwPostsText *string `jsonapi:"attr,auto-cw-posts-text"`
WithholdNotesForManualApproval *bool `jsonapi:"attr,withhold-notes-for-manual-approval"`
CanManageAds *bool `jsonapi:"attr,can-manage-ads"`
CanFederateFedi *bool `jsonapi:"attr,can-federate-fedi"`
CanChangeDisplayName *bool `jsonapi:"attr,can-change-display-name"`
ScanCreatedPublicNotes *bool `jsonapi:"attr,scan-created-public-notes"`
ScanCreatedPrivateNotes *bool `jsonapi:"attr,scan-created-private-notes"`
CanAssignRoles *bool `jsonapi:"attr,can-assign-roles"`
CanSendCustomReactions *bool `jsonapi:"attr,can-send-custom-reactions"`
BlockedUsers []string `jsonapi:"attr,blocked-users"`
DisallowInteractionsWith []string `jsonapi:"attr,disallow-interactions-with"`
CanDeleteNotes *bool `jsonapi:"attr,can-delete-notes"`
CanViewDeletedNotes *bool `jsonapi:"attr,can-view-deleted-notes"`
CanManageAvatarDecorations *bool `jsonapi:"attr,can-manage-avatar-decorations"`
CanSendMedia *bool `jsonapi:"attr,can-send-media"`
CanSendLocalNotes *bool `jsonapi:"attr,can-send-local-notes"`
CanBoost *bool `jsonapi:"attr,can-boost"`
AutoCwPosts *bool `jsonapi:"attr,auto-cw-posts"`
ScanCreatedLocalNotes *bool `jsonapi:"attr,scan-created-local-notes"`
WithholdNotesRegexes []string `jsonapi:"attr,withhold-notes-regexes"`
CanSendCustomEmotes *bool `jsonapi:"attr,can-send-custom-emotes"`
WithholdNotesBasedOnRegex *bool `jsonapi:"attr,withhold-notes-based-on-regex"`
CanAffectOtherAdmins *bool `jsonapi:"attr,can-affect-other-admins"`
CanConfirmWithheldNotes *bool `jsonapi:"attr,can-confirm-withheld-notes"`
CanOverwriteDisplayNames *bool `jsonapi:"attr,can-overwrite-display-names"`
CanQuote *bool `jsonapi:"attr,can-quote"`
} }

View file

@ -7,6 +7,12 @@ import (
"gorm.io/gorm" "gorm.io/gorm"
) )
// Could I collapse all these go:generate command into more condensed ones?
// Yes
// Will I do that?
// No
// This is explicit in what is being done. And easier to understand
//go:generate go build -o RolesGenerator ../cmd/RolesGenerator/main.go //go:generate go build -o RolesGenerator ../cmd/RolesGenerator/main.go
//go:generate ./RolesGenerator -input=roles.go -output=rolesUtil_generated.go //go:generate ./RolesGenerator -input=roles.go -output=rolesUtil_generated.go
//go:generate rm RolesGenerator //go:generate rm RolesGenerator
@ -21,6 +27,7 @@ import (
//go:generate go build -o FrontendGenerator ../cmd/RolesFrontendGenerator/main.go //go:generate go build -o FrontendGenerator ../cmd/RolesFrontendGenerator/main.go
//go:generate ./FrontendGenerator -input=roles.go -output=../frontend-reactive/app/models/role.ts //go:generate ./FrontendGenerator -input=roles.go -output=../frontend-reactive/app/models/role.ts
//go:generate rm FrontendGenerator
// A role is, in concept, similar to how Discord handles roles // A role is, in concept, similar to how Discord handles roles
// Some permission can be either disallowed (&false), don't care (nil) or allowed (&true) // Some permission can be either disallowed (&false), don't care (nil) or allowed (&true)

File diff suppressed because one or more lines are too long