Files
upstream-traggo/device/remove_current.go
upstream-mirror cda7c1a474
Some checks failed
build / build (push) Failing after 3s
snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 05:24:45 +05:00

19 lines
470 B
Go

package device
import (
"context"
"github.com/jinzhu/copier"
"github.com/traggo/server/auth"
"github.com/traggo/server/generated/gqlmodel"
)
// RemoveCurrentDevice removes the current authenticated device
func (r *ResolverForDevice) RemoveCurrentDevice(ctx context.Context) (*gqlmodel.Device, error) {
device := auth.GetDevice(ctx)
remove := r.DB.Delete(device)
gqlDevice := &gqlmodel.Device{}
copier.Copy(gqlDevice, device)
return gqlDevice, remove.Error
}