From 2a99d314bd3fadd3b557567a6a086a86d69bb275 Mon Sep 17 00:00:00 2001 From: Daniel Hawton Date: Sun, 11 Feb 2024 13:59:33 -0700 Subject: [PATCH] updates --- facilities/zdv.yaml | 3 - facilities/zfw.yaml | 249 +++++++++ go.mod | 27 +- go.sum | 63 +++ .../adh-partnership/api/pkg/config/config.go | 3 +- .../api/pkg/config/configtypes.go | 3 +- .../api/pkg/database/certifications.go | 66 +++ .../api/pkg/database/dto/staffing.go | 6 +- .../api/pkg/database/dto/user.go | 231 ++++----- .../api/pkg/database/models.go | 20 +- .../api/pkg/database/models/apikeys.go | 10 +- .../api/pkg/database/models/certification.go | 49 ++ .../api/pkg/database/models/user.go | 26 +- .../bwmarrin/discordgo/components.go | 44 +- .../bwmarrin/discordgo/endpoints.go | 6 + .../bwmarrin/discordgo/interactions.go | 1 + .../github.com/bwmarrin/discordgo/restapi.go | 74 ++- .../github.com/bwmarrin/discordgo/structs.go | 151 ++++++ vendor/github.com/bwmarrin/discordgo/user.go | 16 +- .../github.com/bwmarrin/discordgo/webhook.go | 5 + .../cpuguy83/go-md2man/v2/md2man/md2man.go | 6 +- .../cpuguy83/go-md2man/v2/md2man/roff.go | 30 +- vendor/github.com/go-co-op/gocron/README.md | 9 + vendor/github.com/go-co-op/gocron/executor.go | 37 +- vendor/github.com/go-co-op/gocron/gocron.go | 8 +- vendor/github.com/go-co-op/gocron/job.go | 22 + vendor/github.com/go-co-op/gocron/locker.go | 7 + .../github.com/go-co-op/gocron/scheduler.go | 195 +++++--- vendor/github.com/google/uuid/CHANGELOG.md | 18 + vendor/github.com/google/uuid/CONTRIBUTING.md | 2 +- vendor/github.com/google/uuid/time.go | 21 +- vendor/github.com/google/uuid/uuid.go | 79 ++- vendor/github.com/google/uuid/version6.go | 56 +++ vendor/github.com/google/uuid/version7.go | 75 +++ .../gorilla/websocket/.editorconfig | 20 + .../github.com/gorilla/websocket/.gitignore | 26 +- .../gorilla/websocket/.golangci.yml | 3 + vendor/github.com/gorilla/websocket/AUTHORS | 9 - vendor/github.com/gorilla/websocket/LICENSE | 39 +- vendor/github.com/gorilla/websocket/Makefile | 34 ++ vendor/github.com/gorilla/websocket/README.md | 19 +- vendor/github.com/gorilla/websocket/client.go | 44 +- .../gorilla/websocket/compression.go | 9 +- vendor/github.com/gorilla/websocket/conn.go | 83 ++- vendor/github.com/gorilla/websocket/mask.go | 4 + vendor/github.com/gorilla/websocket/proxy.go | 17 +- vendor/github.com/gorilla/websocket/server.go | 42 +- .../gorilla/websocket/tls_handshake.go | 3 - .../gorilla/websocket/tls_handshake_116.go | 21 - vendor/github.com/gorilla/websocket/util.go | 19 +- .../gorilla/websocket/x_net_proxy.go | 473 ------------------ vendor/github.com/urfave/cli/v2/.gitignore | 1 + .../github.com/urfave/cli/v2/.golangci.yaml | 4 + vendor/github.com/urfave/cli/v2/app.go | 36 +- vendor/github.com/urfave/cli/v2/category.go | 2 +- vendor/github.com/urfave/cli/v2/command.go | 18 + vendor/github.com/urfave/cli/v2/context.go | 2 +- vendor/github.com/urfave/cli/v2/flag_bool.go | 6 +- .../github.com/urfave/cli/v2/flag_duration.go | 6 +- .../github.com/urfave/cli/v2/flag_float64.go | 8 +- .../github.com/urfave/cli/v2/flag_generic.go | 11 +- vendor/github.com/urfave/cli/v2/flag_int.go | 6 +- vendor/github.com/urfave/cli/v2/flag_int64.go | 6 +- vendor/github.com/urfave/cli/v2/flag_path.go | 11 +- .../github.com/urfave/cli/v2/flag_string.go | 12 +- .../urfave/cli/v2/flag_timestamp.go | 10 +- vendor/github.com/urfave/cli/v2/flag_uint.go | 6 +- .../github.com/urfave/cli/v2/flag_uint64.go | 6 +- .../urfave/cli/v2/flag_uint64_slice.go | 9 + .../urfave/cli/v2/flag_uint_slice.go | 9 + .../urfave/cli/v2/godoc-current.txt | 20 +- vendor/github.com/urfave/cli/v2/help.go | 56 +-- ...kdocs-requirements.txt => mkdocs-reqs.txt} | 0 vendor/github.com/urfave/cli/v2/mkdocs.yml | 2 +- .../github.com/urfave/cli/v2/suggestions.go | 10 +- vendor/github.com/urfave/cli/v2/template.go | 6 +- .../urfave/cli/v2/zz_generated.flags.go | 51 +- vendor/github.com/xrash/smetrics/soundex.go | 58 ++- .../x/crypto/internal/alias/alias.go | 1 - .../x/crypto/internal/alias/alias_purego.go | 1 - .../x/crypto/internal/poly1305/bits_compat.go | 1 - .../x/crypto/internal/poly1305/bits_go1.13.go | 1 - .../x/crypto/internal/poly1305/mac_noasm.go | 1 - .../x/crypto/internal/poly1305/sum_amd64.go | 1 - .../x/crypto/internal/poly1305/sum_amd64.s | 1 - .../x/crypto/internal/poly1305/sum_ppc64le.go | 1 - .../x/crypto/internal/poly1305/sum_ppc64le.s | 1 - .../x/crypto/internal/poly1305/sum_s390x.go | 1 - .../x/crypto/internal/poly1305/sum_s390x.s | 1 - .../x/crypto/salsa20/salsa/salsa20_amd64.go | 1 - .../x/crypto/salsa20/salsa/salsa20_amd64.s | 1 - .../x/crypto/salsa20/salsa/salsa20_noasm.go | 1 - vendor/golang.org/x/net/LICENSE | 27 + vendor/golang.org/x/net/PATENTS | 22 + .../golang.org/x/net/internal/socks/client.go | 168 +++++++ .../golang.org/x/net/internal/socks/socks.go | 317 ++++++++++++ vendor/golang.org/x/net/proxy/dial.go | 54 ++ vendor/golang.org/x/net/proxy/direct.go | 31 ++ vendor/golang.org/x/net/proxy/per_host.go | 155 ++++++ vendor/golang.org/x/net/proxy/proxy.go | 149 ++++++ vendor/golang.org/x/net/proxy/socks5.go | 42 ++ vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 1 - vendor/golang.org/x/sys/cpu/cpu_aix.go | 1 - vendor/golang.org/x/sys/cpu/cpu_arm64.s | 1 - vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 1 - vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 1 - vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 2 - .../golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 1 - .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 1 - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 2 - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 2 - vendor/golang.org/x/sys/cpu/cpu_linux.go | 1 - .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 2 - .../golang.org/x/sys/cpu/cpu_linux_noinit.go | 1 - .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 2 - vendor/golang.org/x/sys/cpu/cpu_loong64.go | 1 - vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 1 - vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 1 - vendor/golang.org/x/sys/cpu/cpu_other_arm.go | 1 - .../golang.org/x/sys/cpu/cpu_other_arm64.go | 1 - .../golang.org/x/sys/cpu/cpu_other_mips64x.go | 2 - .../golang.org/x/sys/cpu/cpu_other_ppc64x.go | 3 - .../golang.org/x/sys/cpu/cpu_other_riscv64.go | 1 - vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 1 - vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 3 +- vendor/golang.org/x/sys/cpu/cpu_s390x.s | 1 - vendor/golang.org/x/sys/cpu/cpu_wasm.go | 1 - vendor/golang.org/x/sys/cpu/cpu_x86.go | 1 - vendor/golang.org/x/sys/cpu/cpu_x86.s | 2 - vendor/golang.org/x/sys/cpu/endian_big.go | 1 - vendor/golang.org/x/sys/cpu/endian_little.go | 1 - vendor/golang.org/x/sys/cpu/hwcap_linux.go | 4 +- .../x/sys/cpu/proc_cpuinfo_linux.go | 1 - .../x/sys/cpu/runtime_auxv_go121.go | 1 - .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 1 - .../x/sys/cpu/syscall_aix_ppc64_gc.go | 1 - .../sys/internal/unsafeheader/unsafeheader.go | 30 -- vendor/golang.org/x/sys/unix/aliases.go | 2 - vendor/golang.org/x/sys/unix/asm_aix_ppc64.s | 1 - vendor/golang.org/x/sys/unix/asm_bsd_386.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_amd64.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_arm.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_arm64.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s | 2 - .../golang.org/x/sys/unix/asm_bsd_riscv64.s | 2 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 1 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 1 - vendor/golang.org/x/sys/unix/asm_linux_arm.s | 1 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 3 - .../golang.org/x/sys/unix/asm_linux_loong64.s | 3 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 3 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 3 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 3 - .../golang.org/x/sys/unix/asm_linux_riscv64.s | 2 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 3 - .../x/sys/unix/asm_openbsd_mips64.s | 1 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 1 - vendor/golang.org/x/sys/unix/asm_zos_s390x.s | 3 - vendor/golang.org/x/sys/unix/cap_freebsd.go | 1 - vendor/golang.org/x/sys/unix/constants.go | 1 - vendor/golang.org/x/sys/unix/dev_aix_ppc.go | 1 - vendor/golang.org/x/sys/unix/dev_aix_ppc64.go | 1 - vendor/golang.org/x/sys/unix/dev_zos.go | 1 - vendor/golang.org/x/sys/unix/dirent.go | 1 - vendor/golang.org/x/sys/unix/endian_big.go | 1 - vendor/golang.org/x/sys/unix/endian_little.go | 1 - vendor/golang.org/x/sys/unix/env_unix.go | 1 - vendor/golang.org/x/sys/unix/epoll_zos.go | 1 - vendor/golang.org/x/sys/unix/fcntl.go | 3 +- .../x/sys/unix/fcntl_linux_32bit.go | 1 - vendor/golang.org/x/sys/unix/fdset.go | 1 - vendor/golang.org/x/sys/unix/fstatfs_zos.go | 1 - vendor/golang.org/x/sys/unix/gccgo.go | 1 - vendor/golang.org/x/sys/unix/gccgo_c.c | 1 - .../x/sys/unix/gccgo_linux_amd64.go | 1 - vendor/golang.org/x/sys/unix/ifreq_linux.go | 1 - vendor/golang.org/x/sys/unix/ioctl_linux.go | 5 + vendor/golang.org/x/sys/unix/ioctl_signed.go | 1 - .../golang.org/x/sys/unix/ioctl_unsigned.go | 1 - vendor/golang.org/x/sys/unix/ioctl_zos.go | 1 - vendor/golang.org/x/sys/unix/mkerrors.sh | 41 +- vendor/golang.org/x/sys/unix/mmap_nomremap.go | 1 - vendor/golang.org/x/sys/unix/mremap.go | 1 - vendor/golang.org/x/sys/unix/pagesize_unix.go | 1 - .../golang.org/x/sys/unix/pledge_openbsd.go | 92 +--- vendor/golang.org/x/sys/unix/ptrace_darwin.go | 7 - vendor/golang.org/x/sys/unix/ptrace_ios.go | 7 - vendor/golang.org/x/sys/unix/race.go | 1 - vendor/golang.org/x/sys/unix/race0.go | 1 - .../x/sys/unix/readdirent_getdents.go | 1 - .../x/sys/unix/readdirent_getdirentries.go | 1 - vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 1 - .../x/sys/unix/sockcmsg_unix_other.go | 1 - vendor/golang.org/x/sys/unix/syscall.go | 1 - vendor/golang.org/x/sys/unix/syscall_aix.go | 6 +- .../golang.org/x/sys/unix/syscall_aix_ppc.go | 1 - .../x/sys/unix/syscall_aix_ppc64.go | 1 - vendor/golang.org/x/sys/unix/syscall_bsd.go | 3 +- .../golang.org/x/sys/unix/syscall_darwin.go | 186 ------- .../x/sys/unix/syscall_darwin_amd64.go | 2 - .../x/sys/unix/syscall_darwin_arm64.go | 2 - .../x/sys/unix/syscall_darwin_libSystem.go | 1 - .../x/sys/unix/syscall_dragonfly.go | 198 -------- .../x/sys/unix/syscall_dragonfly_amd64.go | 1 - .../golang.org/x/sys/unix/syscall_freebsd.go | 192 ------- .../x/sys/unix/syscall_freebsd_386.go | 1 - .../x/sys/unix/syscall_freebsd_amd64.go | 1 - .../x/sys/unix/syscall_freebsd_arm.go | 1 - .../x/sys/unix/syscall_freebsd_arm64.go | 1 - .../x/sys/unix/syscall_freebsd_riscv64.go | 1 - vendor/golang.org/x/sys/unix/syscall_hurd.go | 1 - .../golang.org/x/sys/unix/syscall_hurd_386.go | 1 - .../golang.org/x/sys/unix/syscall_illumos.go | 1 - vendor/golang.org/x/sys/unix/syscall_linux.go | 146 +----- .../x/sys/unix/syscall_linux_386.go | 1 - .../x/sys/unix/syscall_linux_alarm.go | 2 - .../x/sys/unix/syscall_linux_amd64.go | 1 - .../x/sys/unix/syscall_linux_amd64_gc.go | 1 - .../x/sys/unix/syscall_linux_arm.go | 1 - .../x/sys/unix/syscall_linux_arm64.go | 1 - .../golang.org/x/sys/unix/syscall_linux_gc.go | 1 - .../x/sys/unix/syscall_linux_gc_386.go | 1 - .../x/sys/unix/syscall_linux_gc_arm.go | 1 - .../x/sys/unix/syscall_linux_gccgo_386.go | 1 - .../x/sys/unix/syscall_linux_gccgo_arm.go | 1 - .../x/sys/unix/syscall_linux_loong64.go | 1 - .../x/sys/unix/syscall_linux_mips64x.go | 2 - .../x/sys/unix/syscall_linux_mipsx.go | 2 - .../x/sys/unix/syscall_linux_ppc.go | 1 - .../x/sys/unix/syscall_linux_ppc64x.go | 2 - .../x/sys/unix/syscall_linux_riscv64.go | 1 - .../x/sys/unix/syscall_linux_s390x.go | 1 - .../x/sys/unix/syscall_linux_sparc64.go | 1 - .../golang.org/x/sys/unix/syscall_netbsd.go | 261 ---------- .../x/sys/unix/syscall_netbsd_386.go | 1 - .../x/sys/unix/syscall_netbsd_amd64.go | 1 - .../x/sys/unix/syscall_netbsd_arm.go | 1 - .../x/sys/unix/syscall_netbsd_arm64.go | 1 - .../golang.org/x/sys/unix/syscall_openbsd.go | 102 +--- .../x/sys/unix/syscall_openbsd_386.go | 1 - .../x/sys/unix/syscall_openbsd_amd64.go | 1 - .../x/sys/unix/syscall_openbsd_arm.go | 1 - .../x/sys/unix/syscall_openbsd_arm64.go | 1 - .../x/sys/unix/syscall_openbsd_libc.go | 1 - .../x/sys/unix/syscall_openbsd_ppc64.go | 1 - .../x/sys/unix/syscall_openbsd_riscv64.go | 1 - .../golang.org/x/sys/unix/syscall_solaris.go | 23 +- .../x/sys/unix/syscall_solaris_amd64.go | 1 - vendor/golang.org/x/sys/unix/syscall_unix.go | 1 - .../golang.org/x/sys/unix/syscall_unix_gc.go | 2 - .../x/sys/unix/syscall_unix_gc_ppc64x.go | 3 - .../x/sys/unix/syscall_zos_s390x.go | 4 +- vendor/golang.org/x/sys/unix/sysvshm_linux.go | 1 - vendor/golang.org/x/sys/unix/sysvshm_unix.go | 1 - .../x/sys/unix/sysvshm_unix_other.go | 1 - vendor/golang.org/x/sys/unix/timestruct.go | 1 - .../golang.org/x/sys/unix/unveil_openbsd.go | 41 +- vendor/golang.org/x/sys/unix/xattr_bsd.go | 1 - .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1 - .../x/sys/unix/zerrors_aix_ppc64.go | 1 - .../x/sys/unix/zerrors_darwin_amd64.go | 1 - .../x/sys/unix/zerrors_darwin_arm64.go | 1 - .../x/sys/unix/zerrors_dragonfly_amd64.go | 1 - .../x/sys/unix/zerrors_freebsd_386.go | 1 - .../x/sys/unix/zerrors_freebsd_amd64.go | 1 - .../x/sys/unix/zerrors_freebsd_arm.go | 1 - .../x/sys/unix/zerrors_freebsd_arm64.go | 1 - .../x/sys/unix/zerrors_freebsd_riscv64.go | 1 - vendor/golang.org/x/sys/unix/zerrors_linux.go | 77 ++- .../x/sys/unix/zerrors_linux_386.go | 3 +- .../x/sys/unix/zerrors_linux_amd64.go | 3 +- .../x/sys/unix/zerrors_linux_arm.go | 3 +- .../x/sys/unix/zerrors_linux_arm64.go | 3 +- .../x/sys/unix/zerrors_linux_loong64.go | 6 +- .../x/sys/unix/zerrors_linux_mips.go | 3 +- .../x/sys/unix/zerrors_linux_mips64.go | 3 +- .../x/sys/unix/zerrors_linux_mips64le.go | 3 +- .../x/sys/unix/zerrors_linux_mipsle.go | 3 +- .../x/sys/unix/zerrors_linux_ppc.go | 3 +- .../x/sys/unix/zerrors_linux_ppc64.go | 3 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 3 +- .../x/sys/unix/zerrors_linux_riscv64.go | 6 +- .../x/sys/unix/zerrors_linux_s390x.go | 3 +- .../x/sys/unix/zerrors_linux_sparc64.go | 3 +- .../x/sys/unix/zerrors_netbsd_386.go | 1 - .../x/sys/unix/zerrors_netbsd_amd64.go | 1 - .../x/sys/unix/zerrors_netbsd_arm.go | 1 - .../x/sys/unix/zerrors_netbsd_arm64.go | 1 - .../x/sys/unix/zerrors_openbsd_386.go | 1 - .../x/sys/unix/zerrors_openbsd_amd64.go | 1 - .../x/sys/unix/zerrors_openbsd_arm.go | 1 - .../x/sys/unix/zerrors_openbsd_arm64.go | 1 - .../x/sys/unix/zerrors_openbsd_mips64.go | 1 - .../x/sys/unix/zerrors_openbsd_ppc64.go | 1 - .../x/sys/unix/zerrors_openbsd_riscv64.go | 1 - .../x/sys/unix/zerrors_solaris_amd64.go | 1 - .../x/sys/unix/zerrors_zos_s390x.go | 1 - .../x/sys/unix/zptrace_armnn_linux.go | 2 - .../x/sys/unix/zptrace_mipsnn_linux.go | 2 - .../x/sys/unix/zptrace_mipsnnle_linux.go | 2 - .../x/sys/unix/zptrace_x86_linux.go | 2 - .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 23 - .../x/sys/unix/zsyscall_aix_ppc64.go | 23 - .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 1 - .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 1 - .../x/sys/unix/zsyscall_darwin_amd64.go | 41 +- .../x/sys/unix/zsyscall_darwin_amd64.s | 149 ------ .../x/sys/unix/zsyscall_darwin_arm64.go | 41 +- .../x/sys/unix/zsyscall_darwin_arm64.s | 149 ------ .../x/sys/unix/zsyscall_dragonfly_amd64.go | 23 - .../x/sys/unix/zsyscall_freebsd_386.go | 23 - .../x/sys/unix/zsyscall_freebsd_amd64.go | 23 - .../x/sys/unix/zsyscall_freebsd_arm.go | 23 - .../x/sys/unix/zsyscall_freebsd_arm64.go | 23 - .../x/sys/unix/zsyscall_freebsd_riscv64.go | 23 - .../x/sys/unix/zsyscall_illumos_amd64.go | 11 +- .../golang.org/x/sys/unix/zsyscall_linux.go | 48 +- .../x/sys/unix/zsyscall_linux_386.go | 1 - .../x/sys/unix/zsyscall_linux_amd64.go | 1 - .../x/sys/unix/zsyscall_linux_arm.go | 1 - .../x/sys/unix/zsyscall_linux_arm64.go | 1 - .../x/sys/unix/zsyscall_linux_loong64.go | 1 - .../x/sys/unix/zsyscall_linux_mips.go | 1 - .../x/sys/unix/zsyscall_linux_mips64.go | 1 - .../x/sys/unix/zsyscall_linux_mips64le.go | 1 - .../x/sys/unix/zsyscall_linux_mipsle.go | 1 - .../x/sys/unix/zsyscall_linux_ppc.go | 1 - .../x/sys/unix/zsyscall_linux_ppc64.go | 1 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 1 - .../x/sys/unix/zsyscall_linux_riscv64.go | 1 - .../x/sys/unix/zsyscall_linux_s390x.go | 1 - .../x/sys/unix/zsyscall_linux_sparc64.go | 1 - .../x/sys/unix/zsyscall_netbsd_386.go | 23 - .../x/sys/unix/zsyscall_netbsd_amd64.go | 23 - .../x/sys/unix/zsyscall_netbsd_arm.go | 23 - .../x/sys/unix/zsyscall_netbsd_arm64.go | 23 - .../x/sys/unix/zsyscall_openbsd_386.go | 80 ++- .../x/sys/unix/zsyscall_openbsd_386.s | 20 + .../x/sys/unix/zsyscall_openbsd_amd64.go | 70 ++- .../x/sys/unix/zsyscall_openbsd_amd64.s | 20 + .../x/sys/unix/zsyscall_openbsd_arm.go | 80 ++- .../x/sys/unix/zsyscall_openbsd_arm.s | 20 + .../x/sys/unix/zsyscall_openbsd_arm64.go | 80 ++- .../x/sys/unix/zsyscall_openbsd_arm64.s | 20 + .../x/sys/unix/zsyscall_openbsd_mips64.go | 80 ++- .../x/sys/unix/zsyscall_openbsd_mips64.s | 20 + .../x/sys/unix/zsyscall_openbsd_ppc64.go | 80 ++- .../x/sys/unix/zsyscall_openbsd_ppc64.s | 24 + .../x/sys/unix/zsyscall_openbsd_riscv64.go | 80 ++- .../x/sys/unix/zsyscall_openbsd_riscv64.s | 20 + .../x/sys/unix/zsyscall_solaris_amd64.go | 257 +++++----- .../x/sys/unix/zsyscall_zos_s390x.go | 12 - .../x/sys/unix/zsysctl_openbsd_386.go | 1 - .../x/sys/unix/zsysctl_openbsd_amd64.go | 1 - .../x/sys/unix/zsysctl_openbsd_arm.go | 1 - .../x/sys/unix/zsysctl_openbsd_arm64.go | 1 - .../x/sys/unix/zsysctl_openbsd_mips64.go | 1 - .../x/sys/unix/zsysctl_openbsd_ppc64.go | 1 - .../x/sys/unix/zsysctl_openbsd_riscv64.go | 1 - .../x/sys/unix/zsysnum_darwin_amd64.go | 1 - .../x/sys/unix/zsysnum_darwin_arm64.go | 1 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 1 - .../x/sys/unix/zsysnum_freebsd_386.go | 1 - .../x/sys/unix/zsysnum_freebsd_amd64.go | 1 - .../x/sys/unix/zsysnum_freebsd_arm.go | 1 - .../x/sys/unix/zsysnum_freebsd_arm64.go | 1 - .../x/sys/unix/zsysnum_freebsd_riscv64.go | 1 - .../x/sys/unix/zsysnum_linux_386.go | 3 +- .../x/sys/unix/zsysnum_linux_amd64.go | 4 +- .../x/sys/unix/zsysnum_linux_arm.go | 3 +- .../x/sys/unix/zsysnum_linux_arm64.go | 3 +- .../x/sys/unix/zsysnum_linux_loong64.go | 3 +- .../x/sys/unix/zsysnum_linux_mips.go | 3 +- .../x/sys/unix/zsysnum_linux_mips64.go | 3 +- .../x/sys/unix/zsysnum_linux_mips64le.go | 3 +- .../x/sys/unix/zsysnum_linux_mipsle.go | 3 +- .../x/sys/unix/zsysnum_linux_ppc.go | 3 +- .../x/sys/unix/zsysnum_linux_ppc64.go | 3 +- .../x/sys/unix/zsysnum_linux_ppc64le.go | 3 +- .../x/sys/unix/zsysnum_linux_riscv64.go | 3 +- .../x/sys/unix/zsysnum_linux_s390x.go | 3 +- .../x/sys/unix/zsysnum_linux_sparc64.go | 3 +- .../x/sys/unix/zsysnum_netbsd_386.go | 1 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 1 - .../x/sys/unix/zsysnum_netbsd_arm.go | 1 - .../x/sys/unix/zsysnum_netbsd_arm64.go | 1 - .../x/sys/unix/zsysnum_openbsd_386.go | 1 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 1 - .../x/sys/unix/zsysnum_openbsd_arm.go | 1 - .../x/sys/unix/zsysnum_openbsd_arm64.go | 1 - .../x/sys/unix/zsysnum_openbsd_mips64.go | 1 - .../x/sys/unix/zsysnum_openbsd_ppc64.go | 1 - .../x/sys/unix/zsysnum_openbsd_riscv64.go | 1 - .../x/sys/unix/zsysnum_zos_s390x.go | 1 - .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 1 - .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 1 - .../x/sys/unix/ztypes_darwin_amd64.go | 1 - .../x/sys/unix/ztypes_darwin_arm64.go | 1 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 1 - .../x/sys/unix/ztypes_freebsd_386.go | 1 - .../x/sys/unix/ztypes_freebsd_amd64.go | 1 - .../x/sys/unix/ztypes_freebsd_arm.go | 1 - .../x/sys/unix/ztypes_freebsd_arm64.go | 1 - .../x/sys/unix/ztypes_freebsd_riscv64.go | 1 - vendor/golang.org/x/sys/unix/ztypes_linux.go | 53 +- .../golang.org/x/sys/unix/ztypes_linux_386.go | 1 - .../x/sys/unix/ztypes_linux_amd64.go | 1 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 1 - .../x/sys/unix/ztypes_linux_arm64.go | 1 - .../x/sys/unix/ztypes_linux_loong64.go | 1 - .../x/sys/unix/ztypes_linux_mips.go | 1 - .../x/sys/unix/ztypes_linux_mips64.go | 1 - .../x/sys/unix/ztypes_linux_mips64le.go | 1 - .../x/sys/unix/ztypes_linux_mipsle.go | 1 - .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 1 - .../x/sys/unix/ztypes_linux_ppc64.go | 1 - .../x/sys/unix/ztypes_linux_ppc64le.go | 1 - .../x/sys/unix/ztypes_linux_riscv64.go | 5 +- .../x/sys/unix/ztypes_linux_s390x.go | 1 - .../x/sys/unix/ztypes_linux_sparc64.go | 1 - .../x/sys/unix/ztypes_netbsd_386.go | 1 - .../x/sys/unix/ztypes_netbsd_amd64.go | 1 - .../x/sys/unix/ztypes_netbsd_arm.go | 1 - .../x/sys/unix/ztypes_netbsd_arm64.go | 1 - .../x/sys/unix/ztypes_openbsd_386.go | 1 - .../x/sys/unix/ztypes_openbsd_amd64.go | 1 - .../x/sys/unix/ztypes_openbsd_arm.go | 1 - .../x/sys/unix/ztypes_openbsd_arm64.go | 1 - .../x/sys/unix/ztypes_openbsd_mips64.go | 1 - .../x/sys/unix/ztypes_openbsd_ppc64.go | 1 - .../x/sys/unix/ztypes_openbsd_riscv64.go | 1 - .../x/sys/unix/ztypes_solaris_amd64.go | 1 - .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 1 - vendor/golang.org/x/sys/windows/aliases.go | 1 - vendor/golang.org/x/sys/windows/empty.s | 1 - vendor/golang.org/x/sys/windows/eventlog.go | 1 - .../golang.org/x/sys/windows/exec_windows.go | 89 +++- vendor/golang.org/x/sys/windows/mksyscall.go | 1 - vendor/golang.org/x/sys/windows/race.go | 1 - vendor/golang.org/x/sys/windows/race0.go | 1 - .../x/sys/windows/security_windows.go | 21 +- vendor/golang.org/x/sys/windows/service.go | 1 - vendor/golang.org/x/sys/windows/str.go | 1 - vendor/golang.org/x/sys/windows/syscall.go | 1 - .../x/sys/windows/syscall_windows.go | 49 +- .../golang.org/x/sys/windows/types_windows.go | 35 +- .../x/sys/windows/zsyscall_windows.go | 65 ++- vendor/gopkg.in/yaml.v2/.travis.yml | 17 - vendor/gorm.io/driver/mysql/README.md | 1 + .../gorm.io/driver/mysql/error_translator.go | 11 +- vendor/gorm.io/driver/mysql/migrator.go | 25 + vendor/gorm.io/gorm/clause/expression.go | 2 +- vendor/gorm.io/gorm/gorm.go | 2 +- vendor/gorm.io/gorm/migrator/migrator.go | 2 +- vendor/gorm.io/gorm/schema/schema.go | 63 ++- vendor/gorm.io/gorm/utils/utils.go | 29 +- vendor/modules.txt | 43 +- vendor/sigs.k8s.io/yaml/LICENSE | 256 ++++++++++ vendor/sigs.k8s.io/yaml/OWNERS | 8 +- vendor/sigs.k8s.io/yaml/fields.go | 55 +- .../yaml/goyaml.v2}/LICENSE | 0 .../yaml/goyaml.v2}/LICENSE.libyaml | 0 .../yaml/goyaml.v2}/NOTICE | 0 vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS | 24 + .../yaml/goyaml.v2}/README.md | 10 + .../yaml/goyaml.v2}/apic.go | 0 .../yaml/goyaml.v2}/decode.go | 0 .../yaml/goyaml.v2}/emitterc.go | 0 .../yaml/goyaml.v2}/encode.go | 0 .../yaml/goyaml.v2}/parserc.go | 0 .../yaml/goyaml.v2}/readerc.go | 0 .../yaml/goyaml.v2}/resolve.go | 0 .../yaml/goyaml.v2}/scannerc.go | 0 .../yaml/goyaml.v2}/sorter.go | 0 .../yaml/goyaml.v2}/writerc.go | 0 .../yaml/goyaml.v2}/yaml.go | 0 .../yaml/goyaml.v2}/yamlh.go | 0 .../yaml/goyaml.v2}/yamlprivateh.go | 0 vendor/sigs.k8s.io/yaml/yaml.go | 145 ++++-- vendor/sigs.k8s.io/yaml/yaml_go110.go | 17 + 480 files changed, 4663 insertions(+), 3702 deletions(-) create mode 100644 facilities/zfw.yaml create mode 100644 vendor/github.com/adh-partnership/api/pkg/database/certifications.go create mode 100644 vendor/github.com/adh-partnership/api/pkg/database/models/certification.go create mode 100644 vendor/github.com/google/uuid/version6.go create mode 100644 vendor/github.com/google/uuid/version7.go create mode 100644 vendor/github.com/gorilla/websocket/.editorconfig create mode 100644 vendor/github.com/gorilla/websocket/.golangci.yml delete mode 100644 vendor/github.com/gorilla/websocket/AUTHORS create mode 100644 vendor/github.com/gorilla/websocket/Makefile delete mode 100644 vendor/github.com/gorilla/websocket/tls_handshake_116.go delete mode 100644 vendor/github.com/gorilla/websocket/x_net_proxy.go create mode 100644 vendor/github.com/urfave/cli/v2/.golangci.yaml rename vendor/github.com/urfave/cli/v2/{mkdocs-requirements.txt => mkdocs-reqs.txt} (100%) create mode 100644 vendor/golang.org/x/net/LICENSE create mode 100644 vendor/golang.org/x/net/PATENTS create mode 100644 vendor/golang.org/x/net/internal/socks/client.go create mode 100644 vendor/golang.org/x/net/internal/socks/socks.go create mode 100644 vendor/golang.org/x/net/proxy/dial.go create mode 100644 vendor/golang.org/x/net/proxy/direct.go create mode 100644 vendor/golang.org/x/net/proxy/per_host.go create mode 100644 vendor/golang.org/x/net/proxy/proxy.go create mode 100644 vendor/golang.org/x/net/proxy/socks5.go delete mode 100644 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go delete mode 100644 vendor/gopkg.in/yaml.v2/.travis.yml rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/LICENSE (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/LICENSE.libyaml (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/NOTICE (100%) create mode 100644 vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/README.md (84%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/apic.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/decode.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/emitterc.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/encode.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/parserc.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/readerc.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/resolve.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/scannerc.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/sorter.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/writerc.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/yaml.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/yamlh.go (100%) rename vendor/{gopkg.in/yaml.v2 => sigs.k8s.io/yaml/goyaml.v2}/yamlprivateh.go (100%) diff --git a/facilities/zdv.yaml b/facilities/zdv.yaml index 4057106..51d0edd 100644 --- a/facilities/zdv.yaml +++ b/facilities/zdv.yaml @@ -118,9 +118,6 @@ roles: if: - condition: controller_type value: none - - id: 1149167444267630663 - name: unverified - if: - condition: unknown value: true - id: 712839474433884222 diff --git a/facilities/zfw.yaml b/facilities/zfw.yaml new file mode 100644 index 0000000..36f6b45 --- /dev/null +++ b/facilities/zfw.yaml @@ -0,0 +1,249 @@ +# Used for internal identification purposes +facility: ZFW +# The nickname the bot should set for itself in this guild +bot_name: ZFW Bot +description: Fort Worth ARTCC +# The Guild ID for the facility's discord +discord_id: 759176334776729658 +# What name format do we set for users in the guild? +# - first_cid (John 888888, John 888888 | ATM) +# - first_last (John Doe, John Doe | ATM) +# *NOTE* If this is set and staff_format is all, or the name is long, that user's last name will be truncated to last initial +# to fit within Discord's 32 character limit +# - first_last_initial (John D., John D. | ATM) +# - first_last_initial_oi (John D. - JD, John D. - JD | ATM) +# default: first_last +name_format: first_last_initial_oi +# At the end of the name we'll append the staff role(s) +# - highest: The highest staff role from ATM, DATM, TA, EC, FE, WM, INS, MTR, AEC, AFE, AWM +# - all: All staff roles from ATM, DATM, TA, EC, FE, WM, INS, MTR, AEC, AFE, AWM separated by the defined seperator +# - none: No staff roles +# default: highest +staff_format: highest +# Separator to use between the staff role(s) when staff_format is all +# Defaults to "/" when not defined +staff_title_separator: "/" +# Position table, used for the who's online embedded message +# that will be posted to the positions_channel +positions: + - name: Enroute + callsigns: + prefix: ["FTW"] + suffix: ["CTR"] + - name: D10 TRACON + callsigns: + prefix: ["REG"] + suffix: ["APP", "DEP"] + - name: OKC TRACON + callsigns: + prefix: ["OKC"] + suffix: ["APP", "DEP"] + - name: Other TRACON + callsigns: + prefix: + - SPS + - ABI + - SJT + - LBB + - MAF + - SHV + - GGG + - ACT + - LTS + - MLU + - FSI + - GRK + suffix: ["APP", "DEP"] + - name: DFW Cab + callsigns: + prefix: ["DFW"] + suffix: ["TWR", "GND", "DEL"] + - name: DAL Cab + callsigns: + prefix: ["DAL"] + suffix: ["TWR", "GND", "DEL"] + - name: OKC Cab + callsigns: + prefix: ["OKC"] + suffix: ["TWR", "GND", "DEL"] + - name: Other Cabs + callsigns: + prefix: + - ACT + - LBB + - ABM + - ADM + - ADS + - AFW + - BAD + - CNW + - CSM + - DTO + - DTN + - DYS + - FSI + - FTW + - FWS + - GGG + - GKY + - GPM + - GRK + - GVT + - GYI + - HLR + - HQZ + - HOB + - LAW + - LTS + - MAF + - MLU + - NFW + - OUN + - PWA + - RBD + - SHV + - SJT + - SPS + - TIK + - TKI + - TXK + - TYR + suffix: + - TWR + - GND + - DEL +# The ID number of the channel to post the who's online message to +# This channel should ideally be setup so only the bot posts to it +online_channel: 1180357341598728232 +# Message to use when no controllers are online +# Defaults to "There are currently no (Facility ID) controllers online." +no_controllers_online_message: | + No one is online currently. +# Role assignments +# Users who have a configured role but do not meet the conditions will have the role +# removed. +# Conditions are defined in the `if` block and are evaluated as a logical OR. +# Conditions: +# - has_role: Checks if the user has the specified role in the roster +# - controller_type: Check if the user is a `home` controller, `visitor` controller, or `none` +# - rating: Checks user rating (S1, S2, etc) +# - unknown: Checks if the account is linked on the roster +roles: + - id: 767785144299159602 # Role ID + name: Senior Staff # Role Name (primarily for logging) + if: # Conditions evaluated as a logical OR + - condition: has_role + value: ATM + - condition: has_role + value: DATM + - condition: has_role + value: TA + - id: 767820940875923496 + name: ARTCC Staff + if: + - condition: has_role + value: EC + - condition: has_role + value: FE + - condition: has_role + value: WM + - id: 767832523169857586 + name: Training Staff + if: + - condition: has_role + value: INS + - condition: has_role + value: MTR + - id: 1155986746476068885 + name: FE Team + if: + - condition: has_role + value: facilities + - id: 914985333798604840 + name: Events Team + if: + - condition: has_role + value: events + - id: 768339697847762945 + name: Instructors + if: + - condition: has_role + value: INS + - id: 767831791997550642 + name: Mentors + if: + - condition: has_role + value: MTR + - id: 767828062217044008 + name: ZFW Controller + if: + - condition: controller_type + value: home + - id: 768338311261323264 + name: Visiting Controller + if: + - condition: controller_type + value: visitor + - id: 768336777491644436 + name: ZFW Guest + if: + - condition: controller_type + value: none + - id: 767831020447203348 + name: Observer + if: + - condition: rating + value: OBS + - id: 767831019826446377 + name: Student 1 + if: + - condition: rating + value: S1 + - id: 767831019242913792 + name: Student 2 + if: + - condition: rating + value: S2 + - id: 767831018748510208 + name: Student 3 + if: + - condition: rating + value: S3 + - id: 767831018089742367 + name: Controller 1 + if: + - condition: rating + value: C1 + - id: 767831017322840105 + name: Controller 3 + if: + - condition: rating + value: C3 + - id: 767831775375392838 + name: Instructor 1 + if: + - condition: rating + value: I1 + - id: 767831774411227156 + name: Instructor 3 + if: + - condition: rating + value: I3 + - id: 767831016562884659 + name: Supervisor + if: + - condition: rating + value: SUP + - id: 767831016089321492 + name: Administrator + if: + - condition: rating + value: ADM +# Base URL of the API +# Note that the Bot will use this API to fetch event information for the /event +# slash command as well as the roster. The API, if not ADH Partnership's API +# must support the `/v1/events` `/v1/event/:id` and `/v1/user/all` endpoints +# with the same response format as ADH Partnership's API +# +# ADH Partnership's Swagger Docs can be accessed at https://api.zanartcc.org +api: https://api.zfwartcc.net diff --git a/go.mod b/go.mod index 9fb26e6..415e363 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,13 @@ module github.com/vpaza/bot go 1.21 require ( - github.com/adh-partnership/api v0.0.0-20230906032315-70ae5906d952 - github.com/bwmarrin/discordgo v0.27.2-0.20230903211940-8ca653343373 - github.com/go-co-op/gocron v1.33.1 + github.com/adh-partnership/api v0.0.0-20240201055035-cce469b6e9c2 + github.com/bwmarrin/discordgo v0.27.2-0.20240104191117-afc57886f91a + github.com/go-co-op/gocron v1.37.0 github.com/sirupsen/logrus v1.9.3 // indirect - github.com/urfave/cli/v2 v2.25.7 - gorm.io/gorm v1.25.4 // indirect - sigs.k8s.io/yaml v1.3.0 + github.com/urfave/cli/v2 v2.27.1 + gorm.io/gorm v1.25.7 // indirect + sigs.k8s.io/yaml v1.4.0 ) require github.com/allegro/bigcache/v3 v3.1.0 @@ -18,21 +18,22 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/antonfisher/nested-logrus-formatter v1.3.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/websocket v1.5.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gorm.io/driver/mysql v1.5.1 // indirect + gorm.io/driver/mysql v1.5.4 // indirect moul.io/http2curl v1.0.0 // indirect ) diff --git a/go.sum b/go.sum index 0987060..c30ae2e 100644 --- a/go.sum +++ b/go.sum @@ -8,16 +8,28 @@ github.com/adh-partnership/api v0.0.0-20230904181412-376f07d71971 h1:MNT7k85zP2N github.com/adh-partnership/api v0.0.0-20230904181412-376f07d71971/go.mod h1:DSIAzCmv9xAe2lTkriK0iHCU3x64LK9abLYywVZELFA= github.com/adh-partnership/api v0.0.0-20230906032315-70ae5906d952 h1:bNNzP8oOYcR7W3B3TmP2GAsKGJ2mpn5SZYgJAO6w8Pk= github.com/adh-partnership/api v0.0.0-20230906032315-70ae5906d952/go.mod h1:DSIAzCmv9xAe2lTkriK0iHCU3x64LK9abLYywVZELFA= +github.com/adh-partnership/api v0.0.0-20231111190114-8163c1434835 h1:fnKSMAo0oPc8efWAg3ztteYrN3FCtZcykxOGqRjnjno= +github.com/adh-partnership/api v0.0.0-20231111190114-8163c1434835/go.mod h1:yEUkrT9OrFgnmwqImtcVwfxh/UvsjmV1JoTl5uvtUlk= +github.com/adh-partnership/api v0.0.0-20231119204418-a59681017cdf h1:LkAe5z9H8ybD+WdjRcAeo54ix28SjXwzUBWGI7LuO4E= +github.com/adh-partnership/api v0.0.0-20231119204418-a59681017cdf/go.mod h1:yEUkrT9OrFgnmwqImtcVwfxh/UvsjmV1JoTl5uvtUlk= +github.com/adh-partnership/api v0.0.0-20231219042015-2e5aa6c9ac8f h1:7JtbvCi/NVDoW5O9K7ruTofe3oGG1A/uxnUJwJje10w= +github.com/adh-partnership/api v0.0.0-20231219042015-2e5aa6c9ac8f/go.mod h1:E0Hp8BTRhAu77vwi0R66rPfvpD4rN4QAZUixPVimrwk= +github.com/adh-partnership/api v0.0.0-20240201055035-cce469b6e9c2 h1:BBZchs5az1Tvu9mQyvCcf1yw6Db8mpPWmHQxlBC8v2k= +github.com/adh-partnership/api v0.0.0-20240201055035-cce469b6e9c2/go.mod h1:E0Hp8BTRhAu77vwi0R66rPfvpD4rN4QAZUixPVimrwk= github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk= github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I= github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ= github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA= github.com/bwmarrin/discordgo v0.27.2-0.20230903211940-8ca653343373 h1:ELp8nYGYiMxMWpa5VAOKIRBLw5z7Ml6ysGBctHQy7f4= github.com/bwmarrin/discordgo v0.27.2-0.20230903211940-8ca653343373/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY= +github.com/bwmarrin/discordgo v0.27.2-0.20240104191117-afc57886f91a h1:I1j/9FoqDN+W0ZXiSU91lJXwKCvnKBLgJKlBLYAbim4= +github.com/bwmarrin/discordgo v0.27.2-0.20240104191117-afc57886f91a/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -27,16 +39,29 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cu github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/go-co-op/gocron v1.33.1 h1:wjX+Dg6Ae29a/f9BSQjY1Rl+jflTpW9aDyMqseCj78c= github.com/go-co-op/gocron v1.33.1/go.mod h1:NLi+bkm4rRSy1F8U7iacZOz0xPseMoIOnvabGoSe/no= +github.com/go-co-op/gocron v1.36.0 h1:sEmAwg57l4JWQgzaVWYfKZ+w13uHOqeOtwjo72Ll5Wc= +github.com/go-co-op/gocron v1.36.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY= +github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0= +github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= @@ -75,8 +100,12 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= +github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI= +github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= @@ -85,12 +114,34 @@ golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= @@ -108,10 +159,22 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw= gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o= +gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= +gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= +gorm.io/driver/mysql v1.5.4 h1:igQmHfKcbaTVyAIHNhhB888vvxh8EdQ2uSUT0LPcBso= +gorm.io/driver/mysql v1.5.4/go.mod h1:9rYxJph/u9SWkWc9yY4XJ1F/+xO0S/ChOmbk3+Z5Tvs= gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw= gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= moul.io/http2curl v1.0.0 h1:6XwpyZOYsgZJrU8exnG87ncVkU1FVCcTRpwzOkTDUi8= moul.io/http2curl v1.0.0/go.mod h1:f6cULg+e4Md/oW1cYmwW4IWQOVl2lGbmCNGOHvzX2kE= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/vendor/github.com/adh-partnership/api/pkg/config/config.go b/vendor/github.com/adh-partnership/api/pkg/config/config.go index 7687219..9d2c62e 100644 --- a/vendor/github.com/adh-partnership/api/pkg/config/config.go +++ b/vendor/github.com/adh-partnership/api/pkg/config/config.go @@ -31,7 +31,8 @@ var Cfg *Config // We may extend this later with other defaults var defaultConfig = &Config{ Features: ConfigFeatures{ - StaffingRequest: false, + StaffingRequest: false, + ControllerOnline: true, }, } diff --git a/vendor/github.com/adh-partnership/api/pkg/config/configtypes.go b/vendor/github.com/adh-partnership/api/pkg/config/configtypes.go index 8e738e2..0f7e4a9 100644 --- a/vendor/github.com/adh-partnership/api/pkg/config/configtypes.go +++ b/vendor/github.com/adh-partnership/api/pkg/config/configtypes.go @@ -62,7 +62,8 @@ type ConfigEmail struct { } type ConfigFeatures struct { - StaffingRequest bool `json:"staffing_request"` + StaffingRequest bool `json:"staffing_request"` + ControllerOnline bool `json:"controller_online"` } type ConfigSession struct { diff --git a/vendor/github.com/adh-partnership/api/pkg/database/certifications.go b/vendor/github.com/adh-partnership/api/pkg/database/certifications.go new file mode 100644 index 0000000..96bc69e --- /dev/null +++ b/vendor/github.com/adh-partnership/api/pkg/database/certifications.go @@ -0,0 +1,66 @@ +/* + * Copyright ADH Partnership + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package database + +import ( + "sync" + + "github.com/adh-partnership/api/pkg/database/models" +) + +var ( + certCache []models.Certification + mutex = &sync.RWMutex{} +) + +func GetCertifications() []models.Certification { + if certCache == nil { + mutex.Lock() + certCache = make([]models.Certification, 0) + certs := []models.Certification{} + if err := DB.Model(&models.Certification{}).Find(&certs).Error; err != nil { + log.Errorf("Error getting certifications: %v", err) + return nil + } + certCache = certs + log.Infof("Populated certifications cache with %d entries: %+v", len(certCache), certCache) + mutex.Unlock() + } + + mutex.RLock() + defer mutex.RUnlock() + + return certCache +} + +func InvalidateCertCache() { + mutex.Lock() + certCache = nil + log.Infof("Certifications cache invalidated") + mutex.Unlock() +} + +func ValidCertification(key string) bool { + certifications := GetCertifications() + for _, cert := range certifications { + if cert.Name == key { + return true + } + } + + return false +} diff --git a/vendor/github.com/adh-partnership/api/pkg/database/dto/staffing.go b/vendor/github.com/adh-partnership/api/pkg/database/dto/staffing.go index 456fb5b..1ca0b81 100644 --- a/vendor/github.com/adh-partnership/api/pkg/database/dto/staffing.go +++ b/vendor/github.com/adh-partnership/api/pkg/database/dto/staffing.go @@ -17,9 +17,13 @@ package dto type StaffingRequest struct { - Date string `json:"date" binding:"required"` DepartureAirport string `json:"departureAirport" binding:"required"` ArrivalAirport string `json:"arrivalAirport" binding:"required"` + StartDate string `json:"startDate" binding:"required"` + EndDate string `json:"endDate" binding:"required"` Pilots int `json:"pilots" binding:"required"` + ContactInfo string `json:"contactInfo" binding:"required"` + Organization string `json:"organization"` + BannerURL string `json:"bannerUrl"` Comments string `json:"comments"` } diff --git a/vendor/github.com/adh-partnership/api/pkg/database/dto/user.go b/vendor/github.com/adh-partnership/api/pkg/database/dto/user.go index eb03b71..fa85326 100644 --- a/vendor/github.com/adh-partnership/api/pkg/database/dto/user.go +++ b/vendor/github.com/adh-partnership/api/pkg/database/dto/user.go @@ -22,44 +22,51 @@ import ( ) type UserResponse struct { - CID uint `json:"cid" yaml:"cid" xml:"cid"` - FirstName string `json:"first_name" yaml:"first_name" xml:"first_name"` - LastName string `json:"last_name" yaml:"last_name" xml:"last_name"` - OperatingInitials string `json:"operating_initials" yaml:"operating_initials" xml:"operating_initials"` - ControllerType string `json:"controller_type" yaml:"controller_type" xml:"controller_type"` - Certifications UserResponseCertifications `json:"certifications" yaml:"certifications" xml:"certifications"` - Rating string `json:"rating" yaml:"rating" xml:"rating"` - Status string `json:"status" yaml:"status" xml:"status"` - Roles []string `json:"roles" yaml:"roles" xml:"roles"` - Region string `json:"region" yaml:"region" xml:"region"` - Division string `json:"division" yaml:"division" xml:"division"` - Subdivision string `json:"subdivision" yaml:"subdivision" xml:"subdivision"` - DiscordID string `json:"discord_id" yaml:"discord_id" xml:"discord_id"` - RosterJoinDate string `json:"roster_join_date" yaml:"roster_join_date" xml:"roster_join_date"` - ExemptedFromActivity *bool `json:"exempted_from_activity" yaml:"exempted_from_activity" xml:"exempted_from_activity"` - CreatedAt string `json:"created_at" yaml:"created_at" xml:"created_at"` - UpdatedAt string `json:"updated_at" yaml:"updated_at" xml:"updated_at"` + CID uint `json:"cid" yaml:"cid" xml:"cid"` + FirstName string `json:"first_name" yaml:"first_name" xml:"first_name"` + LastName string `json:"last_name" yaml:"last_name" xml:"last_name"` + OperatingInitials string `json:"operating_initials" yaml:"operating_initials" xml:"operating_initials"` + ControllerType string `json:"controller_type" yaml:"controller_type" xml:"controller_type"` + Certifications map[string]*UserResponseCertifications `json:"certifications" yaml:"certifications" xml:"certifications"` + Rating string `json:"rating" yaml:"rating" xml:"rating"` + Status string `json:"status" yaml:"status" xml:"status"` + Roles []string `json:"roles" yaml:"roles" xml:"roles"` + Region string `json:"region" yaml:"region" xml:"region"` + Division string `json:"division" yaml:"division" xml:"division"` + Subdivision string `json:"subdivision" yaml:"subdivision" xml:"subdivision"` + DiscordID string `json:"discord_id" yaml:"discord_id" xml:"discord_id"` + RosterJoinDate string `json:"roster_join_date" yaml:"roster_join_date" xml:"roster_join_date"` + ExemptedFromActivity *bool `json:"exempted_from_activity" yaml:"exempted_from_activity" xml:"exempted_from_activity"` + CreatedAt string `json:"created_at" yaml:"created_at" xml:"created_at"` + UpdatedAt string `json:"updated_at" yaml:"updated_at" xml:"updated_at"` } type UserResponseAdmin struct { - CID uint `json:"cid" yaml:"cid" xml:"cid"` - FirstName string `json:"first_name" yaml:"first_name" xml:"first_name"` - LastName string `json:"last_name" yaml:"last_name" xml:"last_name"` - OperatingInitials string `json:"operating_initials" yaml:"operating_initials" xml:"operating_initials"` - ControllerType string `json:"controller_type" yaml:"controller_type" xml:"controller_type"` - Certifications UserResponseCertifications `json:"certifications" yaml:"certifications" xml:"certifications"` - RemovalReason string `json:"removal_reason" yaml:"removal_reason" xml:"removal_reason"` - Rating string `json:"rating" yaml:"rating" xml:"rating"` - Status string `json:"status" yaml:"status" xml:"status"` - Roles []string `json:"roles" yaml:"roles" xml:"roles"` - Region string `json:"region" yaml:"region" xml:"region"` - Division string `json:"division" yaml:"division" xml:"division"` - Subdivision string `json:"subdivision" yaml:"subdivision" xml:"subdivision"` - DiscordID string `json:"discord_id" yaml:"discord_id" xml:"discord_id"` - ExemptedFromActivity *bool `json:"exempted_from_activity" yaml:"exempted_from_activity" xml:"exempted_from_activity"` - RosterJoinDate string `json:"roster_join_date" yaml:"roster_join_date" xml:"roster_join_date"` - CreatedAt string `json:"created_at" yaml:"created_at" xml:"created_at"` - UpdatedAt string `json:"updated_at" yaml:"updated_at" xml:"updated_at"` + CID uint `json:"cid" yaml:"cid" xml:"cid"` + FirstName string `json:"first_name" yaml:"first_name" xml:"first_name"` + LastName string `json:"last_name" yaml:"last_name" xml:"last_name"` + OperatingInitials string `json:"operating_initials" yaml:"operating_initials" xml:"operating_initials"` + ControllerType string `json:"controller_type" yaml:"controller_type" xml:"controller_type"` + Certifications map[string]*UserResponseCertifications `json:"certifications" yaml:"certifications" xml:"certifications"` + RemovalReason string `json:"removal_reason" yaml:"removal_reason" xml:"removal_reason"` + Rating string `json:"rating" yaml:"rating" xml:"rating"` + Status string `json:"status" yaml:"status" xml:"status"` + Roles []string `json:"roles" yaml:"roles" xml:"roles"` + Region string `json:"region" yaml:"region" xml:"region"` + Division string `json:"division" yaml:"division" xml:"division"` + Subdivision string `json:"subdivision" yaml:"subdivision" xml:"subdivision"` + DiscordID string `json:"discord_id" yaml:"discord_id" xml:"discord_id"` + ExemptedFromActivity *bool `json:"exempted_from_activity" yaml:"exempted_from_activity" xml:"exempted_from_activity"` + RosterJoinDate string `json:"roster_join_date" yaml:"roster_join_date" xml:"roster_join_date"` + CreatedAt string `json:"created_at" yaml:"created_at" xml:"created_at"` + UpdatedAt string `json:"updated_at" yaml:"updated_at" xml:"updated_at"` +} + +type UserResponseCertifications struct { + DisplayName string `json:"display_name" yaml:"display_name" xml:"display_name"` + Value string `json:"value" yaml:"value" xml:"value"` + Order uint `json:"order" yaml:"order" xml:"order"` + Hidden bool `json:"hidden" yaml:"hidden" xml:"hidden"` } type VisitorResponse struct { @@ -69,17 +76,6 @@ type VisitorResponse struct { UpdatedAt string `json:"updated_at" yaml:"updated_at" xml:"updated_at"` } -type UserResponseCertifications struct { - Ground string `json:"ground" yaml:"ground" xml:"ground"` - MajorGround string `json:"major_ground" yaml:"major_ground" xml:"major_ground"` - Local string `json:"local" yaml:"local" xml:"local"` - MajorLocal string `json:"major_local" yaml:"major_local" xml:"major_local"` - Approach string `json:"approach" yaml:"approach" xml:"approach"` - MajorApproach string `json:"major_approach" yaml:"major_approach" xml:"major_approach"` - Enroute string `json:"enroute" yaml:"enroute" xml:"enroute"` - Oceanic string `json:"oceanic" yaml:"oceanic" xml:"oceanic"` -} - type FacilityStaffResponse struct { ATM []*UserResponse `json:"atm" yaml:"atm" xml:"atm"` DATM []*UserResponse `json:"datm" yaml:"datm" xml:"datm"` @@ -106,22 +102,39 @@ func ConvUserToUserResponse(user *models.User) *UserResponse { } } + userCerts, err := database.FindUserCertifications(user) + certs := map[string]*UserResponseCertifications{} + if err == nil { + for _, cert := range userCerts { + certs[cert.Name] = &UserResponseCertifications{ + Value: cert.Value, + } + } + } + + // Fill in other certifications with "none" + for _, c := range database.GetCertifications() { + if _, ok := certs[c.Name]; !ok { + certs[c.Name] = &UserResponseCertifications{ + DisplayName: c.DisplayName, + Value: "none", + Order: c.Order, + Hidden: c.Hidden, + } + } else { + certs[c.Name].DisplayName = c.DisplayName + certs[c.Name].Order = c.Order + certs[c.Name].Hidden = c.Hidden + } + } + u := &UserResponse{ - CID: user.CID, - FirstName: user.FirstName, - LastName: user.LastName, - OperatingInitials: user.OperatingInitials, - ControllerType: user.ControllerType, - Certifications: UserResponseCertifications{ - Ground: user.GndCertification, - MajorGround: user.MajorGndCertification, - Local: user.LclCertification, - MajorLocal: user.MajorLclCertification, - Approach: user.AppCertification, - MajorApproach: user.MajorAppCertification, - Enroute: user.CtrCertification, - Oceanic: user.OceanicCertification, - }, + CID: user.CID, + FirstName: user.FirstName, + LastName: user.LastName, + OperatingInitials: user.OperatingInitials, + ControllerType: user.ControllerType, + Certifications: certs, Roles: roles, Rating: user.Rating.Short, Status: user.Status, @@ -180,67 +193,43 @@ func PatchUserFromUserResponse(user *models.User, userResponse UserResponseAdmin } } - if userResponse.Certifications.Ground != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.Ground]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.GndCertification = userResponse.Certifications.Ground - } - } - - if userResponse.Certifications.MajorGround != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.MajorGround]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.MajorGndCertification = userResponse.Certifications.MajorGround - } - } - - if userResponse.Certifications.Local != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.Local]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.LclCertification = userResponse.Certifications.Local - } - } - - if userResponse.Certifications.MajorLocal != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.MajorLocal]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.MajorLclCertification = userResponse.Certifications.MajorLocal - } - } - - if userResponse.Certifications.Approach != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.Approach]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.AppCertification = userResponse.Certifications.Approach - } - } - - if userResponse.Certifications.MajorApproach != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.MajorApproach]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.MajorAppCertification = userResponse.Certifications.MajorApproach - } - } - - if userResponse.Certifications.Enroute != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.Enroute]; !ok { - errs = append(errs, ErrInvalidCertification) - } else { - user.CtrCertification = userResponse.Certifications.Enroute - } - } - - if userResponse.Certifications.Oceanic != "" { - if _, ok := models.CertificationOptions[userResponse.Certifications.Oceanic]; !ok { - errs = append(errs, ErrInvalidCertification) + if userResponse.Certifications != nil { + userCerts, err := database.FindUserCertifications(user) + if err != nil { + errs = append(errs, err.Error()) } else { - user.OceanicCertification = userResponse.Certifications.Oceanic + for certName, certValue := range userResponse.Certifications { + if !database.ValidCertification(certName) { + errs = append(errs, ErrInvalidCertification) + continue + } + + found := false + if _, ok := models.CertificationOptions[certValue.Value]; !ok { + errs = append(errs, ErrInvalidCertification) + continue + } + + for _, cert := range userCerts { + if cert.Name == certName { + cert.Value = certValue.Value + if err := database.DB.Save(cert).Error; err != nil { + errs = append(errs, err.Error()) + } + found = true + } + } + + if !found { + if err := database.DB.Create(&models.UserCertification{ + CID: user.CID, + Name: certName, + Value: certValue.Value, + }).Error; err != nil { + errs = append(errs, err.Error()) + } + } + } } } diff --git a/vendor/github.com/adh-partnership/api/pkg/database/models.go b/vendor/github.com/adh-partnership/api/pkg/database/models.go index 5276633..f5b0e16 100644 --- a/vendor/github.com/adh-partnership/api/pkg/database/models.go +++ b/vendor/github.com/adh-partnership/api/pkg/database/models.go @@ -57,7 +57,7 @@ func RemoveRoleFromUser(user *models.User, role *models.Role) error { func GetEvents(limit int) ([]*models.Event, error) { var events []*models.Event - c := DB.Preload(clause.Associations).Where("start_date > ?", time.Now()).Order("start_date asc") + c := DB.Preload(clause.Associations).Where("end_date > ?", time.Now()).Order("start_date asc") if limit > 0 { c = c.Limit(limit) } @@ -118,6 +118,15 @@ func FindUsersWithRole(role string) ([]models.User, error) { return users, nil } +func FindUserCertifications(user *models.User) ([]*models.UserCertification, error) { + var certs []*models.UserCertification + if err := DB.Where(models.UserCertification{CID: user.CID}).Find(&certs).Error; err != nil { + return nil, err + } + + return certs, nil +} + func FindUserByCID(cid string) (*models.User, error) { user := &models.User{} if err := DB.Preload(clause.Associations).Where(models.User{CID: atou(cid)}).First(&user).Error; err != nil { @@ -316,3 +325,12 @@ func FindTrainingSessionRequestWithFilter(f *TrainingSessionRequestFilter) ([]*m return requests, nil } + +func FindAPIKey(key string) (*models.APIKeys, error) { + apikey := &models.APIKeys{} + if err := DB.Where(models.APIKeys{Key: key}).First(apikey).Error; err != nil { + return nil, err + } + + return apikey, nil +} diff --git a/vendor/github.com/adh-partnership/api/pkg/database/models/apikeys.go b/vendor/github.com/adh-partnership/api/pkg/database/models/apikeys.go index a7c5ba3..9f37cba 100644 --- a/vendor/github.com/adh-partnership/api/pkg/database/models/apikeys.go +++ b/vendor/github.com/adh-partnership/api/pkg/database/models/apikeys.go @@ -16,8 +16,12 @@ package models +import "time" + type APIKeys struct { - ID int `json:"id" example:"1"` - Key string `json:"key" example:"1234567890"` - Role string `json:"role" example:"admin"` + ID uint `json:"id" example:"1"` + Key string `json:"key" example:"1234567890"` + Roles string `json:"role" example:"[\"atm\"]"` + CreatedAt time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"` + UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"` } diff --git a/vendor/github.com/adh-partnership/api/pkg/database/models/certification.go b/vendor/github.com/adh-partnership/api/pkg/database/models/certification.go new file mode 100644 index 0000000..e2f861b --- /dev/null +++ b/vendor/github.com/adh-partnership/api/pkg/database/models/certification.go @@ -0,0 +1,49 @@ +/* + * Copyright ADH Partnership + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package models + +import "time" + +type Certification struct { + ID uint `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Order uint `json:"order"` + Hidden bool `json:"hidden"` +} + +type UserCertification struct { + ID uint `json:"id"` + CID uint `json:"cid" gorm:"index:idx_cid,index:idx_cid_certification"` + Name string `json:"name" gorm:"index:idx_cid_certification"` + Value string `json:"value"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +var CertificationOptions = map[string]string{ + "none": "none", + "training": "training", + "solo": "solo", + "certified": "certified", + "cantrain": "cantrain", +} + +func IValidUserCertificationValue(value string) bool { + _, ok := CertificationOptions[value] + return ok +} diff --git a/vendor/github.com/adh-partnership/api/pkg/database/models/user.go b/vendor/github.com/adh-partnership/api/pkg/database/models/user.go index 8753f6c..abe9a99 100644 --- a/vendor/github.com/adh-partnership/api/pkg/database/models/user.go +++ b/vendor/github.com/adh-partnership/api/pkg/database/models/user.go @@ -27,23 +27,7 @@ type User struct { Email string `json:"email" gorm:"type:varchar(128)" example:"wm@denartcc.org"` OperatingInitials string `json:"operating_initials" gorm:"type:varchar(2)" example:"DH"` // Must be one of: none, active, inactive, loa - ControllerType string `json:"controllerType" gorm:"type:varchar(10)" example:"home"` - // Must be one of : none, training, solo, certified, cantrain - GndCertification string `json:"gndCertification" gorm:"type:varchar(15);default:'none'" example:"certified"` - // Must be one of : none, training, solo, certified, cantrain - MajorGndCertification string `json:"majgndCertification" gorm:"type:varchar(15);default:'none'" example:"certified"` - // Must be one of : none, training, solo, certified, cantrain - LclCertification string `json:"lclCertification" gorm:"type:varchar(15);default:'none'" example:"certified"` - // Must be one of : none, training, solo, certified, cantrain - MajorLclCertification string `json:"majorlclCertification" gorm:"type:varchar(15);default:'none'" example:"certified"` - // Must be one of : none, training, solo, certified, cantrain - AppCertification string `json:"appCertification" gorm:"type:varchar(15);default:'none'" example:"certified"` - // Must be one of : none, training, solo, certified, cantrain - MajorAppCertification string `json:"majorappCertification" gorm:"type:varchar(15);default:'none'" example:"certified"` - // Must be one of : none, training, solo, certified, cantrain - CtrCertification string `json:"ctrCertification" gorm:"type:varchar(15);default:'none'" example:"none"` - // Must be one of : none, training, certified, cantrain - OceanicCertification string `json:"oceanicCertification" gorm:"type:varchar(15);default:'none'" example:"none"` + ControllerType string `json:"controllerType" gorm:"type:varchar(10)" example:"home"` ExemptedFromActivity bool `json:"exemptedFromActivity" gorm:"default:false" example:"false"` RatingID int `json:"-"` Rating Rating `json:"rating"` @@ -62,14 +46,6 @@ type User struct { UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"` } -var CertificationOptions = map[string]string{ - "none": "none", - "training": "training", - "solo": "solo", - "certified": "certified", - "cantrain": "cantrain", -} - var ControllerTypeOptions = map[string]string{ "none": "none", "visitor": "visitor", diff --git a/vendor/github.com/bwmarrin/discordgo/components.go b/vendor/github.com/bwmarrin/discordgo/components.go index a5f86b3..af3d7ab 100644 --- a/vendor/github.com/bwmarrin/discordgo/components.go +++ b/vendor/github.com/bwmarrin/discordgo/components.go @@ -132,10 +132,10 @@ type ComponentEmoji struct { // Button represents button component. type Button struct { - Label string `json:"label"` - Style ButtonStyle `json:"style"` - Disabled bool `json:"disabled"` - Emoji ComponentEmoji `json:"emoji"` + Label string `json:"label"` + Style ButtonStyle `json:"style"` + Disabled bool `json:"disabled"` + Emoji *ComponentEmoji `json:"emoji,omitempty"` // NOTE: Only button with LinkButton style can have link. Also, URL is mutually exclusive with CustomID. URL string `json:"url,omitempty"` @@ -166,14 +166,32 @@ func (Button) Type() ComponentType { // SelectMenuOption represents an option for a select menu. type SelectMenuOption struct { - Label string `json:"label,omitempty"` - Value string `json:"value"` - Description string `json:"description"` - Emoji ComponentEmoji `json:"emoji"` + Label string `json:"label,omitempty"` + Value string `json:"value"` + Description string `json:"description"` + Emoji *ComponentEmoji `json:"emoji,omitempty"` // Determines whenever option is selected by default or not. Default bool `json:"default"` } +// SelectMenuDefaultValueType represents the type of an entity selected by default in auto-populated select menus. +type SelectMenuDefaultValueType string + +// SelectMenuDefaultValue types. +const ( + SelectMenuDefaultValueUser SelectMenuDefaultValueType = "user" + SelectMenuDefaultValueRole SelectMenuDefaultValueType = "role" + SelectMenuDefaultValueChannel SelectMenuDefaultValueType = "channel" +) + +// SelectMenuDefaultValue represents an entity selected by default in auto-populated select menus. +type SelectMenuDefaultValue struct { + // ID of the entity. + ID string `json:"id"` + // Type of the entity. + Type SelectMenuDefaultValueType `json:"type"` +} + // SelectMenuType represents select menu type. type SelectMenuType ComponentType @@ -198,9 +216,13 @@ type SelectMenu struct { MinValues *int `json:"min_values,omitempty"` // This value determines the maximal amount of selected items in the menu. // If MaxValues or MinValues are greater than one then the user can select multiple items in the component. - MaxValues int `json:"max_values,omitempty"` - Options []SelectMenuOption `json:"options,omitempty"` - Disabled bool `json:"disabled"` + MaxValues int `json:"max_values,omitempty"` + // List of default values for auto-populated select menus. + // NOTE: Number of entries should be in the range defined by MinValues and MaxValues. + DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"` + + Options []SelectMenuOption `json:"options,omitempty"` + Disabled bool `json:"disabled"` // NOTE: Can only be used in SelectMenu with Channel menu type. ChannelTypes []ChannelType `json:"channel_types,omitempty"` diff --git a/vendor/github.com/bwmarrin/discordgo/endpoints.go b/vendor/github.com/bwmarrin/discordgo/endpoints.go index e150a07..b2e6326 100644 --- a/vendor/github.com/bwmarrin/discordgo/endpoints.go +++ b/vendor/github.com/bwmarrin/discordgo/endpoints.go @@ -42,6 +42,7 @@ var ( EndpointCDNChannelIcons = EndpointCDN + "channel-icons/" EndpointCDNBanners = EndpointCDN + "banners/" EndpointCDNGuilds = EndpointCDN + "guilds/" + EndpointCDNRoleIcons = EndpointCDN + "role-icons/" EndpointVoice = EndpointAPI + "/voice/" EndpointVoiceRegions = EndpointVoice + "regions" @@ -103,6 +104,7 @@ var ( EndpointGuildScheduledEvents = func(gID string) string { return EndpointGuilds + gID + "/scheduled-events" } EndpointGuildScheduledEvent = func(gID, eID string) string { return EndpointGuilds + gID + "/scheduled-events/" + eID } EndpointGuildScheduledEventUsers = func(gID, eID string) string { return EndpointGuildScheduledEvent(gID, eID) + "/users" } + EndpointGuildOnboarding = func(gID string) string { return EndpointGuilds + gID + "/onboarding" } EndpointGuildTemplate = func(tID string) string { return EndpointGuilds + "templates/" + tID } EndpointGuildTemplates = func(gID string) string { return EndpointGuilds + gID + "/templates" } EndpointGuildTemplateSync = func(gID, tID string) string { return EndpointGuilds + gID + "/templates/" + tID } @@ -113,6 +115,10 @@ var ( return EndpointCDNGuilds + gId + "/users/" + uID + "/avatars/" + aID + ".gif" } + EndpointRoleIcon = func(rID, hash string) string { + return EndpointCDNRoleIcons + rID + "/" + hash + ".png" + } + EndpointChannel = func(cID string) string { return EndpointChannels + cID } EndpointChannelThreads = func(cID string) string { return EndpointChannel(cID) + "/threads" } EndpointChannelActiveThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/active" } diff --git a/vendor/github.com/bwmarrin/discordgo/interactions.go b/vendor/github.com/bwmarrin/discordgo/interactions.go index 6106856..c562463 100644 --- a/vendor/github.com/bwmarrin/discordgo/interactions.go +++ b/vendor/github.com/bwmarrin/discordgo/interactions.go @@ -554,6 +554,7 @@ type InteractionResponseData struct { Embeds []*MessageEmbed `json:"embeds"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` Files []*File `json:"-"` + Attachments *[]*MessageAttachment `json:"attachments,omitempty"` // NOTE: only MessageFlagsSuppressEmbeds and MessageFlagsEphemeral can be set. Flags MessageFlags `json:"flags,omitempty"` diff --git a/vendor/github.com/bwmarrin/discordgo/restapi.go b/vendor/github.com/bwmarrin/discordgo/restapi.go index b2d6959..cc18d88 100644 --- a/vendor/github.com/bwmarrin/discordgo/restapi.go +++ b/vendor/github.com/bwmarrin/discordgo/restapi.go @@ -2711,11 +2711,22 @@ func (s *Session) ThreadMemberRemove(threadID, memberID string, options ...Reque return err } -// ThreadMember returns thread member object for the specified member of a thread -func (s *Session) ThreadMember(threadID, memberID string, options ...RequestOption) (member *ThreadMember, err error) { - endpoint := EndpointThreadMember(threadID, memberID) +// ThreadMember returns thread member object for the specified member of a thread. +// withMember : Whether to include a guild member object. +func (s *Session) ThreadMember(threadID, memberID string, withMember bool, options ...RequestOption) (member *ThreadMember, err error) { + uri := EndpointThreadMember(threadID, memberID) + + queryParams := url.Values{} + if withMember { + queryParams.Set("with_member", "true") + } + + if len(queryParams) > 0 { + uri += "?" + queryParams.Encode() + } + var body []byte - body, err = s.RequestWithBucketID("GET", endpoint, nil, endpoint, options...) + body, err = s.RequestWithBucketID("GET", uri, nil, uri, options...) if err != nil { return @@ -2726,9 +2737,29 @@ func (s *Session) ThreadMember(threadID, memberID string, options ...RequestOpti } // ThreadMembers returns all members of specified thread. -func (s *Session) ThreadMembers(threadID string, options ...RequestOption) (members []*ThreadMember, err error) { +// limit : Max number of thread members to return (1-100). Defaults to 100. +// afterID : Get thread members after this user ID. +// withMember : Whether to include a guild member object for each thread member. +func (s *Session) ThreadMembers(threadID string, limit int, withMember bool, afterID string, options ...RequestOption) (members []*ThreadMember, err error) { + uri := EndpointThreadMembers(threadID) + + queryParams := url.Values{} + if withMember { + queryParams.Set("with_member", "true") + } + if limit > 0 { + queryParams.Set("limit", strconv.Itoa(limit)) + } + if afterID != "" { + queryParams.Set("after", afterID) + } + + if len(queryParams) > 0 { + uri += "?" + queryParams.Encode() + } + var body []byte - body, err = s.RequestWithBucketID("GET", EndpointThreadMembers(threadID), nil, EndpointThreadMembers(threadID), options...) + body, err = s.RequestWithBucketID("GET", uri, nil, uri, options...) if err != nil { return @@ -3250,6 +3281,37 @@ func (s *Session) GuildScheduledEventUsers(guildID, eventID string, limit int, w return } +// GuildOnboarding returns onboarding configuration of a guild. +// guildID : The ID of the guild +func (s *Session) GuildOnboarding(guildID string, options ...RequestOption) (onboarding *GuildOnboarding, err error) { + endpoint := EndpointGuildOnboarding(guildID) + + var body []byte + body, err = s.RequestWithBucketID("GET", endpoint, nil, endpoint, options...) + if err != nil { + return + } + + err = unmarshal(body, &onboarding) + return +} + +// GuildOnboardingEdit edits onboarding configuration of a guild. +// guildID : The ID of the guild +// o : New GuildOnboarding data +func (s *Session) GuildOnboardingEdit(guildID string, o *GuildOnboarding, options ...RequestOption) (onboarding *GuildOnboarding, err error) { + endpoint := EndpointGuildOnboarding(guildID) + + var body []byte + body, err = s.RequestWithBucketID("PUT", endpoint, o, endpoint, options...) + if err != nil { + return + } + + err = unmarshal(body, &onboarding) + return +} + // ---------------------------------------------------------------------- // Functions specific to auto moderation // ---------------------------------------------------------------------- diff --git a/vendor/github.com/bwmarrin/discordgo/structs.go b/vendor/github.com/bwmarrin/discordgo/structs.go index 26dc4f4..6d3b4fb 100644 --- a/vendor/github.com/bwmarrin/discordgo/structs.go +++ b/vendor/github.com/bwmarrin/discordgo/structs.go @@ -531,6 +531,10 @@ type ThreadMember struct { JoinTimestamp time.Time `json:"join_timestamp"` // Any user-thread settings, currently only used for notifications Flags int `json:"flags"` + // Additional information about the user. + // NOTE: only present if the withMember parameter is set to true + // when calling Session.ThreadMembers or Session.ThreadMember. + Member *Member `json:"member,omitempty"` } // ThreadsList represents a list of threads alongisde with thread member objects for the current user. @@ -1070,6 +1074,109 @@ type GuildScheduledEventUser struct { Member *Member `json:"member"` } +// GuildOnboardingMode defines the criteria used to satisfy constraints that are required for enabling onboarding. +// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-mode +type GuildOnboardingMode int + +// Block containing known GuildOnboardingMode values. +const ( + // GuildOnboardingModeDefault counts default channels towards constraints. + GuildOnboardingModeDefault GuildOnboardingMode = 0 + // GuildOnboardingModeAdvanced counts default channels and questions towards constraints. + GuildOnboardingModeAdvanced GuildOnboardingMode = 1 +) + +// GuildOnboarding represents the onboarding flow for a guild. +// https://discord.com/developers/docs/resources/guild#guild-onboarding-object +type GuildOnboarding struct { + // ID of the guild this onboarding flow is part of. + GuildID string `json:"guild_id,omitempty"` + + // Prompts shown during onboarding and in the customize community (Channels & Roles) tab. + Prompts *[]GuildOnboardingPrompt `json:"prompts,omitempty"` + + // Channel IDs that members get opted into automatically. + DefaultChannelIDs []string `json:"default_channel_ids,omitempty"` + + // Whether onboarding is enabled in the guild. + Enabled *bool `json:"enabled,omitempty"` + + // Mode of onboarding. + Mode *GuildOnboardingMode `json:"mode,omitempty"` +} + +// GuildOnboardingPromptType is the type of an onboarding prompt. +// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types +type GuildOnboardingPromptType int + +// Block containing known GuildOnboardingPromptType values. +const ( + GuildOnboardingPromptTypeMultipleChoice GuildOnboardingPromptType = 0 + GuildOnboardingPromptTypeDropdown GuildOnboardingPromptType = 1 +) + +// GuildOnboardingPrompt is a prompt shown during onboarding and in the customize community (Channels & Roles) tab. +// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure +type GuildOnboardingPrompt struct { + // ID of the prompt. + // NOTE: always requires to be a valid snowflake (e.g. "0"), see + // https://github.com/discord/discord-api-docs/issues/6320 for more information. + ID string `json:"id,omitempty"` + + // Type of the prompt. + Type GuildOnboardingPromptType `json:"type"` + + // Options available within the prompt. + Options []GuildOnboardingPromptOption `json:"options"` + + // Title of the prompt. + Title string `json:"title"` + + // Indicates whether users are limited to selecting one option for the prompt. + SingleSelect bool `json:"single_select"` + + // Indicates whether the prompt is required before a user completes the onboarding flow. + Required bool `json:"required"` + + // Indicates whether the prompt is present in the onboarding flow. + // If false, the prompt will only appear in the customize community (Channels & Roles) tab. + InOnboarding bool `json:"in_onboarding"` +} + +// GuildOnboardingPromptOption is an option available within an onboarding prompt. +// https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure +type GuildOnboardingPromptOption struct { + // ID of the prompt option. + ID string `json:"id,omitempty"` + + // IDs for channels a member is added to when the option is selected. + ChannelIDs []string `json:"channel_ids"` + + // IDs for roles assigned to a member when the option is selected. + RoleIDs []string `json:"role_ids"` + + // Emoji of the option. + // NOTE: when creating or updating a prompt option + // EmojiID, EmojiName and EmojiAnimated should be used instead. + Emoji *Emoji `json:"emoji,omitempty"` + + // Title of the option. + Title string `json:"title"` + + // Description of the option. + Description string `json:"description"` + + // ID of the option's emoji. + // NOTE: only used when creating or updating a prompt option. + EmojiID string `json:"emoji_id,omitempty"` + // Name of the option's emoji. + // NOTE: only used when creating or updating a prompt option. + EmojiName string `json:"emoji_name,omitempty"` + // Whether the option's emoji is animated. + // NOTE: only used when creating or updating a prompt option. + EmojiAnimated *bool `json:"emoji_animated,omitempty"` +} + // A GuildTemplate represents a replicable template for guild creation type GuildTemplate struct { // The unique code for the guild template @@ -1242,6 +1349,12 @@ type Role struct { // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the permission. Permissions int64 `json:"permissions,string"` + + // The hash of the role icon. Use Role.IconURL to retrieve the icon's URL. + Icon string `json:"icon"` + + // The emoji assigned to this role. + UnicodeEmoji string `json:"unicode_emoji"` } // Mention returns a string which mentions the role @@ -1249,6 +1362,23 @@ func (r *Role) Mention() string { return fmt.Sprintf("<@&%s>", r.ID) } +// IconURL returns the URL of the role's icon. +// +// size: The size of the desired role icon as a power of two +// Image size can be any power of two between 16 and 4096. +func (r *Role) IconURL(size string) string { + if r.Icon == "" { + return "" + } + + URL := EndpointRoleIcon(r.ID, r.Icon) + + if size != "" { + return URL + "?size=" + size + } + return URL +} + // RoleParams represents the parameters needed to create or update a Role type RoleParams struct { // The role's name @@ -1261,6 +1391,12 @@ type RoleParams struct { Permissions *int64 `json:"permissions,omitempty,string"` // Whether this role is mentionable Mentionable *bool `json:"mentionable,omitempty"` + // The role's unicode emoji. + // NOTE: can only be set if the guild has the ROLE_ICONS feature. + UnicodeEmoji *string `json:"unicode_emoji,omitempty"` + // The role's icon image encoded in base64. + // NOTE: can only be set if the guild has the ROLE_ICONS feature. + Icon *string `json:"icon,omitempty"` } // Roles are a collection of Role @@ -1394,6 +1530,15 @@ func (m *Member) AvatarURL(size string) string { } +// DisplayName returns the member's guild nickname if they have one, +// otherwise it returns their discord display name. +func (m *Member) DisplayName() string { + if m.Nick != "" { + return m.Nick + } + return m.User.GlobalName +} + // ClientStatus stores the online, offline, idle, or dnd status of each device of a Guild member. type ClientStatus struct { Desktop Status `json:"desktop"` @@ -1838,6 +1983,9 @@ const ( AuditLogActionAutoModerationBlockMessage AuditLogAction = 143 AuditLogActionAutoModerationFlagToChannel AuditLogAction = 144 AuditLogActionAutoModerationUserCommunicationDisabled AuditLogAction = 145 + + AuditLogActionCreatorMonetizationRequestCreated AuditLogAction = 150 + AuditLogActionCreatorMonetizationTermsAccepted AuditLogAction = 151 ) // GuildMemberParams stores data needed to update a member @@ -2355,6 +2503,9 @@ const ( ErrCodeCannotUpdateAFinishedEvent = 180000 ErrCodeFailedToCreateStageNeededForStageEvent = 180002 + + ErrCodeCannotEnableOnboardingRequirementsAreNotMet = 350000 + ErrCodeCannotUpdateOnboardingWhileBelowRequirements = 350001 ) // Intent is the type of a Gateway Intent diff --git a/vendor/github.com/bwmarrin/discordgo/user.go b/vendor/github.com/bwmarrin/discordgo/user.go index 5a91adf..5dda456 100644 --- a/vendor/github.com/bwmarrin/discordgo/user.go +++ b/vendor/github.com/bwmarrin/discordgo/user.go @@ -24,6 +24,20 @@ const ( UserFlagVerifiedBot UserFlags = 1 << 16 UserFlagVerifiedBotDeveloper UserFlags = 1 << 17 UserFlagDiscordCertifiedModerator UserFlags = 1 << 18 + UserFlagBotHTTPInteractions UserFlags = 1 << 19 + UserFlagActiveBotDeveloper UserFlags = 1 << 22 +) + +// UserPremiumType is the type of premium (nitro) subscription a user has (see UserPremiumType* consts). +// https://discord.com/developers/docs/resources/user#user-object-premium-types +type UserPremiumType int + +// Valid UserPremiumType values. +const ( + UserPremiumTypeNone UserPremiumType = 0 + UserPremiumTypeNitroClassic UserPremiumType = 1 + UserPremiumTypeNitro UserPremiumType = 2 + UserPremiumTypeNitroBasic UserPremiumType = 3 ) // A User stores all data for an individual Discord user. @@ -78,7 +92,7 @@ type User struct { // The type of Nitro subscription on a user's account. // Only available when the request is authorized via a Bearer token. - PremiumType int `json:"premium_type"` + PremiumType UserPremiumType `json:"premium_type"` // Whether the user is an Official Discord System user (part of the urgent message system). System bool `json:"system"` diff --git a/vendor/github.com/bwmarrin/discordgo/webhook.go b/vendor/github.com/bwmarrin/discordgo/webhook.go index 9209b70..7e30b5b 100644 --- a/vendor/github.com/bwmarrin/discordgo/webhook.go +++ b/vendor/github.com/bwmarrin/discordgo/webhook.go @@ -34,10 +34,14 @@ type WebhookParams struct { Files []*File `json:"-"` Components []MessageComponent `json:"components"` Embeds []*MessageEmbed `json:"embeds,omitempty"` + Attachments []*MessageAttachment `json:"attachments,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` // Only MessageFlagsSuppressEmbeds and MessageFlagsEphemeral can be set. // MessageFlagsEphemeral can only be set when using Followup Message Create endpoint. Flags MessageFlags `json:"flags,omitempty"` + // Name of the thread to create. + // NOTE: can only be set if the webhook channel is a forum. + ThreadName string `json:"thread_name,omitempty"` } // WebhookEdit stores data for editing of a webhook message. @@ -46,5 +50,6 @@ type WebhookEdit struct { Components *[]MessageComponent `json:"components,omitempty"` Embeds *[]*MessageEmbed `json:"embeds,omitempty"` Files []*File `json:"-"` + Attachments *[]*MessageAttachment `json:"attachments,omitempty"` AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` } diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go index b480056..42bf32a 100644 --- a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go +++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go @@ -9,6 +9,8 @@ func Render(doc []byte) []byte { renderer := NewRoffRenderer() return blackfriday.Run(doc, - []blackfriday.Option{blackfriday.WithRenderer(renderer), - blackfriday.WithExtensions(renderer.GetExtensions())}...) + []blackfriday.Option{ + blackfriday.WithRenderer(renderer), + blackfriday.WithExtensions(renderer.GetExtensions()), + }...) } diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go index be2b343..4b19188 100644 --- a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go +++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go @@ -1,6 +1,7 @@ package md2man import ( + "bytes" "fmt" "io" "os" @@ -34,10 +35,10 @@ const ( hruleTag = "\n.ti 0\n\\l'\\n(.lu'\n" linkTag = "\n\\[la]" linkCloseTag = "\\[ra]" - codespanTag = "\\fB\\fC" + codespanTag = "\\fB" codespanCloseTag = "\\fR" - codeTag = "\n.PP\n.RS\n\n.nf\n" - codeCloseTag = "\n.fi\n.RE\n" + codeTag = "\n.EX\n" + codeCloseTag = "\n.EE\n" quoteTag = "\n.PP\n.RS\n" quoteCloseTag = "\n.RE\n" listTag = "\n.RS\n" @@ -86,8 +87,7 @@ func (r *roffRenderer) RenderFooter(w io.Writer, ast *blackfriday.Node) { // RenderNode is called for each node in a markdown document; based on the node // type the equivalent roff output is sent to the writer func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus { - - var walkAction = blackfriday.GoToNext + walkAction := blackfriday.GoToNext switch node.Type { case blackfriday.Text: @@ -109,9 +109,16 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering out(w, strongCloseTag) } case blackfriday.Link: - if !entering { - out(w, linkTag+string(node.LinkData.Destination)+linkCloseTag) + // Don't render the link text for automatic links, because this + // will only duplicate the URL in the roff output. + // See https://daringfireball.net/projects/markdown/syntax#autolink + if !bytes.Equal(node.LinkData.Destination, node.FirstChild.Literal) { + out(w, string(node.FirstChild.Literal)) } + // Hyphens in a link must be escaped to avoid word-wrap in the rendered man page. + escapedLink := strings.ReplaceAll(string(node.LinkData.Destination), "-", "\\-") + out(w, linkTag+escapedLink+linkCloseTag) + walkAction = blackfriday.SkipChildren case blackfriday.Image: // ignore images walkAction = blackfriday.SkipChildren @@ -160,6 +167,11 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering r.handleTableCell(w, node, entering) case blackfriday.HTMLSpan: // ignore other HTML tags + case blackfriday.HTMLBlock: + if bytes.HasPrefix(node.Literal, []byte("